使用c#读取word文件时遇到问题 [英] facing problem while reading word file using c#
本文介绍了使用c#读取word文件时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
here is my code
public string Test(string path)
{
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
object file = path;
object nullobj = System.Reflection.Missing.Value;
Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj);
string result = doc.Content.Text.Trim();
doc.Close();
return result;
}
,错误如下:
and the error is as following:
Error 2 No overload for method 'Open' takes '12' arguments
Error 3 No overload for method 'Close' takes '0' arguments
推荐答案
Open方法有16个参数。看看 MSDN [ ^ ]页面。
The Open method takes 16 parameters. Take a look at the MSDN[^] page for this.
您好,
尝试检查以下链接:
http://omegacoder.com/?p=555 [ ^ ]
问候
Robert
Hi,
try to check following link:
http://omegacoder.com/?p=555[^]
Regards
Robert
这篇关于使用c#读取word文件时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文