Page 1 of 1
Corrupt xlsx file using non-english characters
Posted: Sat Nov 26, 2022 12:07 am
by johansamuelsson
When I use Swedish specific letters such as å,ä and ö, the excel file becomes corrupt. See examples
Code: Select all
WfCreate(page=u) u 1
' EXAMPLE 1
Table Table1
Table1(1,1) = "åäö"
Table1.save(t=xlsx) c:\temp\Table1.xlsx Range=Sheet1!a1
' EXAMPLE 2
Alpha Alpha1="åäö"
WfSave(type=excelxml, cellfmt=eviews) C:\Temp\Alpha1.xlsx @keep Alpha1
' EXAMPLE 3
Series Series1=1
Series1.Label(d) åäö
WfSave(type=excelxml, cellfmt=eviews, attr) C:\Temp\Series1.xlsx @keep Series1
' EXAMPLE 4 an 5 (this works, there seems not to be a legacy-option for table.save)
WfSave(type=excelxml, cellfmt=eviews, legacy) C:\Temp\Alpha2.xlsx @keep Alpha1
WfSave(type=excelxml, cellfmt=eviews, attr, legacy) C:\Temp\Series2.xlsx @keep Series1
Eviews 13 Nov 9 2022 build
Regards Johan
Re: Corrupt xlsx file using non-english characters
Posted: Mon Nov 28, 2022 8:50 am
by EViews Jason
We will investigate the new Excel writing engine. In the meantime use the 'legacy' option to revert back to the old engine when using wfsave.
Code: Select all
WfSave(type=excelxml, cellfmt=eviews,legacy) C:\Temp\Alpha1.xlsx @keep Alpha1
Writing to Excel files via Table.save however is new EViews 13 feature. The 'legacy' option is therefore currently not supported. We will look into adding it in a future patch.
Re: Corrupt xlsx file using non-english characters
Posted: Thu Dec 08, 2022 11:53 am
by EViews Jason
The ability to save xlsx files containing non-english characters using the new EViews 13 Excel writing engine will be fixed in the next patch.
Re: Corrupt xlsx file using non-english characters
Posted: Thu Dec 08, 2022 12:02 pm
by johansamuelsson
Wonderful news!
Re: Corrupt xlsx file using non-english characters
Posted: Wed Jan 08, 2025 4:17 am
by TomasThoren
Hi Forum,
picking up this thread since I still experince issues when writing to excelfiles with pagenames containing non-english characters.
Below I have two lines of code writing to excel via PageSave, one without non-english character in the pagename of the excel file and one with a "å" in the pagename. The latter not working (the excelfile becomes corrupt and is unrepairable).
This line works (pagename "Radata"):
Code: Select all
PageSave(t=excelxml,Mode=Update,noid) {%L_Sok_pro_lok}{%OmrKod}_inm_pro.xlsx Range=Radata_a!{%cell} byrow @keep {%data} @Smpl !L_Tid_Start !G_Tid_ProHor
This one doesn't (pagename "R
ådata"):
Code: Select all
PageSave(t=excelxml,Mode=Update,noid) {%L_Sok_pro_lok}{%OmrKod}_inm_pro.xlsx Range=Rådata_a!{%cell} byrow @keep {%data} @Smpl !L_Tid_Start !G_Tid_ProHor
I read that there was a patch coming to Eivews13 (from a reply 8th of December 2022), but I'm still experince this issue.
Kind regards
Tomas
I'm using Eviews14 Enterprise Edition - Oct 22 2024 build.
Re: Corrupt xlsx file using non-english characters
Posted: Wed Jan 08, 2025 11:28 am
by EViews Steve
Is your Windows Language setting set to Swedish? If not, try switching to that and try the pagesave cmd again.
Re: Corrupt xlsx file using non-english characters
Posted: Wed Feb 05, 2025 5:22 am
by TomasThoren
Hi Steve,
Thank you for your reply. Yes, the Windows Language setting is set to Swedish. So that doesn't seem to be the problem.
Kind regards
Tomas
Re: Corrupt xlsx file using non-english characters
Posted: Thu Oct 09, 2025 7:33 am
by henriksiverbo
Hi,
Picking up this thread again due to the issue with currupt xlsx-files still happening when writing to xlsx-files using pagesave. Judging from earlier posts, it seems the problem with non-english characters (like å,ä,ö) initially happened when writing any kind of information to Excel. The problem has since then been solved for contents with non-english characters. It remains a problem however to write to a worksheet if the sheet name contains non-english characters. The xlsx-file will then be treated as corrupt by Excel.
In my understanding what happens is as follows.
1. Using pagesave, if the Excel target sheet name contains a non-english character Eviews will not identify and encode this character correctly and therefore try to add a new worksheet to write the data to (since this is what happens if the target sheet does not exist).
2. When adding the new worksheet Eviews is replacing the non-english character by a character not allowed by Excel (⍰). When the xslx-file is then opened in Excel it is treated as corrupt.
3. If accessing the underlying xml-files the incorrectly encoded character ⍰ can be replaced by one that is allowed and the xlsx-file will then be restored (and containing the new worksheet Eviews added, with the data written to it).
In conclusion, the issue seems to be that the encoding of non-english characters in target sheet names is faulty, which I'm guessing the Eviews Team could fix in the same way it fixed writing non-english characters as part of worksheet contents.
Best regards,
Henrik
Eviews14 Enterprise Edition - Oct 22 2024 build
Re: Corrupt xlsx file using non-english characters
Posted: Thu Dec 18, 2025 4:19 am
by henriksiverbo
It would be useful to know if you are planning to address this issue in upcoming patches to Eviews 14?
Best regards,
Henrik
Re: Corrupt xlsx file using non-english characters
Posted: Thu Dec 18, 2025 8:53 am
by EViews Gareth
We haven't yet determined if a fix is possible, but we are looking in to it.