Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Export composite datawindow to excel

Hi All,

(Powerbuilder 12.5 classic)

I have problem to export composite datawindow to excel, where it always results an 'a' in the A1 cell of Excel as below:

Save as function used = dw_1.saveas("excelreport.xlsx",XLSX! ,true)

- This save as function is working fine it there is only one datawindow to export to excel, example: export a tabular datawindow.


I tried dw_1.saveas("excelreport.xlsx",HTMLTable! ,true) also, but still not working.


Kindly advise.

Thank you.


Regards,

Yow

replied

Hi Yow;

  The SaveAs ( ) method only works on the immediate parent DW Object within the DW Control. Since a composite DW has many child DWO's inside it, your SaveAs command is not addressing the children.

  Currently, this is the limitation of the SaveAs command for either a Nested or Composite DW. You do have a few other options ...

1) Create a Tabular or Grid DW that houses all the columns that you would like the Excel spreadsheet to see. Then populate this DW inside a hidden DataStore separately when the user requests an export of the composite DW to Excel.

2) You can access a composite DW's entire data buffers by using the DW "DOT" notation. You would have to code something like this or each child DW in the composite DW ....

  Any  la_data[]

  ls_data =  DC.Object.<ChildDW>.Object.Data

  Once you have extracted all the child DWO's data - you could then export it to Excel using the procedure stated in #1 or using OLE interaction with Excel. Either way, definitely some significant coding work on your part.

Regards ... Chris

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question