Fix 761 cell value " x0041 " rendered as "a" #762
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.