PowerBuilder資料視窗儲存為Excel表
_________________________________________________________________________________
能儲存幾乎所有內容
// ... Init docname
// ... GetFileOpenName or any other method
if dw_export.SaveAs(docname, HTMLTable!, True) = -1 then
MessageBox("警告!", "無法輸出資料.檔案寫入錯誤!",Exclamation!)
return
end if
// Convert HTML file to Excel native format
OLEObject excel
excel = CREATE OLEObject
if excel.ConnectToObject(docname) = 0 then
excel.application.DisplayAlerts = FALSE
excel.application.workbooks(1).Parent.Windows(excel.application.workbooks(1).Name).Visible = True
excel.application.workbooks(1).saveas(docname, 39)
excel.application.workbooks(1).close()
end if
DESTROY excel
// done