WordApp.Documents.Add(
ref
Nothing,
ref
Nothing,
ref
Nothing,
ref
Visible)
最后一个参数的问题,在此句之前我把Visibale设置成false了,因为我不想在程序生成word文档的时候让用户看见word界面,后来发现即使Visible=true用户也看不到Word界面,
解决方法:Visible=true,能正常运行了,一切OK!
1
using
System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace Business
6 {
7 public class WordDocument
8 {
9 Microsoft.Office.Interop.Word.Application WordApp;
10 Microsoft.Office.Interop.Word.Document WordDoc;
11 object SaveChanges = true;
12 object Visible = true;//问题就在这里,改成true后就能正常运行了
13 object Nothing = System.Reflection.Missing.Value;
14 object WordDocPath;
15 public
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace Business
6 {
7 public class WordDocument
8 {
9 Microsoft.Office.Interop.Word.Application WordApp;
10 Microsoft.Office.Interop.Word.Document WordDoc;
11 object SaveChanges = true;
12 object Visible = true;//问题就在这里,改成true后就能正常运行了
13 object Nothing = System.Reflection.Missing.Value;
14 object WordDocPath;
15 public