将Word转换为PDF – 禁用“保存”对话框

我有一个用c#编写的Word to PDF Converter,除了一件事情以外工作正常。 有时(在某些Word文件上)背景中有一条消息, 源文件中保存更改 – >是否取消 – 但我没有在源文件中进行任何更改。 我只是想从Word文件创建一个PDF文件,而不做任何改动。

那么有可能禁用此提示,或自动设置为“否”。 ?

这是我的代码:

// 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); 

您是否尝试将false作为Quit的第一个参数传递?