Autor Beitrag
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mi 16.11.05 02:16 
hi frank,

hier mal der "komplette" quelltext...ich habe, wie gesagt, dass problem, dass in der kopfzeile
der programmname nicht richtig ausgerichtet wird.

noch eine frage...am schluss füge ich ja ein textfeld ein...mein problem ist nun, dass ich
mit der "selection" da nicht mehr rauskomme...alles, was ich danach schreibe, geht in die
textbox....hab das schon mit seekview etc. probiert, klappt aber alles nicht


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
 if iswordinstalled
  then begin
 try

   screen.Cursor:=crhourglass;
   myword := TWordApplication.Create(nil);
   mydoc:= TWorddocument.Create(nil);
   myword.Connect;
   myword.Visible:=false;
   mydoc.ConnectTo(myword.Documents.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam));

//   Kopfzeile einfuegen  #####################################################
   myword.ActiveWindow.ActivePane.View.SeekView := wdSeekCurrentPageHeader;
   //myword.Selection.TypeText(dateiname);
   myword.Selection.Borders.Item(wdborderbottom).LineStyle := wdlinestylesingle;
   myword.Selection.Borders.Item(wdborderbottom).LineWidth := wdlinewidth100pt;
   myword.Selection.Borders.Item(wdborderbottom).Color := wdcolorblack;
   //myword.Selection.TypeText(chr(vk_tab)+chr(vk_tab));
   myword.Selection.TypeText(dateiname+chr(vk_tab)+'Evaluierung GFT Sol[l]Ist');
   _alignment := wdaligntabright;
   _Leader := wdtableaderspaces;
   myword.Selection.ParagraphFormat.TabStops.Add(myword.CentimetersToPoints(15.87),_Alignment,_Leader);
//**************************************************************************************************
// hier ist der programmname immer nur mittig
//**************************************************************************************************
   //myword.Selection.TypeText('Evaluierung GFT Sol[l]Ist');

   _Count:=25;
   _Unit := WDCharacter;
   _Extend := wdextend;
   myword.selection.moveleft(_Unit,_Count,_Extend);
   myword.Selection.Font.Bold := wdtoggle;
   myword.Selection.Font.Name:='Verdana';

//   Fußzeile einfuegen  ######################################################
   myword.ActiveWindow.ActivePane.View.SeekView := wdseekcurrentpagefooter;
   _index := 'Erstellt von, Seite, Datum';
   _Richtext:=true;
   myword.NormalTemplate.AutoTextEntries.Item(_index).Insert(myword.Selection.Range,_richtext);
   myword.Selection.ParagraphFormat.Alignment := wdalignparagraphcenter;
   myword.Selection.Borders.Item(wdbordertop).LineStyle := wdlinestylesingle;
   myword.Selection.Borders.Item(wdbordertop).LineWidth := wdlinewidth100pt;
   myword.Selection.Borders.Item(wdbordertop).Color := wdcolorblack;

// Hauptdokument erzeugen Seite 1  ############################################
   myword.ActiveWindow.ActivePane.View.SeekView := wdseekmaindocument;

// Logo erzeugen
   myword.Selection.TypeParagraph;
   _select := msofalse;

   tempfilename:=extractfilepath(paramstr(0))+'gftsollist'+datetostr(date)+datetostr(time)+'.jpg';
   try
   fauswertung.Image1.Picture.SaveToFile(tempfilename);
   except
   end;

   if fileexists(tempfilename)
    then
     begin
      _true := true;
      _false := false;
      _left :=myword.centimeterstopoints(12.8);
      _top:=myword.centimeterstopoints(0.1);
      _width:=myword.centimeterstopoints(3.1);
      _height:=myword.CentimetersToPoints(3.1);
      myword.ActiveDocument.Shapes.AddPicture(tempfilename,_false,_true,_left,_top,_width,_height,EmptyParam);

      if fileexists(tempfilename)
       then deletefile(tempfilename);
      myword.Selection.ParagraphFormat.Alignment:=wdalignparagraphright;
//      myword.Selection.ShapeRange.ZOrder(msobringinfrontoftext);

     end;

// panel erzeugen
   myword.ActiveDocument.Shapes.AddTextbox(msoTextorientationhorizontal
                ,myword.CentimetersToPoints(2.5),myword.CentimetersToPoints(2.5)
                ,myword.CentimetersToPoints(16),myword.CentimetersToPoints(3.3)
                ,EmptyParam).select(_Select);

   myword.Selection.ShapeRange.TextFrame.TextRange.Select;
   myword.Selection.ParagraphFormat.Alignment:=wdalignparagraphleft;

   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Autor');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+chr(vk_tab)+':'+chr(vk_tab)+header.Autor);
   myword.Selection.TypeParagraph;
   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Katalog');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+':'+chr(vk_tab)+header.Name);
   myword.Selection.TypeParagraph;
   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Ident 1');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+':'+chr(vk_tab)+header.Text1);
   myword.Selection.TypeParagraph;
   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Ident 2');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+':'+chr(vk_tab)+header.Text2);
   myword.Selection.TypeParagraph;
   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Version');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+':'+chr(vk_tab)+header.Text3);
   myword.Selection.TypeParagraph;
   myword.Selection.Font.Bold := 1;
   myword.Selection.TypeText('Datum');
   myword.Selection.Font.Bold := 0;
   myword.Selection.TypeText(chr(vk_tab)+chr(vk_tab)+':'+chr(vk_tab)+header.Datum);
   myword.Selection.TypeParagraph;
   myword.Selection.ShapeRange.Fill.Visible := msoTrue;
   myword.Selection.ShapeRange.Fill.Solid;
   myword.Selection.ShapeRange.Fill.ForeColor.RGB := RGB(234,234,234);
   myword.Selection.ShapeRange.Fill.Transparency:=0.41;
   myword.Selection.ShapeRange.Line.Visible := msofalse;
   myword.Selection.ShapeRange.ZOrder(msosendtoback);


kann ich eigentlich das dokument am ende schützen? so dass der anwender nicht die texte austauschen kann bzw. die elemente verschieben kann??

danke und gruß,

Wile E.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 16.11.05 22:03 
für den code habe ich heute keine Zeit.
Schützen: ja das geht, es gibt einen protect-Befehl im Dokument, kannst sogar ein Passwort vergeben. aber aufpassen, das du auch den Vorgabetext der Formualrfelder setzt, sonst ist anch einem entschützen und erneuten schützen des Doks durhc den Anwender alles weg.

MfgFrank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 20.11.05 21:37 
ok, mein fehler. Mein code war ja für den normalen Text, in der Kopf und Fußzeile sind schon 2 Tabs automatisch drin 8Links ist klar, Zentriert und rechts sind automatisch da)

ausblenden Delphi-Quelltext
1:
2:
myword.Selection.TypeText(dateiname+chr(vk_tab)+chr(vk_tab)+'Evaluierung GFT Sol[l]Ist'); 
(kein Tab erstellen

somit steht Dateiname links und Evaluierung rechts

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: So 20.11.05 22:34 
hi frank,

so hatte ich das ja....klappt in der regel auch ganz gut,
aber wenn der dateiname zum beispiel "iiii" (auf was anwender halt so alles kommen)
ist, dann reichen die beiden tabs nicht mehr...umgekehrt genauso, wenn der dazeiname zu lamng ist,
sind 2 tabs zu viel...und über stringlänge zu gehen bringt ja nichts, da das "i" weniger platz braucht als das "w"....und die schrift so einzustellen, dass alle buchgstaben gleich viel platz benötigen, sieht nicht gut aus...wäre also schön, wenn es eine möglichkeit gäbe, die position im document in zentimetern oder so berechnen zu können, oder feststellen zu können, ob es gerade einen zeilenumbruch gegeben hat oder nicht, damit man evtl. ein tab löschen kann???

gruß, frank

_________________
Wer in diesem Beitrag Rechtschreibfehler findet...darf sie behalten
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 21:55 
Hast du dir mal dein erstelltes Wordoc angeschaut? geh in die Kopfzeile und gugg sie dir an. Was würdest du du denn machen, damit die Anzeige richtig aussieht?

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 22:25 
wenn eins zuviel da ist, würde ich es wegnehmen, wenn ein zuwenig das ist, würde ich eins hinzutun...aus mangel besseren wissens...???

_________________
Wer in diesem Beitrag Rechtschreibfehler findet...darf sie behalten
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 22:28 
Sicher das du das tun würdest? Warum nicht den mittigen Tab löschen? Dann hast du nur den rechten und ein Tabzeichen reicht zwischen den beiden Texten.

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 22:31 
ich probier das gleich nochmal aus, meine aber in erinnerung zu haben, dass ein tab zu wenig ist, der programmtext "Evaluierung....." steht dann nicht ganz rechts...würde es evtl. helfen,
wenn ich das als blockabsatz mache?

_________________
Wer in diesem Beitrag Rechtschreibfehler findet...darf sie behalten
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 22:41 
einer ist zu wenig, da ist bei einem "normalen" dateinamen der text schon zu weit links, siehe bild
vielleicht komme ich auch nicht mit den "linken" und "rechten" tabs klar?

ausblenden Delphi-Quelltext
1:
myword.Selection.TypeText(dateiname+chr(vk_tab)+'Evaluierung GFT Sol[l]Ist');					
Einloggen, um Attachments anzusehen!
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 22:46 
in deinem screenshot bist du aber nicht in der Kopzeile (Menu ansicht ->Kopf und Fußzeile)

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 22:53 
doch, das ist der text aus der kopfzeile, screenshot allerdings aus dem originaldokument, wie ich es von delphi erstellt bekomme...

anbei bild mit ansicht kopfzeile
Einloggen, um Attachments anzusehen!
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 23:02 
jetzt siehst du doch die 2 gesetzten Tabstops im Lineal. den mittigen würdest du löschen.

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:05 
aber ich habe doch nur ein tab geschrieben?? zwischen "Unbenannt 1" und "Evalueirung..."...mehr ist da gar nicht drin...oh mein gott, ich glaub´, ich bin selbst für word zu doof
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:08 
jetzt sind da 2 tabs zwischen, aber oben in der leiste hat sich nichts getan???
Einloggen, um Attachments anzusehen!
_________________
Wer in diesem Beitrag Rechtschreibfehler findet...darf sie behalten
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 23:16 
im Lineal, siehst du es jetzt?
Einloggen, um Attachments anzusehen!
_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:20 
jo, gesehen...aber wo kommen die her? bzw. viel wichtiger: wie kriege ich das so hin, das das richtig ist...beim versuch mit nur einem tabstop hats ja auch nicht geklappt...sorry, keine ahnung
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 21.11.05 23:23 
den mittigen tabstop löschen.

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:27 
hilfe...aber wie??? unten stehen die beiden versionen, mit denen ich die screenshots erzeugt habe...beide mit dem selben ergebnis...wie kann ich denn da den "mittigen" tabstop löschen???

ausblenden Delphi-Quelltext
1:
myword.Selection.TypeText(dateiname+chr(vk_tab)+chr(vk_tab)+'Evaluierung GFT Sol[l]Ist');					


ausblenden Delphi-Quelltext
1:
myword.Selection.TypeText(dateiname+chr(vk_tab)+'Evaluierung GFT Sol[l]Ist');					

_________________
Wer in diesem Beitrag Rechtschreibfehler findet...darf sie behalten
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:30 
und wenn ich das in word mache...ergebnis siehe bild
Einloggen, um Attachments anzusehen!
WileECoyote Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mo 21.11.05 23:38 
ok, jetzt habe ich den richtigen erwischt, jetzt siehts so aus...
Einloggen, um Attachments anzusehen!