阅读.doc文件需要很长时间

时间:2015-07-22 08:49:03

标签: c# office-interop

我有这段代码来读取.doc文件(不是.docx)

 Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
 object miss = System.Reflection.Missing.Value;
 object path = FileToSave_path + FileNameToSave + ".doc";
 object readOnly = true;
 Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
 string totaltext = "";
 ExtractedHTML = docs.Content.Text;

但是读取文件的执行在这里挂起(超过10个小时)

  Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);

永远不会打开文件,永远不会抛出异常,我的文件大小是3Mb。我打开文件,它的字体有一些错误。如何打开(.doc)文件超时异常?或者解决这个问题。

0 个答案:

没有答案