1. ma jack
  2. PowerBuilder
  3. Friday, 15 September 2023 09:31 AM UTC

Hello everyone


I saved the data window as an excel file. The name of the excel file is displayed normally, but the sheet name is garble code.
this is my code
dw_1.saveas("D:\test\作成.xls",excel8!,true)


If I use ascii characters as the file name, the sheet name is normal, such as
dw_1.saveas("D:\test\wb.xls",excel8!,true)

The PB version I am using is 2019R3 2781, and the office version is professional plus 2019.
Please tell me how should I solve this problem? Do I need to upgrade the version of office?

Attachments (1)
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 19 September 2023 00:25 AM UTC
  2. PowerBuilder
  3. # 1

Hi Ma Jack,

I reproduced this issue and PB 12.6 has the same behavior. I will transfer this for the developer to analyze

Regards,
Kai

Comment
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Sunday, 17 September 2023 15:55 PM UTC
  2. PowerBuilder
  3. # 2

Hello Ma Jack,

Like Miguel, I too tested your app that you provided as well as tried a number of other languages and have been able to duplicate the problem. It appears that using a filename with any characters beyond the extended ASCII code set will have the same problem. As you've stated, the issue isn't with the filename, however whatever filename you choose ends up being used for the sheet name as well and therein lies the problem.

Not sure how Appeon saves a Excel8! file behind the scenes but maybe there is something they can do given this is still a supported version of Excel that SaveAs() can use. Hopefully you'll have a response to your submission soon or maybe they'll respond to your post.

Since you stated your users need the file in this format, as a workaround, you could save the file in XLSX! format and then, via OLE, open the file and save it as an XLS file and then delete the XLSX file. While I haven't tried it, this should work programmatically as it works doing it manually, meaning that the format of an XLS file can work with multi-byte characters in the sheet name.

HTH...regards,

Mark

Comment
  1. Mark Goldsmith
  2. Sunday, 17 September 2023 17:35 PM UTC
Aah yes, just saw your follow-up comment. You may be right Miguel, that may be a simpler way to go especially if the name of the sheet is not important.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 18 September 2023 02:44 AM UTC
Yes, you are right, the sheet name might have to be changed also. (using OLE, if it would work).

The best option is probably what you suggested in that case or for Appeon to resolve the issue.

regards
  1. Helpful
  1. ma jack
  2. Wednesday, 20 September 2023 07:41 AM UTC
I asked the developer of another system and he asked me to keep the sheet name and file name consistent. Maybe only ole can save me, haha...
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 16 September 2023 19:25 PM UTC
  2. PowerBuilder
  3. # 3

Dear Ma Jack,

I think I now finally understand the problem.

Me, I'm using office 365 and when I try to open the xls file, I get:

When I answer "Yes", I get:

So I've done some tests:

dw_1.saveas("作成 excel8.xls", excel8!,true) // BAD
dw_1.saveas("作成 Excel5.xls", Excel5!,true) // BAD
dw_1.saveas("作成 Excel.xls", Excel!,true) // it works, but you'll need to adjust office's Trust Center settings
dw_1.saveas("作成 XLSX.xlsx", XLSX!,true) // it works, but Office thinks it's a "file from the internet" and you'll need to adjust office's Trust Center settings

messagebox("","completed")

So you are right: this is a bug either in Powerbuilder or Office itself. (or both).

In addition, the PB help says this:

Obsolete values

The following SaveAsType values are considered to be obsolete and will be removed in a future release: Excel!, WK1!, WKS!, SYLK!, dBase2!, WMF!. Use Excel8!, XLSB!, or XLSX! for current versions of Microsoft Excel!, and EMF! in place of WMF!.

It doesn't mention Excel5!, but let's assume that one will also disappear in the future and doesn't solve your problem anyway giving a bad result.

I've done the same test with PB2022 R2, and get the same results.

So you have to get some kind of workaround for this.

I think you should report this as a bug on https://www.appeon.com/standardsupport/newbug

regards,

MiguelL

Comment
  1. Miguel Leeuwe
  2. Saturday, 16 September 2023 19:44 PM UTC
I think that Excel8! is office 97 ?

I'm pretty sure that all later office versions are capable of opening any excel 97 file, so most likely this is a powerbuilder bug, but not completely sure.

I would say that you best step forward, is to use Excel! - instead of Excel8! - and see if meanwhile Appeon will resolve the problem once you have reported this as a bug. (before they stop supporting "Excel!" )

  1. Helpful
  1. ma jack
  2. Sunday, 17 September 2023 14:10 PM UTC
Awesome! Thank you so much, I have submitted this issue to appeon and have to use excel! for now, thanks again
  1. Helpful
  1. Miguel Leeuwe
  2. Sunday, 17 September 2023 16:33 PM UTC
Maybe a more lasting workaround for the future would be, as another workaround:

`1. Save the file as Excel8! using a temporary Ascii filename.

2. After that, rename the file to the real filename that you need / want. You can use the FileMove() function for that.

regards.
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 16 September 2023 11:49 AM UTC
  2. PowerBuilder
  3. # 4

I've run your sample app and I'm getting the exact same filename as specified in your code:

Your sample app doesn't use ""GetFileOpenName! so hard to reproduce the problem. 

Comment
  1. ma jack
  2. Saturday, 16 September 2023 12:55 PM UTC
Thank you very much for testing this problem.

The name of the excel file will not be garbled. After opening the excel file, the name of the sheet inside will be garbled. This will happen regardless of whether "GetFileOpenName" is used or not.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 15 September 2023 13:45 PM UTC
  2. PowerBuilder
  3. # 5

Hi,

I don't really understand. Your "garble" file name is hard coded ... so already "garbled" by yourself ?

What do you mean "If I use half width characters" ?

Can you create a very simple and small application to showcase the problem to us?

(also: really ? exporting as excel8! ?, why not use xlsx! ?)

regards

Comment
  1. Miguel Leeuwe
  2. Friday, 15 September 2023 16:47 PM UTC
ah okay, 2019 R3
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 16 September 2023 12:12 PM UTC
See my last answer: your sample app also uses a hardcoded filename.

bye
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 16 September 2023 12:40 PM UTC
Your sample app doesn't use ""GetFileOpenName! so hard to reproduce the problem.
  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.
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.