Reputation: 1627
I created Word add-in and want to execute it on the current Word file instead of using the file Path on disk. How I can refer to the Active Document ?
I'm now using the file Path like this :
string Filepath= @"D:\Word-addins\Example\Test.docx";
and how I can determine the Active file path to save the result on the same path ?
Upvotes: 3
Views: 765
Reputation: 21788
In a word Add-In, the current document is simply ThisDocument
.
You will have to generate this class yourself (as it derives from Microsoft.Office.Tools.Word.DocumentBase
) as explained here:
Try to understand the Word Object Model to know how to work with text in the current document, stuff like this.Selection etc.
There is even a tutorial on how to create your first document level Add-In.
Upvotes: 1