
DW2XLS para PowerBuilder 2021
Publicado por Erick (22 intervenciones) el 07/03/2025 21:55:18
Buen dia, alguien tendra la libreria DW2XLS para powerbuilder 2021? o algun otra forma de exportar a excel?
Valora esta pregunta


0
Long ll_cols, ll_rows, ll_i, ll_j
String ls_range, ls_col, ls_head
String ls_cols[] ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL'}
OLEObject ole_excel, ole_sheet
Integer li_i, li_j
ll_cols = Long(dw_reporte.Object.DataWindow.Column.Count)
ll_rows = dw_reporte.RowCount()
ole_excel = Create OLEObject
ole_sheet = Create OLEObject
if ole_excel.ConnectToNewObject("Excel.Sheet") < 0 then
MessageBox("Error","No fué posible abrir la aplicación Excel",StopSign!)
Return
end if
ole_excel.Application.DisplayAlerts = False
ole_excel.Application.Visible = True
ole_sheet = ole_excel.Application.ActiveWorkBook.WorkSheets[1]
li_j = 0
for ll_i = 1 to ll_cols
if Integer(dw_reporte.Describe("#"+string(ll_i) + ".visible")) = 1 then
li_j++
ls_head = dw_reporte.Describe("#"+string(ll_i) + ".name")
li_i = num_entries(ls_head,'_')
ls_head = entry(ls_head,li_i,'_')
ls_head = WordCap(ls_head)
ole_sheet.cells[1,li_j] = ls_head
end if
next
ls_col = ls_cols[li_j]
ls_range = "A1:"+ls_col+"1"
ole_sheet.range(ls_range).Select
ole_sheet.range(ls_range).Cells.Borders.LineStyle = 1
ole_sheet.range(ls_range).Cells.Borders.Weight = 3
ole_sheet.range(ls_range).Interior.Pattern = 1
ole_sheet.range(ls_range).Interior.PatternColorIndex = -4105
ole_sheet.range(ls_range).Interior.ThemeColor = 10
ole_sheet.range(ls_range).Interior.TintAndShade = 0.599993896298105
ole_sheet.range(ls_range).Interior.PatternTintAndShade = 0
For ll_i = 1 to ll_rows
li_j = 0
For ll_j = 1 to ll_cols
if Integer(dw_reporte.Describe("#"+string(ll_j) + ".visible")) = 1 then
li_j++
ole_sheet.cells[ll_i+1,li_j] = dw_reporte.object.data[ll_i,ll_j]
end if
Next
Next
ole_sheet.range("A:"+ls_col).EntireColumn.AutoFit
ll_rows++
ls_range = "A2:"+ls_col+String(ll_rows)
ole_sheet.range(ls_range).Select
ole_sheet.range(ls_range).Cells.Borders.LineStyle = 1
ole_sheet.range("A2:A2").Select
ole_excel.DisConnectObject()
Destroy ole_excel
Destroy ole_sheet