调用word和Excel的错误

songlian 2003-07-23 03:42:52
我在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的,请大家帮我看看是怎么回事?
...全文
39 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
songlian 2003-07-23
  • 打赏
  • 举报
回复
但是通过windows访问的话是完全正常的,通过web访问就是不幸,我也通过dcomcnfg设置了权限,为什么还是不行呢?
greystar 2003-07-23
  • 打赏
  • 举报
回复
我想可能是版本的问题吧。我也没试过。
songlian 2003-07-23
  • 打赏
  • 举报
回复
怎么没有人回答呢?我自己up

62,133

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧