1. Catherine Canete
  2. PowerBuilder
  3. Friday, 20 October 2023 17:17 PM UTC

Does anyone know how i can make the datawindow saveas functionality creates the excel file with the Program Name populated with Microsoft Excel? 

I'm saving my dw data to excel file and wants to use Syncfusion to open and manipulate the file as needed, but Syncfusion is failing to open it because the "Program Name" attribute is not populated.  I tested these files and confirmed that the only difference between the two is the Program Name missing from the dw save as generated file.

i did some research if there is an easy way to change the file properties and found out that i have to use DSOFILE.DLL to do it.   I'm trying to avoid adding another dll to our app thus asking this question if anyone knows any PB function, config change or setup that might help or any other to do it without adding another DLL.

thanks,

Cathy 

Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 26 October 2023 14:29 PM UTC
  2. PowerBuilder
  3. # 1

Hi Cathy,

It would appear from my testing this is a field that only MS Office can populate, though I haven't been able to definitively confirm this anywhere on-line...and which version of PB you're using seems to be irrelevant. Appeon may be able to confirm or refute this generally but also in conjunction with the library they use to create the Excel file via SaveAs() but I wouldn't be surprised if they can't modify it either. It took a bit to catch on to this because usually I either 1) create the Excel file using OLE or 2) most if not all of my SaveAs() calls are then followed by accessing the file via OLE due to the current limitations of the SaveAs() function...so my Excel files always had that property populated.

A workaround, and maybe simpler than what you're currently doing, is once the file is created, open the file via OLE and simply call the Save function and then this field will be populated. No changes are required to be made once you open the file, just the fact that you saved it via OLE is all that's needed.

I was going to update the ticket with these comments but, and correct me if I'm wrong, it appears the ticket you created is private?!

HTH...regards,

Mark

Comment
  1. Mark Goldsmith
  2. Thursday, 26 October 2023 19:28 PM UTC
Understood...and the Program name information is stored in the docProps folder in a file called app.xml under the Application tag...the question is how best to update it programmatically (preferably by Appeon). Then again, regardless of what library is used to create the file, should that property really say Microsoft Excel if in fact Office was not used to create/ modify the file? It's just unfortunate that Syncfusion needs to have that property populated with Microsoft Excel in order to work with the file.
  1. Helpful 1
  1. Catherine Canete
  2. Friday, 27 October 2023 16:51 PM UTC
Hi all, just to update you Appeon got back to me about this and they submitted this as candidate for future enhancement.



I'm also good at my end. Appreciate all your responses.



Best regards,

Cathy
  1. Helpful
  1. Mark Goldsmith
  2. Friday, 27 October 2023 17:55 PM UTC
You're welcome Cathy and thanks for the update.

Regards...Mark
  1. Helpful
There are no comments made yet.
Catherine Canete Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 15:52 PM UTC
  2. PowerBuilder
  3. # 2

Submitted Bug 11064.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 15:27 PM UTC
  2. PowerBuilder
  3. # 3

Please submit a bug report requesting that this property be set.

Comment
There are no comments made yet.
Catherine Canete Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 15:13 PM UTC
  2. PowerBuilder
  3. # 4

hi Mark,

I'm on PB 2022 R2 and thought the same thing that it could be a bug for this version but can't validate since i don't have lower PB versions on my machine.

The syntax is a straight forward dw.SaveAs().

thanks,

Cathy

Comment
  1. Mark Goldsmith
  2. Monday, 23 October 2023 15:37 PM UTC
Thanks Cathy for the additional info. When I get a chance I'm going to do some testing with that version but per Roland's response, you may wish to submit a bug: https://www.appeon.com/standardsupport/newbug
  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 15:07 PM UTC
  2. PowerBuilder
  3. # 5

Hi Cathy,

I understand you set this as resolved and I'm glad you found a work-around, but I'm curious as to what version of PB you are using and the specific code you use when executing the SaveAs function. The reason I ask is because as I understand it, the Program name property is an automatically updated property. While John's suggestion was a good idea, this property is not one of the ones that is modifiable via the BuiltinDocumentProperties collection via OLE, as it would be with, for example, the Comments property. The Program name property should be auto populated upon executing dw.SaveAs() and so I'm wondering if this is a bug depending on the version of PB you are using and/ or how it's coded.  Thanks.

Regards,

Mark

Comment
There are no comments made yet.
Catherine Canete Accepted Answer Pending Moderation
  1. Saturday, 21 October 2023 00:15 AM UTC
  2. PowerBuilder
  3. # 6

Thanks John for your response! 

I found a work around.  So instead of dw saveas excel, i'm saving it now as csv so syncfusion can open it, then i can manipulate the data in syncfusion (ole using Syncfusion.ExcelWrapper) then from syncfusion save it asexcel.   End user save as excel, they will still get excel file at the end of processing.

Regards,

Cathy

 

 

    

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 20 October 2023 18:58 PM UTC
  2. PowerBuilder
  3. # 7

Hi, Cathy -

This is purely a guess on my part, but it would appear you might be able to set this via the PB OLEObject object and by navigating through the Excel object model:

    https://learn.microsoft.com/en-us/office/vba/api/overview/excel/object-model

I'm not familiar with this "Program Name" property, so I'm unsure if this is a built-in property (my slightly older version of Excel does not display it) or if it is instead a custom property.

I've also never delved into this area, but it appears that the object model hierarchy may be something like this:

Application -> Workbook -> BuiltinDocumentProperties (a collection) -> DocumentProperty
  or
Application -> Workbook -> CustomDocumentProperties (a collection) -> DocumentProperty

You may wish to experiment and see if you can navigate through the Excel object model using PB OLEObject variables to see if you can first find the Program Name property. Once you can find it, you should be able to subsequently set its value. This will have to be done after the .xlsx file have been created, of course.

Best regards, John

Comment
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.