我在程序中调用word时,向word中添加内容时则出现下列错误提示: ************************************************* 未处理的“System.Runtime.InteropServices.COMException”类型的异常出现在 文件检查及改正.exe 中。
其他信息: 被呼叫方拒绝接收呼叫。
************************************************* 我的源代码如下: private Word.Application oWordApplic;
private Word.Document ThisDocument;object oMissing = System.Reflection.Missing.Value;
//Start Word and create a new document.
oWordApplic = new Word.ApplicationClass();
oWordApplic.Visible = true;
ThisDocument = oWordApplic.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
// Clear out any existing information.
Object start = Type.Missing;
Object end = Type.Missing;
Object unit = Type.Missing;
Object count = Type.Missing;
object oMissing = System.Reflection.Missing.Value;//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
oPara1 = ThisDocument.Paragraphs.Add(ref oMissing); //报错
oPara1.Range.Text = "Heading 1";
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24;
oPara1.Range.InsertParagraphAfter();
其他信息: 被呼叫方拒绝接收呼叫。
************************************************* 我的源代码如下: private Word.Application oWordApplic;
private Word.Document ThisDocument;object oMissing = System.Reflection.Missing.Value;
//Start Word and create a new document.
oWordApplic = new Word.ApplicationClass();
oWordApplic.Visible = true;
ThisDocument = oWordApplic.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
// Clear out any existing information.
Object start = Type.Missing;
Object end = Type.Missing;
Object unit = Type.Missing;
Object count = Type.Missing;
object oMissing = System.Reflection.Missing.Value;//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
oPara1 = ThisDocument.Paragraphs.Add(ref oMissing); //报错
oPara1.Range.Text = "Heading 1";
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24;
oPara1.Range.InsertParagraphAfter();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货