【发布时间】:2016-01-25 21:29:45
【问题描述】:
Microsoft.Office.Interop.Word._Document mDocument = new Microsoft.Office.Interop.Word.Document();
*//This function will convert .doc to .docx
Public Function FileSave(ByVal fileName As String, ByVal openPWD As String, ByVal savePWD As String)
mDocument.SaveAs2(fileName, WdSaveFormat.wdFormatXMLDocument, , openPWD, , savePWD)
End Function*
上面的函数已经编写了使用 word interop 将 .doc 文件转换为 .docx。 文件创建成功,但打开时文件内容丢失。
缺少某些东西,或者是否有任何替代方法可以在 c# 或 Vb.net 中将 .doc 转换为 .docx
【问题讨论】:
-
Microsoft.Office.Interop.Word._Document mDocument = new Microsoft.Office.Interop.Word.Document();这一行创建了一个新文档,因为它是新创建的,所以它是空的。您需要打开自己的文件。
标签: c# ms-word office-interop vb.net-2010