Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Wordautomation Zeilenabstand einstellen (https://www.delphipraxis.net/208260-wordautomation-zeilenabstand-einstellen.html)

mmw 7. Jul 2021 17:56

AW: Wordautomation Zeilenabstand einstellen
 
hallo,
als Beispiel

Delphi-Quellcode:
procedure TForm50.Button1Click(Sender: TObject);

var myword:word_tlb._application;
    mydocument,
    myvisible,
    mysavechanges,
    mytemplate,
    newtemplate,
    mydokumenttype,
    myorginalformat,
    myRouteDocument:Olevariant;

begin

  myword:=Word_TLB.CoWordApplication.Create;

  mytemplate:='Normal';
  newtemplate:=False;
  mydokumenttype:=wdNewBlankDocument;
  myvisible:=True;

  mysavechanges:=wdDoNotSaveChanges;
  myorginalformat:=wdOriginalDocumentFormat;
  myRouteDocument:=False;

  try

   myword.Documents.Add(mytemplate,newtemplate,mydokumenttype,myvisible);

   myword.Visible:=True;


   // myword.Quit(mysavechanges,myorginalformat,myRouteDocument);

  except

  end;
end;

hier ist eine gute Erklärung


[URL="https://www.delphi-treff.de/tipps-tricks/comoledde/andere-office-anwendungen/excel-mit-ole-automation-steuern/"]https://www.delphi-treff.de/tipps-tricks/comoledde/andere-office-anwendungen/excel-mit-ole-automation-steuern/[/URL]


Gruß

Alfredo 8. Jul 2021 12:38

AW: Wordautomation Zeilenabstand einstellen
 
Hallo Lemmy vielen Dank für die Infos.

Es hat etwas gedauert, bis ich dcloffice2010270.bpl in \21\bin\ gefunden hatte.

Gruß
Alfred

Alfredo 8. Jul 2021 12:53

AW: Wordautomation Zeilenabstand einstellen
 
Hallo mmw,

ich habe den Beispiel etwas abgeändert, damit es bei mir läuft.

Delphi-Quellcode:
procedure TForm2.Button1.click(Sender: TOjekt);
Var
   mytemplate: OleVariant;
   myvisible: OleVariant;
   newtemplate: OleVariant;
   mydokumenttype: OleVariant;

begin

  mytemplate := 'Normal';
  newtemplate := False;
  mydokumenttype := wdNewBlankDocument;
  myvisible := True;
 
  myword.connect;
  myword.Visible := True;
  myword.Documents.Add(mytemplate,newtemplate,mydokumenttype,myvisible);
  myword.Selection.Font.Name := 'Courier New';
  myword.Selection.Font.Size := 10;
  myword.Selection.Font.Bold := 1;
  myword.Selection.TypeText('Hello World');

end;
Wo könnte ich denn auf Querdruck umstellen?

Gruß
Alfred

Andreas13 8. Jul 2021 13:18

AW: Wordautomation Zeilenabstand einstellen
 
Zitat:

Zitat von Alfredo (Beitrag 1492032)
.. Es hat etwas gedauert, bis ich dcloffice2010270.bpl in \21\bin\ gefunden hatte.

Hallo Alfredo,
Du kannst "verschollene" Dateien auf Festplatten/USB-Sticks etc. am schnellsten mit Everything.exe https://www.voidtools.com/ aufspüren.
Gruß, Andreas

Alfredo 8. Jul 2021 16:02

AW: Wordautomation Zeilenabstand einstellen
 
Hallo mmw,

ich hab den Querdruck gefunden:

Delphi-Quellcode:

myword.Selection.PageSetup.Orientation := 1;

mmw 8. Jul 2021 16:15

AW: Wordautomation Zeilenabstand einstellen
 
Hallo,

für mein Beispiel muss man die Typbibliothek erstellen und einbinden.

Haupsache es funktioniert.

Gruß

Alfredo 9. Jul 2021 08:36

AW: Wordautomation Zeilenabstand einstellen
 
Hallo mmw,

ich habe die Ursache gefunden warum es bei mir funkioniert.

Wenn in der Delphi-Komponenten-Palette "Serverkomponenten" die Komponente "TWordApplication"
existiert, ist die Typbiliothek bereits installiert.

In WordApplikation1 habe ich den Namen auf myword geändert und konnte deshalb Deinen
Programmcode weiter verwenden.

Gruß
Alfred


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:56 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz