62,073
社区成员
发帖
与我相关
我的任务
分享
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Documents documents = word.Documents;
Type wordType = word.GetType();
Type docType = documents.GetType();
Microsoft.Office.Interop.Word.Document document = (Microsoft.Office.Interop.Word.Document)
docType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, (object)documents, new Object[] { fileName, true, true });
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
null, document, new object[] { toFile, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatEncodedText });//写入toFile,然后读取这个toFile时显示被占用,怎样释放?
wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);