Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 28.01.08 13:33 
Hi, Delpher,

ich verwende den folgenden Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
try
        MSWord := CreateOleObject('Word.Application');
      except
        ShowMessage('Word kann nicht gestartet werden!');
        Exit;
      end;
      msword.documents.open(form1.label30.caption+'OUTTXT\'+dnam);
      erg := form1.xMessageDlg('Word im Querformat ODER im Hochformat?',
            mtConfirmation, [mbYes, mbno, mbcancel], ['Quer', 'Hoch', 'Abbrechen'], self.font);
        case erg of
          mryes: msword.selection.pagesetup.orientation := 1;  // Querformat }
          mrno : msword.selection.pagesetup.orientation := 0;  // Hochformat }
        end;
      msword.selection.font.size := 8;
      msword.visible := true;


Die Formatierung, z.B. pagesetup wird nicht durchgeführt, ich nehme an, weil keine wirksame selection erfolgte. Wie kann ich die denn für das gesamte Dokument erreichen?

Vielen Dank für Hilfe, sagt
Detlef A.


Hab's per Zufall gefunden!! Für Interessierte:

ausblenden Delphi-Quelltext
1:
2:
  msword.activedocument.select;  
  msword.selection.font.name := 'Courier New'; msword.selection.font.size := 8;


bis zum nächsten Mal, Detlef