也谈关于WORD的版本问题
我使用的是office的xp版本,在加入引用msword.olb之后,操作word.
在使用的过程中,不知道为什么代码和CSDN和csharp的帮助中代码出入很大,比如
object fileName = "c:\\database\\test.doc";
object readOnly = false;
object isVisible = true;
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);
其中我编写的代码中oWordApp没有Documents的属性.到是有一个get_Documents的方法.但是修改之后运行时候出现如下错误:
其他信息: 接口 Word._Application 的 QueryInterface 失败。
请高手指点.