c#操作word,word对话框忽略掉问题

suxiaoguai 2004-11-25 07:33:00
我用c#操作word,使用COM引用的方式,是ASP.net,在服务器端运行的,可是我发现某些WORD文档在打开的时候会弹出对话框,例如某某格式还未安装啊,某个格式打开可能会不按照原来的样子打开啊,我记得应该可以把这个对话框忽略掉的,可是在C#里怎么设置我不知道了,我的代码是这样的:
Word.ApplicationClass WordApp=new Word.ApplicationClass();
WordApp.DisplayAlerts=Word.WdAlertLevel.wdAlertsNone;


object fileName =path;
object readOnly = true;
object isVisible = true;
object missing = System.Reflection.Missing.Value;

WordApp.Visible = true;
WordApp.Activate();

Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing,ref readOnly,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,ref missing,ref missing,ref missing);

哪位高手能够告诉我怎么忽略掉那个对话框呢?不要弹出来,因为是在服务器端运行的,如果弹出来程式就死在那里了 :(
...全文
139 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
suxiaoguai 2004-11-26
  • 打赏
  • 举报
回复
不是每次都会的 是在某些文件啊,比如有宏在里面啊,等等,但不是每次都会的。我用的是XP
xiaomaolover 2004-11-25
  • 打赏
  • 举报
回复
我用的是office 2003就没有事的。是不是你的版本不对呀?
xiaomaolover 2004-11-25
  • 打赏
  • 举报
回复
我怎么没遇到过。操作Word文件,怎么会出对话框呢??

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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