Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect date format in excel sheets 2 & 3 from ZDEMO_EXCEL24 (SAP_BASIS 756)? #1179

Open
Jimboken opened this issue Jan 22, 2024 · 4 comments

Comments

@Jimboken
Copy link

Jimboken commented Jan 22, 2024

When running ZDEMO_EXCEL24 in a 7.56 system, worksheets number 2 and 3 should have the date format YYYYMMDD and YYYY/MM/DD respectively I think.

However when I execute this program the date format is excel's default DD/MM/YYYY. I have also downloaded the excel file from SMW0 and that has the same issue.

Have I interpreted the demo purpose incorrectly?

Reference lines in ZDEMO_EXCEL24: https://github.com/abap2xlsx/demos/blob/d3b82106f41cf5bd04a8967d62ab33585e96ccd7/src/zdemo_excel24.prog.abap#L51-L72

@sandraros
Copy link
Collaborator

I guess you must be right. Let me check why it doesn't work anymore. It will probably take me a few days...

@darnoc312
Copy link
Contributor

Hello,

currently the worksheet methods get_default_excel_date_format and get_default_excel_time_format for example are used in zcl_excel_converter->set_cell_format but not in zcl_excel_worksheet->set_cell (lines 4058 and 4073 in current zcl_excel_worksheet's source code.

@Jimboken
Copy link
Author

Thank you @darnoc312. Getting the default date/time prior to testing the style formats worked a treat.

@sandraros
Copy link
Collaborator

sandraros commented Feb 14, 2024

The calls to get_default_excel_date_format and get_default_excel_time_format were removed from zcl_excel_worksheet more than 7 years ago, and I guess zdemo_excel24 was not adapted.

I'm a little disappointed that set_default_excel_date_format and set_default_excel_time_format exist in zcl_excel_worksheet but are not used by zcl_excel_worksheet.

One possible fix could be to add a new parameter to set_cell to consider the default date and time formats, or a new parameter to both set methods to make them being considered by set_cell, I have a preference for the latter although it sounds really stupid, but the most important thing is to keep ascending compatibility. And of course, zdemo_excel24 will have to be fixed.

Any opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants