调用word和Excel的错误
我在asp.net中调用word或excel时没有成功,代码如下
object filename = "e:\\test.doc";
Word.ApplicationClass oWord = new Word.ApplicationClass();
oWord.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing);
oWord.Selection.TypeText("this is a test");
oWord.Selection.TypeParagraph();
oWord.ActiveDocument.SaveAs(ref filename,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
oWord.Quit(ref oMissing,ref oMissing,ref oMissing);
提示错误如下:
异常详细信息: System.Runtime.InteropServices.COMException: 服务器上不存在调用的方法。
源错误:
行 71:
行 72: object filename = "e:\\test.doc";
行 73: Word.ApplicationClass oWord = new Word.ApplicationClass();
行 74: oWord.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing);
行 75: oWord.Selection.TypeText("this is a test");
我是有引用word和excel的dll的,请大家帮我看看是怎么回事?