diff --git a/src/package.devc.xml b/src/package.devc.xml index 01a508a..56fdc7f 100644 --- a/src/package.devc.xml +++ b/src/package.devc.xml @@ -4,9 +4,6 @@ Spreadsheet libraries - ZTIR - NOT_CLASSIFIED - Not Classified diff --git a/src/zcl_excel_drawing.clas.abap b/src/zcl_excel_drawing.clas.abap index 1c49c36..08cde59 100644 --- a/src/zcl_excel_drawing.clas.abap +++ b/src/zcl_excel_drawing.clas.abap @@ -331,7 +331,7 @@ method GET_WIDTH_EMU_STR. endmethod. -method LOAD_CHART_ATTRIBUTES. +METHOD load_chart_attributes. DATA: node TYPE REF TO if_ixml_element. DATA: node2 TYPE REF TO if_ixml_element. DATA: node3 TYPE REF TO if_ixml_element. @@ -424,6 +424,15 @@ method LOAD_CHART_ATTRIBUTES. zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). me->graph->ns_styleval = ls_prop-val. "---------------------------Read graph properties + "ADDED + CLEAR node2. + node2 ?= node->find_from_name( name = 'title' namespace = 'c' ). + IF node2 IS BOUND AND node2 IS NOT INITIAL. + node3 ?= node2->find_from_name( name = 't' namespace = 'a' ). + me->graph->title = node3->get_value( ). + ENDIF. + "END + node2 ?= node->find_from_name( name = 'autoTitleDeleted' namespace = 'c' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). me->graph->ns_autotitledeletedval = ls_prop-val. @@ -781,13 +790,13 @@ method LOAD_CHART_ATTRIBUTES. ENDIF. CALL METHOD lo_linechart->create_serie EXPORTING - ip_idx = lv_idx - ip_order = lv_order - ip_symbol = lv_symbol - ip_smooth = lv_smooth - ip_lbl = lv_label - ip_ref = lv_value - ip_sername = lv_sername. + ip_idx = lv_idx + ip_order = lv_order + ip_symbol = lv_symbol + ip_smooth = lv_smooth + ip_lbl = lv_label + ip_ref = lv_value + ip_sername = lv_sername. lo_node = lo_iterator->get_next( ). IF lo_node IS BOUND. node2 ?= lo_node->query_interface( ixml_iid_element ). @@ -814,12 +823,12 @@ method LOAD_CHART_ATTRIBUTES. lo_linechart->ns_showbubblesizeval = ls_prop-val. node ?= node->find_from_name( name = 'lineChart' namespace = 'c' ). - node2 ?= node->find_from_name( name = 'marker' namespace = 'c' DEPTH = '1' ). + node2 ?= node->find_from_name( name = 'marker' namespace = 'c' depth = '1' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->NS_MARKERVAL = ls_prop-val. - node2 ?= node->find_from_name( name = 'smooth' namespace = 'c' DEPTH = '1' ). + lo_linechart->ns_markerval = ls_prop-val. + node2 ?= node->find_from_name( name = 'smooth' namespace = 'c' depth = '1' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->NS_SMOOTHVAL = ls_prop-val. + lo_linechart->ns_smoothval = ls_prop-val. node ?= ip_chart->if_ixml_node~get_first_child( ). CHECK node IS NOT INITIAL. @@ -1008,7 +1017,7 @@ method LOAD_CHART_ATTRIBUTES. me->graph->pagemargins = ls_pagemargins. - endmethod. +ENDMETHOD. method PIXEL2EMU. diff --git a/src/zcl_excel_graph.clas.abap b/src/zcl_excel_graph.clas.abap index f790ded..63de65d 100644 --- a/src/zcl_excel_graph.clas.abap +++ b/src/zcl_excel_graph.clas.abap @@ -34,18 +34,19 @@ public section. footer TYPE string, END OF s_pagemargins . - data NS_1904VAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " . - data NS_LANGVAL type STRING value 'it-IT'. "#EC NOTEXT . . . . . . . . . . " . - data NS_ROUNDEDCORNERSVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " . + data NS_1904VAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_LANGVAL type STRING value 'it-IT'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_ROUNDEDCORNERSVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " . data PAGEMARGINS type S_PAGEMARGINS . - data NS_AUTOTITLEDELETEDVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " . - data NS_PLOTVISONLYVAL type STRING value '1'. "#EC NOTEXT . . . . . . . . . . " . - data NS_DISPBLANKSASVAL type STRING value 'gap'. "#EC NOTEXT . . . . . . . . . . " . - data NS_SHOWDLBLSOVERMAXVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " . + data NS_AUTOTITLEDELETEDVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_PLOTVISONLYVAL type STRING value '1'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_DISPBLANKSASVAL type STRING value 'gap'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_SHOWDLBLSOVERMAXVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data TITLE type STRING . . . " . data SERIES type T_SERIES . - data NS_C14STYLEVAL type STRING value '102'. "#EC NOTEXT . . . . . . . . . . " . - data PRINT_LABEL type C value 'X'. "#EC NOTEXT . . . . . . . . . . " . - data NS_STYLEVAL type STRING value '2'. "#EC NOTEXT . . . . . . . . . . " . + data NS_C14STYLEVAL type STRING value '102'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data PRINT_LABEL type C value 'X'. "#EC NOTEXT . . . . . . . . . . . . . . " . + data NS_STYLEVAL type STRING value '2'. "#EC NOTEXT . . . . . . . . . . . . . . " . constants: BEGIN OF c_style_default, c14style type i value 102, @@ -317,6 +318,9 @@ public section. methods SET_PRINT_LBL importing !IP_VALUE type C . + methods SET_TITLE + importing + value(IP_VALUE) type STRING . protected section. *"* protected components of class ZCL_EXCEL_GRAPH *"* do not include other source files here!!! @@ -398,4 +402,9 @@ method SET_STYLE. me->ns_styleval = ip_style-cstyle. CONDENSE me->ns_styleval NO-GAPS. endmethod. + + +method SET_TITLE. + me->title = ip_value. +endmethod. ENDCLASS. diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index cb707aa..c39c374 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -1225,7 +1225,7 @@ method CREATE_RELATIONSHIPS. endmethod. -method CREATE_XL_CHARTS. +METHOD create_xl_charts. ** Constant node name @@ -1444,6 +1444,35 @@ method CREATE_XL_CHARTS. "---------------------------CHART lo_element = lo_document->create_simple_element( name = lc_xml_node_chart parent = lo_element_root ). + "Added + IF lo_chart->title IS NOT INITIAL. + lo_element2 = lo_document->create_simple_element( name = 'c:title' + parent = lo_element ). + lo_element3 = lo_document->create_simple_element( name = 'c:tx' + parent = lo_element2 ). + lo_element4 = lo_document->create_simple_element( name = 'c:rich' + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = 'a:bodyPr' + parent = lo_element4 ). + lo_element5 = lo_document->create_simple_element( name = 'a:lstStyle' + parent = lo_element4 ). + lo_element5 = lo_document->create_simple_element( name = 'a:p' + parent = lo_element4 ). + lo_element6 = lo_document->create_simple_element( name = 'a:pPr' + parent = lo_element5 ). + lo_element7 = lo_document->create_simple_element( name = 'a:defRPr' + parent = lo_element6 ). + lo_element6 = lo_document->create_simple_element( name = 'a:r' + parent = lo_element5 ). + lo_element7 = lo_document->create_simple_element( name = 'a:rPr' + parent = lo_element6 ). + lo_element7->set_attribute_ns( name = 'lang' + value = 'en-US' ). + lo_element7 = lo_document->create_simple_element( name = 'a:t' + parent = lo_element6 ). + lo_element7->set_value( value = lo_chart->title ). + ENDIF. + "End lo_element2 = lo_document->create_simple_element( name = lc_xml_node_autotitledeleted parent = lo_element ). lo_element2->set_attribute_ns( name = 'val' @@ -1883,11 +1912,11 @@ method CREATE_XL_CHARTS. lo_element4 = lo_document->create_simple_element( name = lc_xml_node_marker parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->NS_MARKERVAL ). + value = lo_chartl->ns_markerval ). lo_element4 = lo_document->create_simple_element( name = lc_xml_node_smooth parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->NS_SMOOTHVAL ). + value = lo_chartl->ns_smoothval ). "axes lo_el_rootchart = lo_element3. @@ -2130,7 +2159,7 @@ method CREATE_XL_CHARTS. lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). lo_renderer->render( ). - endmethod. +ENDMETHOD. method CREATE_XL_DRAWINGS. diff --git a/src/zdemo_excel39.prog.abap b/src/zdemo_excel39.prog.abap index 758584e..03f37de 100644 --- a/src/zdemo_excel39.prog.abap +++ b/src/zdemo_excel39.prog.abap @@ -113,6 +113,7 @@ START-OF-SELECTION. " Set style lo_bar1->set_style( zcl_excel_graph=>c_style_default ). + lo_bar1->set_title( ip_value = 'TITLE!' ). " Set label to none lo_bar1->set_print_lbl( zcl_excel_graph_bars=>c_show_false ).