我已经开发了一个安装了Office 2010 Professional的VB.Net(VS2010)的WinForm应用程序,它是64位Windows 7平台.该程序打开.doc和.rtf格式文档,并尝试以htm格式保存它.我正在使用以下命令:
Dim sFilePath as String ="C:\ ABC\file.doc"
Dim oApp As New Microsoft.Office.Interop.Word.Application
Dim oDoc As New Microsoft.Office.Interop.Word.Document
Dim sTempFileName As String = System.IO.Path.GetTempFileName()
oDoc = oApp.Documents.Open(sFilePath)
oApp.Visible = False
oDoc = oApp.ActiveDocument
oDoc.SaveAs2(sTempFileName, FileFormat:=WdSaveFormat.wdFormatHTML,CompatibilityMode:=Microsoft.Office.Interop.Word.WdCompatibilityMode.wdWord2007)
oDoc.Close()
oApp.Quit()
oDoc = Nothing
oApp = Nothing
Run Code Online (Sandbox Code Playgroud)
开发和运行在开发PC上一切顺利,但是当我将其发布用于离线安装,并将其部署在具有带Office 2007的Windows XP的客户端PC上时,它会在oDoc.SaveAs2行上出错,并且程序崩溃.我已经google了足够但无法找到解决方案.有人请尽快帮助我