mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 11:06:15 +08:00
Fix issue #332 strlen used directly in expression should not be used to keep support for AS ABAP < 7.02
Additional fix for #331
This commit is contained in:
parent
8e8dd7145d
commit
ae56d3749b
|
@ -2917,6 +2917,7 @@ METHOD calculate_cell_width.
|
||||||
ld_font_height TYPE tdfontsize VALUE lc_default_font_height,
|
ld_font_height TYPE tdfontsize VALUE lc_default_font_height,
|
||||||
lt_itcfc TYPE STANDARD TABLE OF itcfc,
|
lt_itcfc TYPE STANDARD TABLE OF itcfc,
|
||||||
ld_offset TYPE i,
|
ld_offset TYPE i,
|
||||||
|
ld_length TYPE i,
|
||||||
ld_uccp TYPE i,
|
ld_uccp TYPE i,
|
||||||
ls_font_metric TYPE mty_s_font_metric,
|
ls_font_metric TYPE mty_s_font_metric,
|
||||||
ld_width_from_font_metrics TYPE i,
|
ld_width_from_font_metrics TYPE i,
|
||||||
|
@ -3006,7 +3007,7 @@ METHOD calculate_cell_width.
|
||||||
ld_flag_italic = ls_stylemapping-complete_style-font-italic.
|
ld_flag_italic = ls_stylemapping-complete_style-font-italic.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
CATCH zcx_excel. "#EC NO_HANDLER
|
CATCH zcx_excel. "#EC NO_HANDLER
|
||||||
" Style GUID is present, but style was not found
|
" Style GUID is present, but style was not found
|
||||||
" Continue with default values
|
" Continue with default values
|
||||||
|
|
||||||
|
@ -3086,8 +3087,9 @@ METHOD calculate_cell_width.
|
||||||
IF lines( <ls_font_cache>-th_font_metrics ) = 0.
|
IF lines( <ls_font_cache>-th_font_metrics ) = 0.
|
||||||
" Font metrics are not available
|
" Font metrics are not available
|
||||||
" -> Calculate the cell width using only the font size
|
" -> Calculate the cell width using only the font size
|
||||||
|
ld_length = strlen( ld_cell_value ).
|
||||||
ep_width =
|
ep_width =
|
||||||
strlen( ld_cell_value ) * ld_font_height / lc_default_font_height
|
ld_length * ld_font_height / lc_default_font_height
|
||||||
+ lc_excel_cell_padding.
|
+ lc_excel_cell_padding.
|
||||||
|
|
||||||
ELSE.
|
ELSE.
|
||||||
|
@ -3095,7 +3097,8 @@ METHOD calculate_cell_width.
|
||||||
|
|
||||||
" Calculate the size of the text by adding the sizes of each
|
" Calculate the size of the text by adding the sizes of each
|
||||||
" letter
|
" letter
|
||||||
DO strlen( ld_cell_value ) TIMES.
|
ld_length = strlen( ld_cell_value ).
|
||||||
|
DO ld_length TIMES.
|
||||||
" Subtract 1, because the first character is at offset 0
|
" Subtract 1, because the first character is at offset 0
|
||||||
ld_offset = sy-index - 1.
|
ld_offset = sy-index - 1.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user