Export/Converting DataWindow To Excel File With HTMLTable In PowerBuilder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// ... Init docname // ... GetFileOpenName or any other method // save datawindow to html to document html If dw_1.SaveAs(docname, HTMLTable!, True) = -1 Then MessageBox("Warning", "Unable to export data. Error writing to file!", 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() Else MessageBox("Warning", "Connect Excel Application Error!", Exclamation!) Destroy excel Return End If Destroy excel |
Good Luck!
Subscribe
Login
0 Comments