I have a little program that opens a word document, does some changes on a table, exports it to PDF, and then closes the document and application. When I open the document again it still has my original changes in the table. It looks like it is being cached in some kind of way. Here is my code:
private void Open()
{
appWord = new Microsoft.Office.Interop.Word.Application();
appWord.DisplayAlerts = WdAlertLevel.wdAlertsNone;
string path = Environment.CurrentDirectory + "\\Resources\\document1.docx";
wordDocument = appWord.Documents.Open(path);
}
Remove some rows from some tables and export to PDF
private void Close()
{
object missing = Type.Missing;
object doNotSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
wordDocument.Close(doNotSaveChanges, missing, missing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocument);
appWord.Quit(ref doNotSaveChanges, ref missing, ref missing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(appWord);
}
Am I closing the document in a wrong way? Or is it being cached? Some temp file that is saved somewhere? I don't have any other word processes open.