为什么当我调用两次oWordApp.Documents.Open时程序就会死掉,并将要打开的文件锁定

kunting 2006-04-17 04:46:14
为什么当我调用两次oWordApp.Documents.Open时程序就会死掉,并将要打开的文件锁定,代码如下
object readOnly = false;
object isVisible = false;
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
Word.Document oWordDoc = oWordApp.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,ref missing);
oWordApp.Application.Quit(ref missing, ref missing, ref missing);
...全文
214 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
kunting 2006-04-18
  • 打赏
  • 举报
回复
可能是我的描述不够准确!这个程序即时打开不同的文档也会在运行到以下代码处死掉,如果我直接去打开这个word文档系统会提示
Word.Document oWordDoc = oWordApp.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,ref missing);
转换文件或打开文件副本选择
wxdl1981 2006-04-17
  • 打赏
  • 举报
回复
object readOnly = true;
一个文件可以同时被打开n次,
但只有第一个打开的程序有写的权限
comefeel 2006-04-17
  • 打赏
  • 举报
回复
the ref will using the system memory.

111,093

社区成员

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

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

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