How to Export Data to .XLSX Format Instead of .CSV ?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Albert
Posts: 16
Joined: Tue Dec 26, 2023 12:43 am

How to Export Data to .XLSX Format Instead of .CSV ?

Post by Albert »

Hello everyone,

Happy New Year ! :) :) :)

I'm currently facing an issue with exporting data to Microsoft Excel. When I use the option to send a list to MS-Excel, it downloads the file as a .CSV with a single line and semicolon separators. However, I need the list to be downloaded in the .XLS format with well-defined rows and columns.

Can anyone guide me on how to export a list directly to an .XLSX file instead of .CSV? Any advice or guidance would be greatly appreciated.

Thank you in advance for your help!
Attachments
Excel 1.PNG
Excel 1.PNG (14.37 KiB) Viewed 161726 times
Excel2.PNG
Excel2.PNG (11.78 KiB) Viewed 161726 times
Gilamonster
Posts: 11
Joined: Thu Nov 26, 2015 3:11 am
Location: France

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by Gilamonster »

Hi Albert,

You have to check the list separator defined in your Windows Regional Settings.
By example, if you want to open CSV files produced by VLF-One one a French OS you need to change the list separator proposed by default.

£uSystem.DefaultCSVSeparator := £MyCSVseparator /*Séparateur de colonnes */

Replace the MyCSVSeparator with the value you have in your regional settings.

Typically, you can add this line in a method routine in your Custom Manager component.
Then you can open CSV files with MS Excel with data well formated.

Regards
Albert
Posts: 16
Joined: Tue Dec 26, 2023 12:43 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by Albert »

Hello Gilamonster,

Yes, I'm already opening .CSV files, but the problem is with the format of the data. I changed the list separator from ';' to ','. However, the display of the data remains the same. Is there a way to download SQL filtered list data into an Excel .XLSX file?

Another point, please, how can I modify DF_T68H4O and run it from VLF after changing its name, since we know that the prefixes DF_ and UF_ need to be changed ?
Attachments
Excel_format.PNG
Excel_format.PNG (22.39 KiB) Viewed 161711 times
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by atostaine »

If your file has the extension .csv excel will open it properly if it's comma delimited. Is the extension .xslx?
Art Tostaine
Albert
Posts: 16
Joined: Tue Dec 26, 2023 12:43 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by Albert »

HELLO atostaine ,

Thanks for your feedback

I've successfully used Excel's "Text Import Wizard" to convert .CSV files into .XLS format, which works well for transformations.

But, can we download well-structured EXCEL .XLS files directly from VLF without going through the conversion from .CSV to .XLS?

Has anyone else tried using LANSA for this purpose?

Thanks!
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by atostaine »

I think you need integrator to do that.
Art Tostaine
Albert
Posts: 16
Joined: Tue Dec 26, 2023 12:43 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by Albert »

Hello atostaine,

OK,
Thank you,
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by René Houba »

Hi Albert,

You can use the LANSA Integrator Excel Service for this:
XLSX save.PNG
XLSX save.PNG (119.69 KiB) Viewed 161412 times
Gilamonster
Posts: 11
Joined: Thu Nov 26, 2015 3:11 am
Location: France

Re: How to Export Data to .XLSX Format Instead of .CSV ?

Post by Gilamonster »

Hi Albert,

In French, the decimal separator is a coma so you cannot not use a coma as list separator. It is why in your regional settings the defautl value for List separator is a semicolon (;). So, if you use in VLF-ONE the MS Excel export feature you need to replace the default CSV separator by a semicolon.
You just need to add a line of code £USYSTEM.DefaultCSVSeparator := ';' in your own version of UF_OSYSTM reusable part.

Code: Select all

* Initialization
Mthroutine Name(uInitialize) Options(*REDEFINE)

* Do any ancestor logic
£COM_ANCESTOR.uInitialize

* Do custom logic
£MaximumOpenFilterandHandlerPanes := 10
£MaxiumQuickSearchSize := 200
£SharedMessageSetinTabletMode := True /* Use a single shared message set in tablet mode */

£USYSTEM.DefaultCSVSeparator := ';' /* List separator CSV pour MS Excel en Français */

* Only allow a restart button on small or medium size devices
£AVFRAMEWORKMANAGER.avShowRestartButton := (£AVFRAMEWORKMANAGER.avLargeScreen.Not)

Endroutine

Then automatically the generated CSV file will be open like an Excel Spreedsheet. No need to use code to do a conversion CSV => XLS or LANSA Integrator service to do that, it is nativly proposed by VLF-ONE !

Regards
Post Reply