1. ma jack
  2. PowerBuilder
  3. Saturday, 14 October 2023 12:36 PM UTC

Hello everyone
I use the saveas method such as dw_1.saveas("test.xlsx",xlsx!,true) to save datawindow into an excel file. The font of all cells in the excel file is Arial and the size is 10.

I try to modify the column font and size in datawindow , but the excel file has no change. Is it possible to specify the font of the exported excel without using OLE?

 
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Saturday, 14 October 2023 12:54 PM UTC
  2. PowerBuilder
  3. # 1

Hi Ma;

  The SaveAs() method only exports the data from the DWO's "primary" buffer where no formatting is being done. It's just "raw" datum & thus, what Excel gets (aka "as is").

  If you want to preserve the formatting that you see in the DWO's visual layer, you have two choices: A) use OLE to transfer the data to Excel & control the formatting or B) use a 3rd party product like "DW2XLS" to transfer the formatted DWO datum to Excel.  HTH

Regards .... Chris 

Comment
  1. ma jack
  2. Sunday, 15 October 2023 07:40 AM UTC
Thank you, Chris

I implemented the requirement using the following pseudocode



lihdl=lole.ConnectToNewObject("Excel.application")

lole.xxx.xxx.open("excel file.xlsx")

lole.xxx.xxx.font.name="xxx"

lole.xxx.xxx.save()

lole.xxx.xxx.close()

lole.quit()

destroy lole



but the processing time is 2-3 seconds longer than using saveas. Can I just accept this fact without using "DW2XLS"?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Sunday, 15 October 2023 12:50 PM UTC
Yes, OLE processing will be slower because your calling a "remote" server on every call vs a local DLL where the calling overhead is minimal (compared to OLE).
  1. Helpful
  1. ma jack
  2. Sunday, 15 October 2023 15:17 PM UTC
ok, thank you, thank you for your explanation :)
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.