0

Visual Studio2010統合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