diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 917486b..c0be27c 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1061,12 +1061,10 @@ 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, + type_kind TYPE abap_typekind, flag_class TYPE abap_bool. FIELD-SYMBOLS: TYPE any, @@ -1074,6 +1072,9 @@ CLASS zcl_excel_common IMPLEMENTATION. TYPE any. + 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 ). LOOP AT descr->components INTO wa_component. @@ -1081,22 +1082,19 @@ 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 - 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. -* 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 - flag_class = abap_true. 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 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 = ). @@ -1112,12 +1110,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, + type_kind TYPE abap_typekind, flag_class TYPE abap_bool, o_border TYPE REF TO zcl_excel_style_border. @@ -1126,6 +1122,14 @@ CLASS zcl_excel_common IMPLEMENTATION. TYPE any. + 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. + e_target = o_border. + ENDIF. + descr ?= cl_abap_structdescr=>describe_by_data( i_source ). LOOP AT descr->components INTO wa_component. @@ -1135,31 +1139,19 @@ 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. -* 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 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 - flag_class = abap_true. 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 - " 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. - ENDIF. zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = i_sourcex = CHANGING e_target = ). diff --git a/src/zcl_excel_reader_2007.clas.abap b/src/zcl_excel_reader_2007.clas.abap index 53fc484..4512893 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 @@ -608,7 +612,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 +1476,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 @@ -2254,7 +2258,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, @@ -2476,11 +2480,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 @@ -2501,6 +2505,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 ). @@ -2809,15 +2815,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 ). @@ -3219,6 +3224,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. @@ -3550,6 +3565,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, 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 diff --git a/src/zcl_excel_worksheet.clas.abap b/src/zcl_excel_worksheet.clas.abap index 5d7ef2f..8d240f4 100644 --- a/src/zcl_excel_worksheet.clas.abap +++ b/src/zcl_excel_worksheet.clas.abap @@ -1948,7 +1948,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, @@ -1960,14 +1959,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 . @@ -1975,12 +1973,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. @@ -1990,12 +1985,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. diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 06e0b62..e109776 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1234,10 +1234,11 @@ 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. @@ -1254,25 +1255,28 @@ 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. - 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 ). @@ -1280,7 +1284,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 @@ -1293,14 +1297,15 @@ 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. - 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 ). @@ -1329,9 +1334,10 @@ 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. @@ -4771,6 +4777,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. diff --git a/src/zcl_excel_writer_2007.clas.locals_imp.abap b/src/zcl_excel_writer_2007.clas.locals_imp.abap index ae9def7..838ff1d 100644 --- a/src/zcl_excel_writer_2007.clas.locals_imp.abap +++ b/src/zcl_excel_writer_2007.clas.locals_imp.abap @@ -887,6 +887,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, @@ -928,11 +929,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. @@ -1171,21 +1168,17 @@ 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 value = lv_value ). - lv_value = ls_textfunction-textfunction. - 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( ) @@ -1195,17 +1188,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 ).