Hallo,
ich brauche dringend Eure Unterstützung !!???
ich würde gerne einen Autotext zu einen bestimmten Word Datei einfügen, und dabei den Inhalt des Dokumentes aktualissieren.
habe schon versucht aber klappt nicht so ganz.
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| object fileName = @"C:\tmp\Test.docx"; object missing = System.Reflection.Missing.Value; String text = "AutoText"; String textValue = "AutoTextValue";
Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); Microsoft.Office.Interop.Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
oWordDoc.Activate(); Template oTpl = (Template)oWordDoc.get_AttachedTemplate();
oTpl.AutoTextEntries.Add(text , textValue );
oWordApp.Application.Quit(ref missing, ref missing, ref missing); |
Vielen Dank
Moderiert von
Kha: B- durch C#-Tags ersetztModeriert von
Kha: Topic aus C# - Die Sprache verschoben am Di 27.04.2010 um 13:47