I have a Word to PDF converter written in C # that works fine except for one thing. Sometimes (in some Word files) there is a message in the background with Save changes to the source file → YES NO CANCEL - but I do not make any changes to the source file. I just want to create a PDF file from a Word file without changing anything.
So, it is possible to disable this tooltip or automatically set the value to "NO".
Here is my code:
// Create an instance of Word.exe Microsoft.Office.Interop.Word._Application oWord = new Microsoft.Office.Interop.Word.Application(); // Make this instance of word invisible oWord.Visible = false; oWord.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone; oWord.Options.SavePropertiesPrompt = false; oWord.Options.SaveNormalPrompt = false; // Interop requires objects. object oMissing = System.Reflection.Missing.Value; object isVisible = true; object readOnly = true; object oInput = input; object oOutput = output; object oFormat = format; // Load a document into our instance of word.exe Microsoft.Office.Interop.Word._Document oDoc = oWord.Documents.Open(ref oInput, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref isVisible, ref oMissing, ref oMissing, ref oMissing, ref oMissing); // Make this document the active document. oDoc.Activate(); // Save this document in Word 2003 format. oDoc.SaveAs(ref oOutput, ref oFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); // Always close Word.exe. oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
source share