From f904c0f7c1aaf7d36d2c86582263484c382ae6bd Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:17:29 +0100 Subject: [PATCH 01/21] Update zcl_excel_writer_2007.clas.locals_imp.abap Obvious bug --- src/zcl_excel_writer_2007.clas.locals_imp.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zcl_excel_writer_2007.clas.locals_imp.abap b/src/zcl_excel_writer_2007.clas.locals_imp.abap index 7e01e73..923ef16 100644 --- a/src/zcl_excel_writer_2007.clas.locals_imp.abap +++ b/src/zcl_excel_writer_2007.clas.locals_imp.abap @@ -1162,7 +1162,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 From 5b9d3f380300bc2d2badbd3fec0771c9938f2e32 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:49:04 +0100 Subject: [PATCH 02/21] Update zcl_excel_reader_2007.clas.abap --- src/zcl_excel_reader_2007.clas.abap | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/zcl_excel_reader_2007.clas.abap b/src/zcl_excel_reader_2007.clas.abap index 3b577d0..2e5181a 100644 --- a/src/zcl_excel_reader_2007.clas.abap +++ b/src/zcl_excel_reader_2007.clas.abap @@ -608,7 +608,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. WHEN 'fill'. lo_ixml_element = lo_ixml_dxf_child->find_from_name_ns( name = 'patternFill' uri = namespace-main ). IF lo_ixml_element IS BOUND. - lo_ixml_element2 = lo_ixml_dxf_child->find_from_name_ns( name = 'bgColor' uri = namespace-main ). + lo_ixml_element2 = lo_ixml_element->find_from_name_ns( name = 'bgColor' uri = namespace-main ). IF lo_ixml_element2 IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element2->get_attribute_ns( 'rgb' ). @@ -1472,7 +1472,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. *--------------------------------------------------------------------* * Patternfill - foreground color *--------------------------------------------------------------------* - lo_node_fgcolor = lo_node_fill->find_from_name_ns( name = 'fgColor' uri = namespace-main ). + lo_node_fgcolor = lo_node_fill_child->find_from_name_ns( name = 'fgColor' uri = namespace-main ). IF lo_node_fgcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_fgcolor @@ -2253,7 +2253,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. END OF lty_column. TYPES: BEGIN OF lty_sheetview, - showgridlines TYPE zexcel_show_gridlines, + showgridlines TYPE string, tabselected TYPE string, zoomscale TYPE string, zoomscalenormal TYPE string, @@ -2474,11 +2474,11 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. ip_element = lo_ixml_node CHANGING cp_structure = ls_relationship ). - CONCATENATE lv_dirname ls_relationship-target INTO lv_path. - lv_path = resolve_path( lv_path ). CASE ls_relationship-type. WHEN lc_rel_drawing. + CONCATENATE lv_dirname ls_relationship-target INTO lv_path. + lv_path = resolve_path( lv_path ). " Read Drawings * Issue # 339 Not all drawings are in the path mentioned below. * Some Excel elements like textfields (which we don't support ) have a drawing-part in the relationsships @@ -2795,15 +2795,14 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. "Now we need to get information from the sheetView node lo_ixml_sheetview_elem = lo_ixml_worksheet->find_from_name_ns( name = 'sheetView' uri = namespace-main ). fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_sheetview_elem CHANGING cp_structure = ls_sheetview ). - IF ls_sheetview-showgridlines IS INITIAL OR - ls_sheetview-showgridlines = lc_xml_attr_true OR - ls_sheetview-showgridlines = lc_xml_attr_true_int. - "If the attribute is not specified or set to true, we will show grid lines - ls_sheetview-showgridlines = abap_true. - ELSE. - ls_sheetview-showgridlines = abap_false. - ENDIF. - io_worksheet->set_show_gridlines( ls_sheetview-showgridlines ). + "If the attribute is not specified or set to true, we will show grid lines + io_worksheet->set_show_gridlines( boolc( ls_sheetview-showgridlines IS INITIAL OR + ls_sheetview-showgridlines = lc_xml_attr_true OR + ls_sheetview-showgridlines = lc_xml_attr_true_int ) ). + "If the attribute is not specified or set to true, we will show rowcol headers + io_worksheet->set_show_rowcolheaders( boolc( ls_sheetview-showrowcolheaders IS INITIAL OR + ls_sheetview-showrowcolheaders = lc_xml_attr_true OR + ls_sheetview-showrowcolheaders = lc_xml_attr_true_int ) ). IF ls_sheetview-righttoleft = lc_xml_attr_true OR ls_sheetview-righttoleft = lc_xml_attr_true_int. io_worksheet->zif_excel_sheet_properties~set_right_to_left( abap_true ). From e88f8f3df59aefab8c153de2517ebbc8937b2533 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:35:50 +0100 Subject: [PATCH 03/21] Update zcl_excel_writer_2007.clas.locals_imp.abap --- src/zcl_excel_writer_2007.clas.locals_imp.abap | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zcl_excel_writer_2007.clas.locals_imp.abap b/src/zcl_excel_writer_2007.clas.locals_imp.abap index 923ef16..49c822c 100644 --- a/src/zcl_excel_writer_2007.clas.locals_imp.abap +++ b/src/zcl_excel_writer_2007.clas.locals_imp.abap @@ -1167,7 +1167,11 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION. CONDENSE lv_value. lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid value = lv_value ). - lv_value = ls_textfunction-textfunction. + IF ls_textfunction-textfunction = zcl_excel_style_cond=>c_textfunction_notcontains. + lv_value = zcl_excel_style_cond=>c_operator_notcontains. + ELSE. + lv_value = ls_textfunction-textfunction. + ENDIF. lo_element_2->set_attribute_ns( name = lc_xml_attr_operator value = lv_value ). From 11a372ba1b19d644e762568247d79a787ab65d79 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:38:17 +0100 Subject: [PATCH 04/21] Update zcl_excel_style_cond.clas.abap --- src/zcl_excel_style_cond.clas.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zcl_excel_style_cond.clas.abap b/src/zcl_excel_style_cond.clas.abap index fb4efc3..426acb9 100644 --- a/src/zcl_excel_style_cond.clas.abap +++ b/src/zcl_excel_style_cond.clas.abap @@ -53,7 +53,7 @@ CLASS zcl_excel_style_cond DEFINITION CONSTANTS c_textfunction_beginswith TYPE tv_textfunction VALUE 'beginsWith'. "#EC NOTEXT CONSTANTS c_textfunction_containstext TYPE tv_textfunction VALUE 'containsText'. "#EC NOTEXT CONSTANTS c_textfunction_endswith TYPE tv_textfunction VALUE 'endsWith'. "#EC NOTEXT - CONSTANTS c_textfunction_notcontains TYPE tv_textfunction VALUE 'notContains'. "#EC NOTEXT + CONSTANTS c_textfunction_notcontains TYPE tv_textfunction VALUE 'notContainsText'. "#EC NOTEXT CONSTANTS c_rule_cellis TYPE zexcel_condition_rule VALUE 'cellIs'. "#EC NOTEXT CONSTANTS c_rule_containstext TYPE zexcel_condition_rule VALUE 'containsText'. "#EC NOTEXT CONSTANTS c_rule_databar TYPE zexcel_condition_rule VALUE 'dataBar'. "#EC NOTEXT From 063dc41ad1c5f6906f37b4541f48738ac3cd7b99 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:52:39 +0100 Subject: [PATCH 05/21] Update zcl_excel_reader_2007.clas.abap --- src/zcl_excel_reader_2007.clas.abap | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/zcl_excel_reader_2007.clas.abap b/src/zcl_excel_reader_2007.clas.abap index 2e5181a..f5a93a3 100644 --- a/src/zcl_excel_reader_2007.clas.abap +++ b/src/zcl_excel_reader_2007.clas.abap @@ -232,6 +232,10 @@ CLASS zcl_excel_reader_2007 DEFINITION IMPORTING !io_ixml_rule TYPE REF TO if_ixml_element !io_style_cond TYPE REF TO zcl_excel_style_cond . + METHODS load_worksheet_cond_format_tf + IMPORTING + !io_ixml_rule TYPE REF TO if_ixml_element + !io_style_cond TYPE REF TO zcl_excel_style_cond . METHODS load_worksheet_drawing IMPORTING !ip_path TYPE string @@ -3208,6 +3212,16 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. lo_style_cond = io_worksheet->add_new_style_cond( '' ). load_worksheet_cond_format_aa( io_ixml_rule = lo_ixml_rule io_style_cond = lo_style_cond ). + + WHEN zcl_excel_style_cond=>c_textfunction_beginswith OR + zcl_excel_style_cond=>c_textfunction_containstext OR + zcl_excel_style_cond=>c_textfunction_endswith OR + zcl_excel_style_cond=>c_textfunction_notcontains. + lo_style_cond = io_worksheet->add_new_style_cond( '' ). + load_worksheet_cond_format_tf( io_ixml_rule = lo_ixml_rule + io_style_cond = lo_style_cond ). + lv_rule = zcl_excel_style_cond=>c_rule_textfunction. "internal rule + WHEN OTHERS. ENDCASE. @@ -3539,6 +3553,23 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. ENDMETHOD. + METHOD load_worksheet_cond_format_tf. + + DATA lv_dxf_style_index TYPE i. + + FIELD-SYMBOLS LIKE LINE OF me->mt_dxf_styles. + + io_style_cond->mode_textfunction-textfunction = io_ixml_rule->get_attribute_ns( 'type' ). + io_style_cond->mode_textfunction-text = io_ixml_rule->get_attribute_ns( 'text' ). + lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). + READ TABLE me->mt_dxf_styles ASSIGNING WITH KEY dxf = lv_dxf_style_index. + IF sy-subrc = 0. + io_style_cond->mode_textfunction-cell_style = -guid. + ENDIF. + + ENDMETHOD. + + METHOD load_worksheet_drawing. TYPES: BEGIN OF t_c_nv_pr, From 0686c3616d62f2662cb94a680790ee993c184cdd Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:12:10 +0100 Subject: [PATCH 06/21] Update zcl_excel_writer_2007.clas.locals_imp.abap --- src/zcl_excel_writer_2007.clas.locals_imp.abap | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/zcl_excel_writer_2007.clas.locals_imp.abap b/src/zcl_excel_writer_2007.clas.locals_imp.abap index 49c822c..0817d34 100644 --- a/src/zcl_excel_writer_2007.clas.locals_imp.abap +++ b/src/zcl_excel_writer_2007.clas.locals_imp.abap @@ -919,11 +919,7 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION. lo_element_2 = o_document->create_simple_element( name = lc_xml_node_cfrule parent = o_document ). IF lo_style_cond->rule = zcl_excel_style_cond=>c_rule_textfunction. - IF lo_style_cond->mode_textfunction-textfunction = zcl_excel_style_cond=>c_textfunction_notcontains. - lv_value = `notContainsText`. - ELSE. - lv_value = lo_style_cond->mode_textfunction-textfunction. - ENDIF. + lv_value = lo_style_cond->mode_textfunction-textfunction. ELSE. lv_value = lo_style_cond->rule. ENDIF. From b87432c5a292b3bf27ad0d9bcadd569d052e501f Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:46:01 +0100 Subject: [PATCH 07/21] Update zcl_excel_writer_2007.clas.locals_imp.abap --- ...zcl_excel_writer_2007.clas.locals_imp.abap | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/zcl_excel_writer_2007.clas.locals_imp.abap b/src/zcl_excel_writer_2007.clas.locals_imp.abap index 0817d34..366a522 100644 --- a/src/zcl_excel_writer_2007.clas.locals_imp.abap +++ b/src/zcl_excel_writer_2007.clas.locals_imp.abap @@ -878,6 +878,7 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION. lv_column_start TYPE zexcel_cell_column_alpha, lv_row_start TYPE zexcel_cell_row, lv_cell_coords TYPE zexcel_cell_coords, + lv_operator TYPE string, ls_expression TYPE zexcel_conditional_expression, ls_conditional_top10 TYPE zexcel_conditional_top10, ls_conditional_above_avg TYPE zexcel_conditional_above_avg, @@ -1163,20 +1164,12 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION. CONDENSE lv_value. lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid value = lv_value ). - IF ls_textfunction-textfunction = zcl_excel_style_cond=>c_textfunction_notcontains. - lv_value = zcl_excel_style_cond=>c_operator_notcontains. - ELSE. - lv_value = ls_textfunction-textfunction. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_operator - value = lv_value ). - " text lv_value = ls_textfunction-text. lo_element_2->set_attribute_ns( name = lc_xml_attr_text value = lv_value ). - " formula node + " operator & formula node zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lo_style_cond->get_dimension_range( ) @@ -1186,17 +1179,25 @@ CLASS lcl_create_xl_sheet IMPLEMENTATION. lv_cell_coords = |{ lv_column_start }{ lv_row_start }|. CASE ls_textfunction-textfunction. WHEN zcl_excel_style_cond=>c_textfunction_beginswith. + lv_operator = zcl_excel_style_cond=>c_operator_beginswith. lv_value = |LEFT({ lv_cell_coords },LEN("{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }"))=| && |"{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }"|. WHEN zcl_excel_style_cond=>c_textfunction_containstext. + lv_operator = zcl_excel_style_cond=>c_operator_containstext. lv_value = |NOT(ISERROR(SEARCH("{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }",{ lv_cell_coords })))|. WHEN zcl_excel_style_cond=>c_textfunction_endswith. + lv_operator = zcl_excel_style_cond=>c_operator_endswith. lv_value = |RIGHT({ lv_cell_coords },LEN("{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }"))=| && |"{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }"|. WHEN zcl_excel_style_cond=>c_textfunction_notcontains. + lv_operator = zcl_excel_style_cond=>c_operator_notcontains. lv_value = |ISERROR(SEARCH("{ escape( val = ls_textfunction-text format = cl_abap_format=>e_html_text ) }",{ lv_cell_coords }))|. WHEN OTHERS. + lv_operator = ls_textfunction-textfunction. + CLEAR lv_value. ENDCASE. + lo_element_2->set_attribute_ns( name = lc_xml_attr_operator + value = lv_operator ). lo_element_3 = o_document->create_simple_element( name = lc_xml_node_formula parent = o_document ). lo_element_3->set_value( value = lv_value ). From 476c809a320e865c091c09a837dc2ed94d0182c3 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Sun, 4 Feb 2024 14:32:59 +0100 Subject: [PATCH 08/21] Update zcl_excel_worksheet.clas.abap --- src/zcl_excel_worksheet.clas.abap | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/zcl_excel_worksheet.clas.abap b/src/zcl_excel_worksheet.clas.abap index 5cb1ce0..f324dbe 100644 --- a/src/zcl_excel_worksheet.clas.abap +++ b/src/zcl_excel_worksheet.clas.abap @@ -1918,7 +1918,6 @@ CLASS zcl_excel_worksheet IMPLEMENTATION. METHOD check_rtf. DATA: lo_style TYPE REF TO zcl_excel_style, - lo_iterator TYPE REF TO zcl_excel_collection_iterator, lv_next_rtf_offset TYPE i, lv_tabix TYPE i, lv_value TYPE string, @@ -1930,14 +1929,13 @@ CLASS zcl_excel_worksheet IMPLEMENTATION. ip_style = excel->get_default_style( ). ENDIF. - lo_iterator = excel->get_styles_iterator( ). - WHILE lo_iterator->has_next( ) = abap_true. - lo_style ?= lo_iterator->get_next( ). - IF lo_style->get_guid( ) = ip_style. - EXIT. + " If there is no style available ls_rtf-font remains initial + IF ip_style IS NOT INITIAL. + lo_style = excel->get_style_from_guid( ip_style ). + IF lo_style IS BOUND. + ls_rtf-font = lo_style->font->get_structure( ). ENDIF. - CLEAR lo_style. - ENDWHILE. + ENDIF. lv_next_rtf_offset = 0. LOOP AT ct_rtf ASSIGNING . @@ -1945,12 +1943,9 @@ CLASS zcl_excel_worksheet IMPLEMENTATION. IF lv_next_rtf_offset < -offset. ls_rtf-offset = lv_next_rtf_offset. ls_rtf-length = -offset - lv_next_rtf_offset. - ls_rtf-font = lo_style->font->get_structure( ). INSERT ls_rtf INTO ct_rtf INDEX lv_tabix. ELSEIF lv_next_rtf_offset > -offset. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Gaps or overlaps in RTF data offset/length specs'. + zcx_excel=>raise_text( 'Gaps or overlaps in RTF data offset/length specs' ). ENDIF. lv_next_rtf_offset = -offset + -length. ENDLOOP. @@ -1960,12 +1955,9 @@ CLASS zcl_excel_worksheet IMPLEMENTATION. IF lv_val_length > lv_next_rtf_offset. ls_rtf-offset = lv_next_rtf_offset. ls_rtf-length = lv_val_length - lv_next_rtf_offset. - ls_rtf-font = lo_style->font->get_structure( ). INSERT ls_rtf INTO TABLE ct_rtf. - ELSEIF lv_val_length > lv_next_rtf_offset. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'RTF specs length is not equal to value length'. + ELSEIF lv_val_length < lv_next_rtf_offset. + zcx_excel=>raise_text( 'RTF specs length is not equal to value length' ). ENDIF. ENDMETHOD. From 5f84d3a6f30e3f9893c3e8c6e77ade2c7e284f30 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:21:50 +0100 Subject: [PATCH 09/21] Update zcl_excel_style_fill.clas.abap CornerRB should not look like fromCenter --- src/zcl_excel_style_fill.clas.abap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zcl_excel_style_fill.clas.abap b/src/zcl_excel_style_fill.clas.abap index f20b06d..0ca8cc7 100644 --- a/src/zcl_excel_style_fill.clas.abap +++ b/src/zcl_excel_style_fill.clas.abap @@ -135,10 +135,10 @@ CLASS zcl_excel_style_fill IMPLEMENTATION. gradtype-type = c_fill_gradient_path. gradtype-position1 = '0'. gradtype-position2 = '1'. - gradtype-bottom = '0.5'. - gradtype-top = '0.5'. - gradtype-left = '0.5'. - gradtype-right = '0.5'. + gradtype-bottom = '1'. + gradtype-top = '1'. + gradtype-left = '1'. + gradtype-right = '1'. ENDCASE. ENDMETHOD. "build_gradient From 8b01bd7c387f2bd0e17c2766f79289508955005b Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:28:31 +0100 Subject: [PATCH 10/21] Update zcl_excel_writer_2007.clas.abap --- src/zcl_excel_writer_2007.clas.abap | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 6b9434e..9f09b89 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -4786,6 +4786,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. SUBTRACT 1 FROM ls_cellxfs-alignmentid. * Compress fills + IF ls_fill-gradtype IS NOT INITIAL. +* Then filltype doesn't matter for XML Output and should not be split criteria. +* If you use the Reader to reload it filltype will be NONE anyway in this case. + ls_fill-filltype = zcl_excel_style_fill=>c_fill_none. + ENDIF. READ TABLE lt_fills FROM ls_fill TRANSPORTING NO FIELDS. IF sy-subrc EQ 0. ls_cellxfs-fillid = sy-tabix. From 37af95727172728e935d0acca4a170fcbe5fc53a Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:37:56 +0100 Subject: [PATCH 11/21] Update zexcel_s_cstyle_fill.tabl.xml --- src/zexcel_s_cstyle_fill.tabl.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zexcel_s_cstyle_fill.tabl.xml b/src/zexcel_s_cstyle_fill.tabl.xml index 3e511ec..0000e06 100644 --- a/src/zexcel_s_cstyle_fill.tabl.xml +++ b/src/zexcel_s_cstyle_fill.tabl.xml @@ -40,7 +40,7 @@ GRADTYPE - ZEXCEL_S_CSTYLEX_GRADTYPE + ZEXCEL_S_GRADIENT_TYPE 0 STRU STRUS From fba955bc5cf568be32f36c7b637b55d54b7fb37c Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:32:31 +0100 Subject: [PATCH 12/21] Update zcl_excel_common.clas.abap --- src/zcl_excel_common.clas.abap | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 9d9300a..07271ae 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1042,8 +1042,7 @@ CLASS zcl_excel_common IMPLEMENTATION. * This is private an no one using it so far except me, so no need to hurry DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, - attribute_name LIKE wa_component-name, - flag_class TYPE abap_bool. + attribute_name LIKE wa_component-name. FIELD-SYMBOLS: TYPE any, TYPE any, @@ -1058,7 +1057,6 @@ CLASS zcl_excel_common IMPLEMENTATION. ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO . * At least one field in the structure should be marked - otherwise continue with next field - CLEAR flag_class. * maybe source is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . IF sy-subrc <> 0. @@ -1068,7 +1066,6 @@ CLASS zcl_excel_common IMPLEMENTATION. IF sy-subrc <> 0. EXIT. ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - flag_class = abap_true. ENDIF. CASE wa_component-type_kind. @@ -1094,7 +1091,9 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, - flag_class TYPE abap_bool, + check_class TYPE abap_bool, + lo_refdescr TYPE REF TO cl_abap_refdescr, + lo_classdescr TYPE REF TO cl_abap_classdescr, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: TYPE any, @@ -1111,7 +1110,7 @@ CLASS zcl_excel_common IMPLEMENTATION. ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO . * At least one field in the structure should be marked - otherwise continue with next field CHECK CA abap_true. - CLEAR flag_class. + CLEAR check_class. * maybe target is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . IF sy-subrc <> 0. @@ -1119,22 +1118,25 @@ CLASS zcl_excel_common IMPLEMENTATION. CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO . IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - flag_class = abap_true. + IF IS INITIAL. + check_class = abap_true. + ENDIF. ENDIF. CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion - " To avoid dump with attribute GRADTYPE of class ZCL_EXCEL_STYLE_FILL - " quick and really dirty fix -> check the attribute name - " Border has to be initialized somewhere else - IF wa_component-name EQ 'GRADTYPE'. - flag_class = abap_false. - ENDIF. - - IF flag_class = abap_true AND IS INITIAL. -* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance - CREATE OBJECT o_border. - = o_border. + IF check_class = abap_true. + TRY. + lo_refdescr ?= cl_abap_typedescr=>describe_by_data( ). + lo_classdescr ?= lo_refdescr->get_referenced_type( ). + CASE lo_classdescr->get_relative_name( ). + WHEN 'ZCL_EXCEL_STYLE_BORDER'. +* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance + CREATE OBJECT o_border. + = o_border. + ENDCASE. + CATCH cx_sy_move_cast_error. + ENDTRY. ENDIF. zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = i_sourcex = From c4fd6fe0b708e202cb72806086062b1d1b123d7a Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:18:33 +0100 Subject: [PATCH 13/21] Update zcl_excel_common.clas.abap --- src/zcl_excel_common.clas.abap | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 07271ae..96dd3ea 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1056,7 +1056,6 @@ CLASS zcl_excel_common IMPLEMENTATION. * Assign structure and X-structure ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO . -* At least one field in the structure should be marked - otherwise continue with next field * maybe source is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . IF sy-subrc <> 0. @@ -1069,7 +1068,7 @@ CLASS zcl_excel_common IMPLEMENTATION. ENDIF. CASE wa_component-type_kind. - WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursio + WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = CHANGING e_target = e_targetx = ). @@ -1091,9 +1090,6 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, - check_class TYPE abap_bool, - lo_refdescr TYPE REF TO cl_abap_refdescr, - lo_classdescr TYPE REF TO cl_abap_classdescr, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: TYPE any, @@ -1110,34 +1106,24 @@ CLASS zcl_excel_common IMPLEMENTATION. ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO . * At least one field in the structure should be marked - otherwise continue with next field CHECK CA abap_true. - CLEAR check_class. * maybe target is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . IF sy-subrc <> 0. * not - then it is an attribute of the class - use different assign then + IF e_target IS INITIAL. +* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance + CREATE OBJECT o_border. + e_target = o_border. + ENDIF. CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO . - IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - IF IS INITIAL. - check_class = abap_true. - ENDIF. + IF sy-subrc <> 0. + EXIT. + ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps ENDIF. CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion - IF check_class = abap_true. - TRY. - lo_refdescr ?= cl_abap_typedescr=>describe_by_data( ). - lo_classdescr ?= lo_refdescr->get_referenced_type( ). - CASE lo_classdescr->get_relative_name( ). - WHEN 'ZCL_EXCEL_STYLE_BORDER'. -* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance - CREATE OBJECT o_border. - = o_border. - ENDCASE. - CATCH cx_sy_move_cast_error. - ENDTRY. - ENDIF. zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = i_sourcex = CHANGING e_target = ). From 6dc08aaea6180152e897094f64033b00caf2b955 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:55:42 +0100 Subject: [PATCH 14/21] Update zcl_excel_common.clas.abap --- src/zcl_excel_common.clas.abap | 52 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 96dd3ea..7ee6c0d 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1037,18 +1037,18 @@ CLASS zcl_excel_common IMPLEMENTATION. METHOD recursive_class_to_struct. " # issue 139 -* is working for me - but after looking through this coding I guess -* I'll rewrite this to a version w/o recursion -* This is private an no one using it so far except me, so no need to hurry DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, - attribute_name LIKE wa_component-name. + attribute_name LIKE wa_component-name, + flag_class TYPE flag. FIELD-SYMBOLS: TYPE any, TYPE any, TYPE any. + flag_class = boolc( cl_abap_datadescr=>get_data_type_kind( i_source ) = cl_abap_datadescr=>typekind_oref ). + descr ?= cl_abap_structdescr=>describe_by_data( e_target ). LOOP AT descr->components INTO wa_component. @@ -1056,16 +1056,16 @@ CLASS zcl_excel_common IMPLEMENTATION. * Assign structure and X-structure ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO . -* maybe source is just a structure - try assign component... - ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . - IF sy-subrc <> 0. -* not - then it is an attribute of the class - use different assign then + + IF flag_class = abap_false. +* source is a structure - use assign component + ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . + ELSE. +* then it is an attribute of the class - use different assign then CONCATENATE 'i_source->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO . - IF sy-subrc <> 0. - EXIT. - ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps ENDIF. + IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to avoid dumps CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion @@ -1084,12 +1084,10 @@ CLASS zcl_excel_common IMPLEMENTATION. METHOD recursive_struct_to_class. " # issue 139 -* is working for me - but after looking through this coding I guess -* I'll rewrite this to a version w/o recursion -* This is private an no one using it so far except me, so no need to hurry DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, + flag_class TYPE flag, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: TYPE any, @@ -1097,6 +1095,13 @@ CLASS zcl_excel_common IMPLEMENTATION. TYPE any. + flag_class = boolc( cl_abap_datadescr=>get_data_type_kind( e_target ) = cl_abap_datadescr=>typekind_oref ). + IF flag_class = abap_true AND e_target IS INITIAL. +* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance + CREATE OBJECT o_border. + e_target = o_border. + ENDIF. + descr ?= cl_abap_structdescr=>describe_by_data( i_source ). LOOP AT descr->components INTO wa_component. @@ -1106,21 +1111,16 @@ CLASS zcl_excel_common IMPLEMENTATION. ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO . * At least one field in the structure should be marked - otherwise continue with next field CHECK CA abap_true. -* maybe target is just a structure - try assign component... - ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . - IF sy-subrc <> 0. -* not - then it is an attribute of the class - use different assign then - IF e_target IS INITIAL. -* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance - CREATE OBJECT o_border. - e_target = o_border. - ENDIF. + + IF flag_class = abap_false. +* target is a structure - use assign component + ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . + ELSE. +* then it is an attribute of the class - use different assign then CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO . - IF sy-subrc <> 0. - EXIT. - ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps ENDIF. + IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to avoid dumps CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion From 13edc370a3d1ad7c52e74d037c26e39d987a10fe Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:05:48 +0100 Subject: [PATCH 15/21] Update zcl_excel_common.clas.abap --- src/zcl_excel_common.clas.abap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 7ee6c0d..9885d20 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1040,7 +1040,7 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, - flag_class TYPE flag. + flag_class TYPE abap_bool. FIELD-SYMBOLS: TYPE any, TYPE any, @@ -1087,7 +1087,7 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, - flag_class TYPE flag, + flag_class TYPE abap_bool, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: TYPE any, From 0450d4032b3cd43de77ba034197fee8986028e7e Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:08:24 +0100 Subject: [PATCH 16/21] Update zcl_excel_common.clas.abap --- src/zcl_excel_common.clas.abap | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 9885d20..fc2e0cd 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1040,6 +1040,7 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, + type_kind TYPE abap_typekind, flag_class TYPE abap_bool. FIELD-SYMBOLS: TYPE any, @@ -1047,7 +1048,8 @@ CLASS zcl_excel_common IMPLEMENTATION. TYPE any. - flag_class = boolc( cl_abap_datadescr=>get_data_type_kind( i_source ) = cl_abap_datadescr=>typekind_oref ). + DESCRIBE FIELD i_source TYPE type_kind. + flag_class = boolc( type_kind = cl_abap_typedescr=>typekind_oref ). descr ?= cl_abap_structdescr=>describe_by_data( e_target ). @@ -1059,7 +1061,7 @@ CLASS zcl_excel_common IMPLEMENTATION. IF flag_class = abap_false. * source is a structure - use assign component - ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . + ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . ELSE. * then it is an attribute of the class - use different assign then CONCATENATE 'i_source->' wa_component-name INTO attribute_name. @@ -1087,6 +1089,7 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, + type_kind TYPE abap_typekind, flag_class TYPE abap_bool, o_border TYPE REF TO zcl_excel_style_border. @@ -1095,7 +1098,8 @@ CLASS zcl_excel_common IMPLEMENTATION. TYPE any. - flag_class = boolc( cl_abap_datadescr=>get_data_type_kind( e_target ) = cl_abap_datadescr=>typekind_oref ). + DESCRIBE FIELD e_target TYPE type_kind. + flag_class = boolc( type_kind = cl_abap_typedescr=>typekind_oref ). IF flag_class = abap_true AND e_target IS INITIAL. * Only borders will be passed as unbound references. But since we want to set a value we have to create an instance CREATE OBJECT o_border. From 25268956005d58b59e14e5909a659a6439b6d48a Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:40:27 +0100 Subject: [PATCH 17/21] Update zcl_excel_writer_2007.clas.abap --- src/zcl_excel_writer_2007.clas.abap | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 9f09b89..736dfd6 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1215,9 +1215,8 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. CHECK iv_cell_style IS NOT INITIAL. 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 + lv_index = ls_styles_mapping-style + 1. " the numbering starts from 0 + READ TABLE it_cellxfs INTO ls_cellxfs INDEX lv_index. READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style. IF sy-subrc EQ 0. @@ -1235,7 +1234,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. parent = io_ixml_document ). "Conditional formatting font style correction by Alessandro Iannacci START - lv_index = ls_cellxfs-fontid + 1. + lv_index = ls_cellxfs-fontid + 1. " the numbering starts from 0 READ TABLE it_fonts INTO ls_font INDEX lv_index. IF ls_font IS NOT INITIAL. lo_element_font = io_ixml_document->create_simple_element( name = lc_xml_node_font @@ -1273,7 +1272,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. " the numbering starts from 0 + 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 @@ -1309,10 +1309,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lo_sub_element->append_child( new_child = lo_element_fill ). ENDIF. + + io_dxf_element->append_child( new_child = lo_sub_element ). ENDIF. - io_dxf_element->append_child( new_child = lo_sub_element ). - ENDMETHOD. +ENDMETHOD. METHOD create_relationships. From f5d0ed71898dda9b4904d0000e08e3b5d91bd24a Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:45:53 +0100 Subject: [PATCH 18/21] Update zcl_excel_writer_2007.clas.abap --- src/zcl_excel_writer_2007.clas.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 736dfd6..430cce1 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1313,7 +1313,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. io_dxf_element->append_child( new_child = lo_sub_element ). ENDIF. -ENDMETHOD. + ENDMETHOD. METHOD create_relationships. From 8d793f3f572b650302f00b18ce19c849ac60fd9b Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:18:34 +0100 Subject: [PATCH 19/21] Update zcl_excel_writer_2007.clas.abap --- src/zcl_excel_writer_2007.clas.abap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 430cce1..9c736b2 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1213,10 +1213,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lo_element_fill TYPE REF TO if_ixml_element. CHECK iv_cell_style IS NOT INITIAL. - READ TABLE me->styles_mapping INTO ls_styles_mapping WITH KEY guid = iv_cell_style. - lv_index = ls_styles_mapping-style + 1. " the numbering starts from 0 - READ TABLE it_cellxfs INTO ls_cellxfs INDEX lv_index. READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style. IF sy-subrc EQ 0. @@ -1233,6 +1230,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. " the numbering starts from 0 + 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. " the numbering starts from 0 READ TABLE it_fonts INTO ls_font INDEX lv_index. From 50f7fcb907a6243022990d94b05e1a13a0c827a2 Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:18:58 +0100 Subject: [PATCH 20/21] Update zcl_excel_writer_2007.clas.abap --- src/zcl_excel_writer_2007.clas.abap | 31 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 9c736b2..4c4daf3 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1213,6 +1213,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lo_element_fill TYPE REF TO if_ixml_element. 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_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style. @@ -1234,24 +1239,24 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. 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. " the numbering starts from 0 - READ TABLE it_fonts INTO ls_font INDEX lv_index. - IF ls_font IS NOT INITIAL. + IF ls_cellxfs-applyfont = 1. + lv_index = ls_cellxfs-fontid + 1. " the numbering starts from 0 + READ TABLE it_fonts INTO ls_font INDEX lv_index. lo_element_font = io_ixml_document->create_simple_element( name = lc_xml_node_font - parent = io_ixml_document ). + parent = io_ixml_document ). IF ls_font-bold EQ abap_true. lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_b - parent = io_ixml_document ). + parent = io_ixml_document ). lo_element_font->append_child( new_child = lo_sub_element_2 ). ENDIF. IF ls_font-italic EQ abap_true. lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_i - parent = io_ixml_document ). + parent = io_ixml_document ). lo_element_font->append_child( new_child = lo_sub_element_2 ). ENDIF. IF ls_font-underline EQ abap_true. lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_u - parent = io_ixml_document ). + parent = io_ixml_document ). lv_value = ls_font-underline_mode. lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_val value = lv_value ). @@ -1259,7 +1264,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. ENDIF. IF ls_font-strikethrough EQ abap_true. lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_strike - parent = io_ixml_document ). + parent = io_ixml_document ). lo_element_font->append_child( new_child = lo_sub_element_2 ). ENDIF. "color @@ -1272,15 +1277,15 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. "---Conditional formatting font style correction by Alessandro Iannacci END - lv_index = ls_cellxfs-fillid + 1. " the numbering starts from 0 - READ TABLE it_fills INTO ls_fill INDEX lv_index. - IF ls_fill IS NOT INITIAL. + IF ls_cellxfs-applyfill = 1. + lv_index = ls_cellxfs-fillid + 1. " the numbering starts from 0 + READ TABLE it_fills INTO ls_fill INDEX lv_index. " fill properties lo_element_fill = io_ixml_document->create_simple_element( name = lc_xml_node_fill - parent = io_ixml_document ). + parent = io_ixml_document ). "pattern lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_patternfill - parent = io_ixml_document ). + parent = io_ixml_document ). lv_value = ls_fill-filltype. lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_patterntype value = lv_value ). From fb56526db03124096279efde847c71a1320f0b8c Mon Sep 17 00:00:00 2001 From: Bernd <135710507+darnoc312@users.noreply.github.com> Date: Fri, 29 Mar 2024 09:08:49 +0100 Subject: [PATCH 21/21] Update zcl_excel_reader_2007.clas.abap --- src/zcl_excel_reader_2007.clas.abap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/zcl_excel_reader_2007.clas.abap b/src/zcl_excel_reader_2007.clas.abap index 5233e08..a53d881 100644 --- a/src/zcl_excel_reader_2007.clas.abap +++ b/src/zcl_excel_reader_2007.clas.abap @@ -2504,6 +2504,8 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. INSERT ls_external_hyperlink INTO TABLE lt_external_hyperlinks. WHEN lc_rel_comments. + CONCATENATE lv_dirname ls_relationship-target INTO lv_path. + lv_path = resolve_path( lv_path ). TRY. me->load_comments( ip_path = lv_path io_worksheet = io_worksheet ).