0

我正在使用以下代码,它在 Visual Studio 2010 集成 Web 服务器中运行良好,但在 IIS 上部署时,我在 ** 行出现错误:

        Word.Application oWord = new Word.Application();
        Word.Document oWordDoc; //= new Word.Document();
        object breakPage = Word.WdBreakType.wdPageBreak;

        oWord.Visible = false;
        oWord.Options.set_DefaultFilePath(Microsoft.Office.Interop.Word.WdDefaultFilePath.wdUserTemplatesPath, Server.MapPath(TemplatesFolder)); //@"D:\Presentationalism\Presentationalism\Presentations\Templates");

        Object oTemplatePath = Server.MapPath(TemplatesFolder + templates[ddTemplates.SelectedIndex]);
        **oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);**

        oWordDoc.Activate(); 

以下是错误:

Word was unable to read this document.  It may be corrupt.
Try one or more of the following:
* Open and Repair the file.
* Open the file with the Text Recovery converter.

我如何解决它?

4

0 回答 0