我尝试使用Interop.Word.Application打开.docx文件并将其转换为PDF。它作为控制台应用程序工作正常,但如果我在我的Web应用程序中使用相同的代码,它就无法工作。我尝试查看文件夹的权限。我已经将“Network Service”赋予了完全控制权限,但仍然在word.Documents.Open处得到未设置对象引用的错误。请问可能是什么问题?我被这个错误困住了,请帮帮我。非常感谢您的任何建议。谢谢。
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
object oMissing = System.Reflection.Missing.Value;
word.Visible = false;
word.ScreenUpdating = false;
string fileName = @"c:\OUTPUT\test.docx");
Document doc = word.Documents.Open(filename, 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, ref oMissing);
doc.Activate();
)
。请发布您应用程序中实际的代码。 - Eoin Campbell