C#我用axFramerControl显示Word,现在我用它自带的打开打开Word时获取这份word 的代码如下,报下面的错误 10
Documentdoc=(Document)this.axFramerControl1.ActiveDocument;Microsoft.Office.Interop.W...
Document doc = (Document)this.axFramerControl1.ActiveDocument;
Microsoft.Office.Interop.Word.ApplicationClass app = (Microsoft.Office.Interop.Word.ApplicationClass)this.axFramerControl1.GetApplication;
docM.Create(doc, app);
public void Create(Document doc,Microsoft.Office.Interop.Word.Application app)
{
//killWinWordProcess();
_wordApp =app;
//_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
//_wordApp.Visible = false;
dc = doc;
}
这个错误 是在获取Word的Application时报的。望高手解答,或者教我怎么丛axFramerControl中获取Word。
开始是通过路径获取的,
public void CreateNewDocument(string filePath)
{
killWinWordProcess();
_wordApp = new ApplicationClass();
_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
_wordApp.Visible = false;
object missing = System.Reflection.Missing.Value;
object templateName = filePath;
dc = _wordApp.Documents.Open(ref templateName, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
}
好像也只要取Document和Application。于是我模仿写了个,就有了上面的错误了。 展开
Microsoft.Office.Interop.Word.ApplicationClass app = (Microsoft.Office.Interop.Word.ApplicationClass)this.axFramerControl1.GetApplication;
docM.Create(doc, app);
public void Create(Document doc,Microsoft.Office.Interop.Word.Application app)
{
//killWinWordProcess();
_wordApp =app;
//_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
//_wordApp.Visible = false;
dc = doc;
}
这个错误 是在获取Word的Application时报的。望高手解答,或者教我怎么丛axFramerControl中获取Word。
开始是通过路径获取的,
public void CreateNewDocument(string filePath)
{
killWinWordProcess();
_wordApp = new ApplicationClass();
_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
_wordApp.Visible = false;
object missing = System.Reflection.Missing.Value;
object templateName = filePath;
dc = _wordApp.Documents.Open(ref templateName, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
}
好像也只要取Document和Application。于是我模仿写了个,就有了上面的错误了。 展开
2个回答
展开全部
using Word = Microsoft.Office.Interop.Word;
//=====================================
Word.Document doc = axFramerControl1.ActiveDocument as Word.Document;
Word.Application app = doc.Application;
//=====================================
Word.Document doc = axFramerControl1.ActiveDocument as Word.Document;
Word.Application app = doc.Application;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
百事牛
2024-10-28 广告
2024-10-28 广告
作为深圳奥凯丰科技有限公司的工作人员,关于Word2007文档取消密码的方法简述如下:要取消Word 2007文档的密码,首先需通过密码正确打开该文档。接着,点击左上角的Office按钮,选择“准备”下的“加密文档”选项。在弹出的对话框中,...
点击进入详情页
本回答由百事牛提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询