if (!axWebBrowserRptContent.IsDisposed)//定义的一个允许在窗体内浏览网页的WebBrowser控件
{//WebBrowser控件打开了oApplication的word应用,里面打开一个oDocument文档
SaveWord();//定义的保存word的函数
Object refmissing = System.Reflection.Missing.Value;
axWebBrowserRptContent.Navigate("about:blank", ref refmissing, ref refmissing, ref refmissing, ref refmissing);
object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
if (oDocument != null) oDocument.Close(ref doNotSaveChanges,ref refmissing,ref refmissing);
if (oApplication != null) oApplication=null;
}
运行到黑体部分时报错“此方法或属性无效 因为 此文档在另一应用程序中 ”,烦请大哥赐教!
{//WebBrowser控件打开了oApplication的word应用,里面打开一个oDocument文档
SaveWord();//定义的保存word的函数
Object refmissing = System.Reflection.Missing.Value;
axWebBrowserRptContent.Navigate("about:blank", ref refmissing, ref refmissing, ref refmissing, ref refmissing);
object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
if (oDocument != null) oDocument.Close(ref doNotSaveChanges,ref refmissing,ref refmissing);
if (oApplication != null) oApplication=null;
}
运行到黑体部分时报错“此方法或属性无效 因为 此文档在另一应用程序中 ”,烦请大哥赐教!
解决方案 »
- 请教个关于多线程调用webservice接口是否会相互影响的问题
- 做一个能够以文件夹为单位提取txt内容的winform,求助!
- GDI+画图严重问题,非常急~
- C#读excel相关?急急
- 同样的slq语句,在不同电脑上的执行时间为什么差距这么大
- 对连接池的有几点理解不明白之处,请各位指点
- 求解?255个数据表,如何能在5个工作日内做它的设计文档?
- 用Socket作web服务器,用什么类来分析得到的http string?
- 测试测试,ftp客户端组件,唔,有的机子上可以,有的机子上怎么就不行,HELP!!!!!
- 用OleDbConnection来连接ORACLE数据库,如何写连接串?
- asp.net(C#)怎样返回上一次打开的页面,就像浏览器的后退按钮一样、
- 请问大家如何在 combobox 的 item中加入 checkbox?
是否是SaveWord();
这一句?
没有你出现的问题 //Word.ApplicationClass WordApp = new Word.ApplicationClass(); //// give any file name of your choice.
//object fileName = "D:\\aa.doc";
//object readOnly = false;
//object isVisible = false; //// the way to handle parameters you don't care about in .NET
//object missing = System.Reflection.Missing.Value;
//WordApp.Visible = false;
//// Make word visible, so you can see what's happening
////WordApp.Visible = true;
//// Open the document that was chosen by the dialog
//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, ref missing); //Word.WdStatistic stat = Word.WdStatistic.wdStatisticPages;
//int num = aDoc.ComputeStatistics(stat, ref missing);
//System.Console.WriteLine("The number of pages in doc is {0}",
// num); //foreach (Word.Range r in aDoc.Words)
//{
// Debug.WriteLine("value:" + r.Text);
//}
//System.Console.ReadLine();
//object o = false;
//aDoc.Close(ref o, ref missing, ref missing);
//WordApp.Quit(ref o, ref missing, ref missing);