I'm new to VSTO and OpenXML and I would like to develop some Word add-in. This add-in should use OpenXML, so is it possible to edit opened document? For example I have opened Word document and I would like to replace some text using OpenXML on button click.
So I have this code.
var fileFullName = Globals.ThisAddIn.Application.ActiveDocument.FullName;
Globals.ThisAddIn.Application.ActiveDocument.Close(WdSaveOptions.wdSaveChanges, WdOriginalFormat.wdOriginalDocumentFormat, true);
//edit document using OpenXml here
Globals.ThisAddIn.Application.Documents.Open(fileFullName);
And i found this to add text to Word using OpenXML How to: Open and add text to a word processing document (Open XML SDK)
But i can't figure out how to make them work together.
Can anyone help me with this, Thanks