Hallo,
ich weiß ich frage gerade vll ein bisschen oft aber das Thema AddIns find ich ziemlich schwer.
Und zwar wird ein GemeinsamesAddIn erstellt das nur für Word und Excel gebraucht wird.
Meine Frage:
Wie kann ich auf das aktuell geöffnete Dokument von Word zugreifen?
also z.b.: application.Activedocument
mfg
Google-Suche nach c# word shared addin active document
Word.Application oWordApplication = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
oWordApplication.ActiveDocument
- performance is a feature -
Microsoft MVP - @Website - @AzureStuttgart - github.com/BenjaminAbt - Sustainable Code
Dankeschön,
ich hätte dann noch eine Sache, ein Ereigns abfangen sozusagen.
Das printbefore:
Das was ich dann mit deiner Hilfe schon hätte:
oWordApplication.DocumentBeforePrint += new Word.ApplicationEvents4_DocumentBeforePrintEventHandler(Application_DocumentBeforePrint);
und:
void Application_DocumentBeforePrint(Word.Document Doc, ref bool Cancel)
{}
momentang implementiere ich das obere in der OnStartupComplete(), aber wenn der user das Dokument druckt wird das nicht abgefangen.
Weiß jemand wie ich das implementieren muss, oder ob ich da noch etwas zusätzliches implementieren muss?
mfg