Merge branch 'main' into hvam/normalize1212

This commit is contained in:
Lars Hvam 2024-09-02 11:31:23 +02:00 committed by GitHub
commit 47ebcf70fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 29 deletions

View File

@ -1234,13 +1234,15 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
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.
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.
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.
APPEND ls_style_cond_mapping TO me->styles_cond_mapping.
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
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
lv_index = ls_cellxfs-fontid + 1.
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
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.
" fill properties
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 ).
ENDIF.
ENDIF.
io_dxf_element->append_child( new_child = lo_sub_element ).
io_dxf_element->append_child( new_child = lo_sub_element ).
ENDIF.
ENDMETHOD.
@ -3199,9 +3205,9 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
* STEP 2: Create main node relationships
lo_element_root = lo_document->create_simple_element( name = lc_xml_node_xml
parent = lo_document ).
lo_element_root->set_attribute_ns( : name = 'xmlns:v' value = lc_xml_node_ns_v ),
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:v' value = lc_xml_node_ns_v ).
lo_element_root->set_attribute_ns( name = 'xmlns:o' value = lc_xml_node_ns_o ).
lo_element_root->set_attribute_ns( name = 'xmlns:x' value = lc_xml_node_ns_x ).
**********************************************************************
* 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
parent = lo_document ).
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_vext value = lc_xml_attr_val_edit ).
lo_element_idmap->set_attribute_ns( name = lc_xml_attr_data value = '1' ).
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
parent = lo_document ).
lo_element_shapetype->set_attribute_ns( : name = lc_xml_attr_id value = '_x0000_t202' ),
name = lc_xml_attr_coordsize value = '21600,21600' ),
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_id value = '_x0000_t202' ).
lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_coordsize value = '21600,21600' ).
lo_element_shapetype->set_attribute_ns( name = lc_xml_attr_ospt value = '202' ).
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
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
parent = lo_document ).
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_gradientshapeok value = lc_xml_attr_val_t ).
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 ),
new_child = lo_element_path ).
lo_element_shapetype->append_child( new_child = lo_element_stroke ).
lo_element_shapetype->append_child( new_child = lo_element_path ).
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 = lv_attr_id_index.
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 ),
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' ),
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_id value = lv_attr_id ).
lo_element_shape->set_attribute_ns( name = lc_xml_attr_type value = '#_x0000_t202' ).
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' ).
lo_element_shape->set_attribute_ns( name = lc_xml_attr_fillcolor value = '#ffffe1' ).
lo_element_shape->set_attribute_ns( name = lc_xml_attr_oinsetmode value = lc_xml_attr_val_auto ).
" 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
lo_element_shadow = lo_document->create_simple_element( name = lc_xml_node_shadow
parent = lo_document ).
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 ),
name = lc_xml_attr_obscured value = lc_xml_attr_val_t ).
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_color value = lc_xml_attr_val_black ).
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 ).
" 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 ).
* 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.
CONTINUE.
ENDCASE.
@ -6556,4 +6573,3 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
ep_file = me->create( ).
ENDMETHOD.
ENDCLASS.

View File

@ -1171,7 +1171,7 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION.
*--------------------------------------------------------------------------------------*
WHEN zcl_excel_style_cond=>c_rule_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.
CONDENSE lv_value.
lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid