PB 匯出的Excel,開啟會提示檔案格式和副檔名不匹配問題
阿新 • • 發佈:2021-01-01
技術標籤:PowerBuilderexcelpb
問題: PB使用saveasascii 匯出Excel檔案,開啟Excel檔案時候提示下圖資訊:
解決方案:
在使用saveasascii後,使用下面程式碼即可||
//ls_docname 檔案路徑
OLEObject excel
excel = CREATE OLEObject
if excel.ConnectToObject(ls_docname) = 0 then
excel.application.DisplayAlerts = FALSE
excel.application.workbooks(1).Parent.Windows (excel.application.workbooks(1).Name).Visible = True
excel.application.Visible = false
excel.application.workbooks(1).saveas(ls_docname, 39)
excel.application.workbooks(1).close()
end if
DESTROY excel