Merge branch 'main' into patch-load-workbook-rework

This commit is contained in:
Domi Bigl 2024-08-31 08:38:14 +02:00 committed by GitHub
commit f400b8cdd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 19 deletions

View File

@ -1304,6 +1304,8 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
ld_flag_italic TYPE abap_bool VALUE abap_false, ld_flag_italic TYPE abap_bool VALUE abap_false,
ld_date TYPE d, ld_date TYPE d,
ld_date_char TYPE c LENGTH 50, ld_date_char TYPE c LENGTH 50,
ld_time TYPE t,
ld_time_char TYPE c LENGTH 20,
ld_font_height TYPE zcl_excel_font=>ty_font_height VALUE zcl_excel_font=>lc_default_font_height, ld_font_height TYPE zcl_excel_font=>ty_font_height VALUE zcl_excel_font=>lc_default_font_height,
ld_font_name TYPE zexcel_style_font_name VALUE zcl_excel_font=>lc_default_font_name. ld_font_name TYPE zexcel_style_font_name VALUE zcl_excel_font=>lc_default_font_name.
@ -1349,20 +1351,27 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
" If the current cell contains the default date format, " If the current cell contains the default date format,
" convert the cell value to a date and calculate its length " convert the cell value to a date and calculate its length
IF ls_stylemapping-complete_style-number_format-format_code = CASE ls_stylemapping-complete_style-number_format-format_code.
zcl_excel_style_number_format=>c_format_date_std. WHEN zcl_excel_style_number_format=>c_format_date_std.
" Convert excel date to ABAP date " Convert excel date to ABAP date
ld_date = ld_date =
zcl_excel_common=>excel_string_to_date( ld_cell_value ). zcl_excel_common=>excel_string_to_date( ld_cell_value ).
" Format ABAP date using user's formatting settings " Format ABAP date using user's formatting settings
WRITE ld_date TO ld_date_char. WRITE ld_date TO ld_date_char.
" Remember the formatted date to calculate the cell size " Remember the formatted date to calculate the cell size
ld_cell_value = ld_date_char. ld_cell_value = ld_date_char.
WHEN get_default_excel_time_format( ).
ld_time = zcl_excel_common=>excel_string_to_time( ld_cell_value ).
WRITE ld_time TO ld_time_char.
ld_cell_value = ld_time_char.
ENDCASE.
ENDIF.
" Read the font size and convert it to the font height " Read the font size and convert it to the font height
" used by SAPscript (multiplication by 10) " used by SAPscript (multiplication by 10)
@ -4474,7 +4483,7 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
METHOD set_table. METHOD set_table.
DATA: lo_structdescr TYPE REF TO cl_abap_structdescr, DATA: lo_structdescr TYPE REF TO cl_abap_structdescr,
lr_data TYPE REF TO data, lr_data TYPE REF TO data,
lt_dfies TYPE ddfields, lt_dfies TYPE ddfields,
lv_row_int TYPE zexcel_cell_row, lv_row_int TYPE zexcel_cell_row,

View File

@ -1234,13 +1234,15 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
CHECK iv_cell_style IS NOT INITIAL. CHECK iv_cell_style IS NOT INITIAL.
"Don't insert guid twice or even more
READ TABLE me->styles_cond_mapping TRANSPORTING NO FIELDS WITH KEY guid = iv_cell_style.
CHECK sy-subrc NE 0.
READ TABLE me->styles_mapping INTO ls_styles_mapping WITH KEY guid = iv_cell_style. READ TABLE me->styles_mapping INTO ls_styles_mapping WITH KEY guid = iv_cell_style.
ADD 1 TO ls_styles_mapping-style. " the numbering starts from 0
READ TABLE it_cellxfs INTO ls_cellxfs INDEX ls_styles_mapping-style.
ADD 1 TO ls_cellxfs-fillid. " the numbering starts from 0
READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style. READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style.
IF sy-subrc EQ 0. IF sy-subrc EQ 0.
"The content of this style is equal to an existing one. Share its dxfid.
ls_style_cond_mapping-guid = iv_cell_style. ls_style_cond_mapping-guid = iv_cell_style.
APPEND ls_style_cond_mapping TO me->styles_cond_mapping. APPEND ls_style_cond_mapping TO me->styles_cond_mapping.
ELSE. ELSE.
@ -1254,6 +1256,9 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lo_sub_element = io_ixml_document->create_simple_element( name = lc_xml_node_dxf lo_sub_element = io_ixml_document->create_simple_element( name = lc_xml_node_dxf
parent = io_ixml_document ). parent = io_ixml_document ).
lv_index = ls_styles_mapping-style + 1.
READ TABLE it_cellxfs INTO ls_cellxfs INDEX lv_index.
"Conditional formatting font style correction by Alessandro Iannacci START "Conditional formatting font style correction by Alessandro Iannacci START
lv_index = ls_cellxfs-fontid + 1. lv_index = ls_cellxfs-fontid + 1.
READ TABLE it_fonts INTO ls_font INDEX lv_index. READ TABLE it_fonts INTO ls_font INDEX lv_index.
@ -1293,7 +1298,8 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
"---Conditional formatting font style correction by Alessandro Iannacci END "---Conditional formatting font style correction by Alessandro Iannacci END
READ TABLE it_fills INTO ls_fill INDEX ls_cellxfs-fillid. lv_index = ls_cellxfs-fillid + 1.
READ TABLE it_fills INTO ls_fill INDEX lv_index.
IF ls_fill IS NOT INITIAL. IF ls_fill IS NOT INITIAL.
" fill properties " fill properties
lo_element_fill = io_ixml_document->create_simple_element( name = lc_xml_node_fill lo_element_fill = io_ixml_document->create_simple_element( name = lc_xml_node_fill
@ -1329,9 +1335,9 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lo_sub_element->append_child( new_child = lo_element_fill ). lo_sub_element->append_child( new_child = lo_element_fill ).
ENDIF. ENDIF.
ENDIF.
io_dxf_element->append_child( new_child = lo_sub_element ). io_dxf_element->append_child( new_child = lo_sub_element ).
ENDIF.
ENDMETHOD. ENDMETHOD.
@ -5401,6 +5407,17 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
cv_dfx_count = lv_dfx_count ). cv_dfx_count = lv_dfx_count ).
* begin of change issue #366 - missing conditional rules: top10, move dfx-styles to own method * begin of change issue #366 - missing conditional rules: top10, move dfx-styles to own method
WHEN zcl_excel_style_cond=>c_rule_textfunction.
me->create_dxf_style( EXPORTING
iv_cell_style = lo_style_cond->mode_textfunction-cell_style
io_dxf_element = lo_element
io_ixml_document = lo_document
it_cellxfs = lt_cellxfs
it_fonts = lt_fonts
it_fills = lt_fills
CHANGING
cv_dfx_count = lv_dfx_count ).
WHEN OTHERS. WHEN OTHERS.
CONTINUE. CONTINUE.
ENDCASE. ENDCASE.

View File

@ -1171,7 +1171,7 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION.
*--------------------------------------------------------------------------------------* *--------------------------------------------------------------------------------------*
WHEN zcl_excel_style_cond=>c_rule_textfunction. WHEN zcl_excel_style_cond=>c_rule_textfunction.
ls_textfunction = lo_style_cond->mode_textfunction. ls_textfunction = lo_style_cond->mode_textfunction.
READ TABLE o_excel_ref->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_cellis-cell_style. READ TABLE o_excel_ref->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_textfunction-cell_style.
lv_value = ls_style_cond_mapping-dxf. lv_value = ls_style_cond_mapping-dxf.
CONDENSE lv_value. CONDENSE lv_value.
lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid

View File

@ -40,7 +40,7 @@
</DD03P> </DD03P>
<DD03P> <DD03P>
<FIELDNAME>GRADTYPE</FIELDNAME> <FIELDNAME>GRADTYPE</FIELDNAME>
<ROLLNAME>ZEXCEL_S_CSTYLEX_GRADTYPE</ROLLNAME> <ROLLNAME>ZEXCEL_S_GRADIENT_TYPE</ROLLNAME>
<ADMINFIELD>0</ADMINFIELD> <ADMINFIELD>0</ADMINFIELD>
<DATATYPE>STRU</DATATYPE> <DATATYPE>STRU</DATATYPE>
<MASK> STRUS</MASK> <MASK> STRUS</MASK>