Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Selbst erstellte Felder in Wor aus Delphi ansprechen (https://www.delphipraxis.net/114730-selbst-erstellte-felder-wor-aus-delphi-ansprechen.html)

Lord_S 30. Mai 2008 08:27


Selbst erstellte Felder in Wor aus Delphi ansprechen
 
Hallo

Habe da mal ne Frage. Und zwar wil ich aus Delphi heraus ein Word- Dokument öffnen und die, in den Dokument enthaltenen Felder Ansprechen und Aktualisieren!
Delphi-Quellcode:
    word.Visible:=true;
    word.Documents.Open (FileName:=verz + '\0-2016_Zusatzinfo_SV.doc', //muss im Pfad '\Tabellen stehen'
                        ConfirmConversions:=False,
                        ReadOnly:=False,
                        AddToRecentFiles:=False,
                        PasswordDocument:='',
                        PasswordTemplate:='',
                        Revert:=True,
                        WritePasswordDocument:='',
                        WritePasswordTemplate:='',
                        Format:='wdOpenFormatAuto');
    word.ActiveDocument.BuiltInDocumentProperties(??):=IntToStr(dr4);
    word.ActiveDocument.BuiltInDocumentProperties(??):=IntToStr(dr3);
    word.ActiveDocument.BuiltInDocumentProperties(??):=IntToStr(dr2);
    word.ActiveDocument.BuiltInDocumentProperties(??):=IntToStr(dr1);
    word.ActiveDocument.BuiltInDocumentProperties(??):=Vkgl_IV.Pos;
    word.ActiveDocument.BuiltInDocumentProperties(??):=Vkgl_III.Pos;
    word.ActiveDocument.BuiltInDocumentProperties(??):=Vkgl_II.Pos;
    word.ActiveDocument.BuiltInDocumentProperties(??):=Vkgl_I.Pos;
    word.ActiveDocument.BuiltInDocumentProperties(??):='DN '+Ventil1.DN +' x '+VentilHDH_I+'°';
    word.ActiveDocument.BuiltInDocumentProperties(??):='DN '+Ventil2.DN +' x '+VentilHDH_II+'°';
    word.ActiveDocument.BuiltInDocumentProperties(??):='DN '+Ventil3.DN +' x '+VentilHDH_III+'°';
    word.ActiveDocument.BuiltInDocumentProperties(??):='DN '+Ventil4.DN +' x '+VentilHDH_IV+'°';
    word.ActiveDocument.BuiltInDocumentProperties(??):='103';
    word.ActiveDocument.BuiltInDocumentProperties(??):='102';
    word.ActiveDocument.BuiltInDocumentProperties(??):='101';
    word.ActiveDocument.BuiltInDocumentProperties(??):='100';
//Folgende Teil sind im Word festgelegte Felder, und können über die Entsprechende Zahl aufgerufen werden
    word.ActiveDocument.BuiltInDocumentProperties(1):=ZusInfo.Ben;                          //Titel (Benennung)
    word.ActiveDocument.BuiltInDocumentProperties(2):=DateToStr(Form1.DateTimePicker1.Date); //Inhalt (Datum)
    word.ActiveDocument.BuiltInDocumentProperties(3):=Form1.Label17.Caption;                 //Autor (Name)
    word.ActiveDocument.BuiltInDocumentProperties(4):=ZusInfo.UNR;                          //Stichwörter (Sachnummer)
    word.ActiveDocument.BuiltInDocumentProperties(5):=Form1.Label14.Caption;                //Kommentar (Abteilung)
    word.ActiveDocument.BuiltInDocumentProperties(20):=Form1.Edit4.Text;                //Kommentar (Manager)
    word.ActiveDocument.BuiltInDocumentProperties(18):=Text_ZusInfo_Ben;                                  //Kategorie (Untertitel)



    word.ActiveWindow.ActivePane.View.SeekView := 10;
    word.Selection.WholeStory;
    word.Selection.Fields.Update;
    word.ActiveWindow.ActivePane.View.SeekView := 0;
    word.Selection.WholeStory;
    word.Selection.Fields.Update;
Nun die mit ?? gekenzeichneten Stellen sind mein Problem, wenn ich dort den in Word vergebenen Feldnamen eingebe, bekomme ich die Meldung "Undefinierter Bezeichner". Ein anderer Zahlencode ergebe keinen Sinn.
Frage wäre jetzt, od es eine bestimmte Deklaration für solche Felder gibt?

tomsel 30. Mai 2008 08:39

Re: Selbst erstellte Felder in Wor aus Delphi ansprechen
 
Versuch's mal mit CustomDocumentProperties

Lord_S 30. Mai 2008 08:45

Re: Selbst erstellte Felder in Wor aus Delphi ansprechen
 
Supi funktioniert :lol:

Danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:57 Uhr.

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