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
|
wordApplication1 := TwordApplication.Create(nil);
// ouverture du fichier
FileName := ParamStr(1); // ou .rtf ...
Visible := True; // Le serveur COM est affiché
WordApplication1.Documents.Open(FileName, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam,
EmptyParam,EmptyParam, EmptyParam,
EmptyParam, EmptyParam, Visible);
// impression
Range:=wdPrintAllDocument; // page Courante = wdPrintCurrentPage, ...
PageType:=wdPrintAllPages; // pages impaires = wdPrintOddPagesOnly, ...
Background:=False;
wordApplication1.ActivePrinter := 'PDF-XChange Lite 3.0';
WordApplication1.ActiveDocument.PrintOut(BackGround,EmptyParam,
Range,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
PageType,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam);
l_dot := string('C:\Users\Administrateur.TEST-2008\AppData\Roaming\Microsoft\Modèles\Normal.dot');
wordApplication1.activeDocument.Set_AttachedTemplate(l_dot);
SaveChanges := WdDoNotSaveChanges;
OriginalFormat := UnAssigned;
RouteDocument := UnAssigned;
wordApplication1.ActiveDocument.Close(SaveChanges,OriginalFormat,RouteDocument);
// fermeture
SaveChanges := WdDoNotSaveChanges;
OriginalFormat := wdOpenFormatAuto;
RouteDocument := UnAssigned;
wordApplication1.Quit(SaveChanges,OriginalFormat,RouteDocument);
wordApplication1.Free; |
Partager