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

Fix 761 cell value " x0041 " rendered as "a" #762

Conversation

sandraros
Copy link
Collaborator

These lines are added to the method SET_CELL of ZCL_EXCEL_WORKSHEET:
IF lv_value CS 'x'.
" Issue #761 value "x0041" rendered as "A".
" "x....", where "." is 0-9 a-f or A-F (case insensitive), is an internal value in sharedStrings.xml
" that Excel uses to store special characters, it's interpreted like Unicode character U+....
" for instance "x0041" is U+0041 which is "A".
" To not interpret such text, the first underscore is replaced with "x005f".
" The value "x0041" is to be stored internally "x005f_x0041" so that it's rendered like "x0041".
" Note that REGEX is time consuming, it's why "CS" is used above to improve the performance.
REPLACE ALL OCCURRENCES OF REGEX '
(x[0-9a-fA-F]{4}_)' IN lv_value WITH 'x005f$1' RESPECTING CASE.
ENDIF.

sandraros and others added 8 commits February 11, 2021 21:14
Pull latest abap2xlsx changes
AUnit warning zcl excel reader huge file "# au  > "#au abap2xlsx#739 (abap2xlsx#742)
Synchronize latest changes from master sapmentors/abap2xlsx
These lines are added to method SET_CELL of ZCL_EXCEL_WORKSHEET:
    IF lv_value CS '_x'.
      " Issue abap2xlsx#761 value "_x0041_" rendered as "A".
      " "_x...._", where "." is 0-9 a-f or A-F (case insensitive), is an internal value in sharedStrings.xml
      " that Excel uses to store special characters, it's interpreted like Unicode character U+....
      " for instance "_x0041_" is U+0041 which is "A".
      " To not interpret such text, the first underscore is replaced with "_x005f_".
      " The value "_x0041_" is to be stored internally "_x005f_x0041_" so that it's rendered like "_x0041_".
      " Note that REGEX is time consuming, it's why "CS" is used above to improve the performance.
      REPLACE ALL OCCURRENCES OF REGEX '_(x[0-9a-fA-F]{4}_)' IN lv_value WITH '_x005f_$1' RESPECTING CASE.
    ENDIF.
@gregorwolf gregorwolf merged commit f4312eb into abap2xlsx:master Jun 21, 2021
@sandraros sandraros deleted the Fix-761-cell-value-"_x0041_"-rendered-as-"A" branch September 21, 2021 18:25
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

Successfully merging this pull request may close these issues.

None yet

2 participants