Merge branch 'main' into fix-issue-1013-part2

This commit is contained in:
Domi Bigl 2024-09-13 12:11:18 +02:00 committed by GitHub
commit f7d7f53304
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 35 deletions

View File

@ -1698,7 +1698,8 @@ CLASS zcl_excel_converter IMPLEMENTATION.
* Let's check for filter. * Let's check for filter.
IF wo_autofilter IS BOUND. IF wo_autofilter IS BOUND.
ls_area-row_start = 1. ls_area-row_start = w_row_int.
ls_area-col_start = w_col_int. "if lt_values is empty
lt_values = wo_autofilter->get_values( ) . lt_values = wo_autofilter->get_values( ) .
SORT lt_values BY column ASCENDING. SORT lt_values BY column ASCENDING.
DESCRIBE TABLE lt_values LINES l_lines. DESCRIBE TABLE lt_values LINES l_lines.

View File

@ -404,11 +404,6 @@ CLASS zcl_excel_autofilter IMPLEMENTATION.
filter_area-col_end = l_col . filter_area-col_end = l_col .
ENDIF. ENDIF.
IF filter_area-row_start > filter_area-row_end.
ls_original_filter_area = filter_area.
filter_area-row_start = ls_original_filter_area-row_end.
filter_area-row_end = ls_original_filter_area-row_start.
ENDIF.
IF filter_area-row_start < 1. IF filter_area-row_start < 1.
filter_area-row_start = 1. filter_area-row_start = 1.
ENDIF. ENDIF.
@ -423,6 +418,11 @@ CLASS zcl_excel_autofilter IMPLEMENTATION.
filter_area-col_end < 1. filter_area-col_end < 1.
filter_area-col_end = l_col. filter_area-col_end = l_col.
ENDIF. ENDIF.
IF filter_area-row_start > filter_area-row_end.
ls_original_filter_area = filter_area.
filter_area-row_start = ls_original_filter_area-row_end.
filter_area-row_end = ls_original_filter_area-row_start.
ENDIF.
IF filter_area-col_start > filter_area-col_end. IF filter_area-col_start > filter_area-col_end.
filter_area-col_start = filter_area-col_end. filter_area-col_start = filter_area-col_end.
ENDIF. ENDIF.

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.
@ -3199,9 +3205,9 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
* STEP 2: Create main node relationships * STEP 2: Create main node relationships
lo_element_root = lo_document->create_simple_element( name = lc_xml_node_xml lo_element_root = lo_document->create_simple_element( name = lc_xml_node_xml
parent = lo_document ). parent = lo_document ).
lo_element_root->set_attribute_ns( : name = 'xmlns:v' value = lc_xml_node_ns_v ), lo_element_root->set_attribute_ns( name = 'xmlns:v' value = lc_xml_node_ns_v ).
name = 'xmlns:o' value = lc_xml_node_ns_o ), lo_element_root->set_attribute_ns( name = 'xmlns:o' value = lc_xml_node_ns_o ).
name = 'xmlns:x' value = lc_xml_node_ns_x ). lo_element_root->set_attribute_ns( name = 'xmlns:x' value = lc_xml_node_ns_x ).
********************************************************************** **********************************************************************
* STEP 3: Create o:shapeLayout * STEP 3: Create o:shapeLayout
@ -3214,8 +3220,8 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lo_element_idmap = lo_document->create_simple_element( name = lc_xml_node_idmap lo_element_idmap = lo_document->create_simple_element( name = lc_xml_node_idmap
parent = lo_document ). parent = lo_document ).
lo_element_idmap->set_attribute_ns( : name = lc_xml_attr_vext value = lc_xml_attr_val_edit ), lo_element_idmap->set_attribute_ns( name = lc_xml_attr_vext value = lc_xml_attr_val_edit ).
name = lc_xml_attr_data value = '1' ). lo_element_idmap->set_attribute_ns( name = lc_xml_attr_data value = '1' ).
lo_element_shapelayout->append_child( new_child = lo_element_idmap ). lo_element_shapelayout->append_child( new_child = lo_element_idmap ).
@ -3227,10 +3233,10 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lo_element_shapetype = lo_document->create_simple_element( name = lc_xml_node_shapetype lo_element_shapetype = lo_document->create_simple_element( name = lc_xml_node_shapetype
parent = lo_document ). parent = lo_document ).
lo_element_shapetype->set_attribute_ns( : name = lc_xml_attr_id value = '_x0000_t202' ), lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_id value = '_x0000_t202' ).
name = lc_xml_attr_coordsize value = '21600,21600' ), lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_coordsize value = '21600,21600' ).
name = lc_xml_attr_ospt value = '202' ), lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_ospt value = '202' ).
name = lc_xml_attr_path value = 'm,l,21600r21600,l21600,xe' ). lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_path value = 'm,l,21600r21600,l21600,xe' ).
lo_element_stroke = lo_document->create_simple_element( name = lc_xml_node_stroke lo_element_stroke = lo_document->create_simple_element( name = lc_xml_node_stroke
parent = lo_document ). parent = lo_document ).
@ -3238,11 +3244,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lo_element_path = lo_document->create_simple_element( name = lc_xml_node_path lo_element_path = lo_document->create_simple_element( name = lc_xml_node_path
parent = lo_document ). parent = lo_document ).
lo_element_path->set_attribute_ns( : name = lc_xml_attr_gradientshapeok value = lc_xml_attr_val_t ), lo_element_path->set_attribute_ns( name = lc_xml_attr_gradientshapeok value = lc_xml_attr_val_t ).
name = lc_xml_attr_oconnecttype value = lc_xml_attr_val_rect ). lo_element_path->set_attribute_ns( name = lc_xml_attr_oconnecttype value = lc_xml_attr_val_rect ).
lo_element_shapetype->append_child( : new_child = lo_element_stroke ), lo_element_shapetype->append_child( new_child = lo_element_stroke ).
new_child = lo_element_path ). lo_element_shapetype->append_child( new_child = lo_element_path ).
lo_element_root->append_child( new_child = lo_element_shapetype ). lo_element_root->append_child( new_child = lo_element_shapetype ).
@ -3267,11 +3273,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
lv_attr_id_index = 1024 + lv_index. lv_attr_id_index = 1024 + lv_index.
lv_attr_id = lv_attr_id_index. lv_attr_id = lv_attr_id_index.
CONCATENATE '_x0000_s' lv_attr_id INTO lv_attr_id. CONCATENATE '_x0000_s' lv_attr_id INTO lv_attr_id.
lo_element_shape->set_attribute_ns( : name = lc_xml_attr_id value = lv_attr_id ), lo_element_shape->set_attribute_ns( name = lc_xml_attr_id value = lv_attr_id ).
name = lc_xml_attr_type value = '#_x0000_t202' ), lo_element_shape->set_attribute_ns( name = lc_xml_attr_type value = '#_x0000_t202' ).
name = lc_xml_attr_style value = 'size:auto;width:auto;height:auto;position:absolute;margin-left:117pt;margin-top:172.5pt;z-index:1;visibility:hidden' ), lo_element_shape->set_attribute_ns( name = lc_xml_attr_style value = 'size:auto;width:auto;height:auto;position:absolute;margin-left:117pt;margin-top:172.5pt;z-index:1;visibility:hidden' ).
name = lc_xml_attr_fillcolor value = '#ffffe1' ), lo_element_shape->set_attribute_ns( name = lc_xml_attr_fillcolor value = '#ffffe1' ).
name = lc_xml_attr_oinsetmode value = lc_xml_attr_val_auto ). lo_element_shape->set_attribute_ns( name = lc_xml_attr_oinsetmode value = lc_xml_attr_val_auto ).
" Fill " Fill
lo_element_fill = lo_document->create_simple_element( name = lc_xml_node_fill lo_element_fill = lo_document->create_simple_element( name = lc_xml_node_fill
@ -3281,9 +3287,9 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
" Shadow " Shadow
lo_element_shadow = lo_document->create_simple_element( name = lc_xml_node_shadow lo_element_shadow = lo_document->create_simple_element( name = lc_xml_node_shadow
parent = lo_document ). parent = lo_document ).
lo_element_shadow->set_attribute_ns( : name = lc_xml_attr_on value = lc_xml_attr_val_t ), lo_element_shadow->set_attribute_ns( name = lc_xml_attr_on value = lc_xml_attr_val_t ).
name = lc_xml_attr_color value = lc_xml_attr_val_black ), lo_element_shadow->set_attribute_ns( name = lc_xml_attr_color value = lc_xml_attr_val_black ).
name = lc_xml_attr_obscured value = lc_xml_attr_val_t ). lo_element_shadow->set_attribute_ns( name = lc_xml_attr_obscured value = lc_xml_attr_val_t ).
lo_element_shape->append_child( new_child = lo_element_shadow ). lo_element_shape->append_child( new_child = lo_element_shadow ).
" Path " Path
lo_element_path = lo_document->create_simple_element( name = lc_xml_node_path lo_element_path = lo_document->create_simple_element( name = lc_xml_node_path
@ -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.
@ -6556,4 +6573,3 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
ep_file = me->create( ). ep_file = me->create( ).
ENDMETHOD. ENDMETHOD.
ENDCLASS. ENDCLASS.

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