I am using the following code which works fine in Visual Studio 2010 integrated Web Server but when deployed on IIS I get error on the ** line:
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();
following is the error:
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.
how do I fix it?