diff --git a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk b/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk index b86eab9..8fa8482 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk @@ -11,6 +11,7 @@ public section. type-pools ABAP . constants C_GRAPH_PIE type ZEXCEL_GRAPH_TYPE value '1'. "#EC NOTEXT + constants C_GRAPH_LINE type ZEXCEL_GRAPH_TYPE value '2'. "#EC NOTEXT constants C_GRAPH_BARS type ZEXCEL_GRAPH_TYPE value '0'. "#EC NOTEXT data GRAPH_TYPE type ZEXCEL_GRAPH_TYPE . data TITLE type STRING value 'image1.jpg'. "#EC NOTEXT . @@ -144,37 +145,38 @@ protected section. *"* in the implementation part of the class ABAP - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -371,6 +373,7 @@ endmethod. DATA lo_barchart TYPE REF TO zcl_excel_graph_bars. DATA lo_piechart TYPE REF TO zcl_excel_graph_pie. + DATA lo_linechart TYPE REF TO zcl_excel_graph_line. TYPES: BEGIN OF t_prop, val TYPE string, @@ -398,6 +401,8 @@ endmethod. DATA lv_idx TYPE i. DATA lv_order TYPE i. DATA lv_invertifnegative TYPE string. + DATA lv_symbol TYPE string. + DATA lv_smooth TYPE c. DATA lv_sername TYPE string. DATA lv_label TYPE string. DATA lv_value TYPE string. @@ -428,6 +433,9 @@ endmethod. WHEN c_graph_pie. CREATE OBJECT lo_piechart. me->graph = lo_piechart. + WHEN c_graph_line. + CREATE OBJECT lo_linechart. + me->graph = lo_linechart. WHEN OTHERS. ENDCASE. @@ -755,6 +763,233 @@ endmethod. node2 ?= node->find_from_name( name = 'firstSliceAng' namespace = 'c' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). lo_piechart->ns_firstsliceangval = ls_prop-val. + WHEN c_graph_line. + node2 ?= node->find_from_name( name = 'grouping' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_groupingval = ls_prop-val. + node2 ?= node->find_from_name( name = 'varyColors' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_varycolorsval = ls_prop-val. + + "Load series + CALL METHOD node->get_elements_by_tag_name + EXPORTING +* depth = 0 + name = 'ser' +* namespace = '' + RECEIVING + rval = lo_collection. + CALL METHOD lo_collection->create_iterator + RECEIVING + rval = lo_iterator. + lo_node = lo_iterator->get_next( ). + IF lo_node IS BOUND. + node2 ?= lo_node->query_interface( ixml_iid_element ). + ENDIF. + WHILE lo_node IS BOUND. + node3 ?= node2->find_from_name( name = 'idx' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_idx = ls_prop-val. + node3 ?= node2->find_from_name( name = 'order' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_order = ls_prop-val. + node3 ?= node2->find_from_name( name = 'symbol' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_symbol = ls_prop-val. + node3 ?= node2->find_from_name( name = 'smooth' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_smooth = ls_prop-val. + node3 ?= node2->find_from_name( name = 'v' namespace = 'c' ). + IF node3 IS BOUND. + lv_sername = node3->get_value( ). + ENDIF. + node3 ?= node2->find_from_name( name = 'strRef' namespace = 'c' ). + IF node3 IS BOUND. + node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). + lv_label = node4->get_value( ). + ENDIF. + node3 ?= node2->find_from_name( name = 'numRef' namespace = 'c' ). + IF node3 IS BOUND. + node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). + lv_value = node4->get_value( ). + 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. + lo_node = lo_iterator->get_next( ). + IF lo_node IS BOUND. + node2 ?= lo_node->query_interface( ixml_iid_element ). + ENDIF. + ENDWHILE. + "note: numCache avoided + node2 ?= node->find_from_name( name = 'showLegendKey' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_showlegendkeyval = ls_prop-val. + node2 ?= node->find_from_name( name = 'showVal' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_showvalval = ls_prop-val. + node2 ?= node->find_from_name( name = 'showCatName' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_showcatnameval = ls_prop-val. + node2 ?= node->find_from_name( name = 'showSerName' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_showsernameval = ls_prop-val. + node2 ?= node->find_from_name( name = 'showPercent' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_showpercentval = ls_prop-val. + node2 ?= node->find_from_name( name = 'showBubbleSize' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + 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' ). + 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' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->NS_SMOOTHVAL = ls_prop-val. + node ?= ip_chart->if_ixml_node~get_first_child( ). + CHECK node IS NOT INITIAL. + + "Load axes + node2 ?= node->find_from_name( name = 'lineChart' namespace = 'c' ). + CALL METHOD node2->get_elements_by_tag_name + EXPORTING +* depth = 0 + name = 'axId' +* namespace = '' + RECEIVING + rval = lo_collection. + CALL METHOD lo_collection->create_iterator + RECEIVING + rval = lo_iterator. + lo_node = lo_iterator->get_next( ). + IF lo_node IS BOUND. + node2 ?= lo_node->query_interface( ixml_iid_element ). + ENDIF. + WHILE lo_node IS BOUND. + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lv_axid = ls_prop-val. + IF sy-index EQ 1. "catAx + node2 ?= node->find_from_name( name = 'catAx' namespace = 'c' ). + node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_orientation = ls_prop-val. + node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_delete = ls_prop-val. + node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_axpos = ls_prop-val. +* node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). +* zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). +* lv_formatcode = ls_prop-formatcode. +* lv_sourcelinked = ls_prop-sourcelinked. + node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_majortickmark = ls_prop-val. + node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_minortickmark = ls_prop-val. + node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_ticklblpos = ls_prop-val. + node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_crossax = ls_prop-val. + node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_crosses = ls_prop-val. + node3 ?= node2->find_from_name( name = 'auto' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_auto = ls_prop-val. + node3 ?= node2->find_from_name( name = 'lblAlgn' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_lblalgn = ls_prop-val. + node3 ?= node2->find_from_name( name = 'lblOffset' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_lbloffset = ls_prop-val. + node3 ?= node2->find_from_name( name = 'noMultiLvlLbl' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_nomultilvllbl = ls_prop-val. + CALL METHOD lo_linechart->create_ax + EXPORTING + ip_axid = lv_axid + ip_type = zcl_excel_graph_line=>c_catax + ip_orientation = lv_orientation + ip_delete = lv_delete + ip_axpos = lv_axpos + ip_formatcode = lv_formatcode + ip_sourcelinked = lv_sourcelinked + ip_majortickmark = lv_majortickmark + ip_minortickmark = lv_minortickmark + ip_ticklblpos = lv_ticklblpos + ip_crossax = lv_crossax + ip_crosses = lv_crosses + ip_auto = lv_auto + ip_lblalgn = lv_lblalgn + ip_lbloffset = lv_lbloffset + ip_nomultilvllbl = lv_nomultilvllbl. + ELSEIF sy-index EQ 2. "valAx + node2 ?= node->find_from_name( name = 'valAx' namespace = 'c' ). + node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_orientation = ls_prop-val. + node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_delete = ls_prop-val. + node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_axpos = ls_prop-val. + node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_formatcode = ls_prop-formatcode. + lv_sourcelinked = ls_prop-sourcelinked. + node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_majortickmark = ls_prop-val. + node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_minortickmark = ls_prop-val. + node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_ticklblpos = ls_prop-val. + node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_crossax = ls_prop-val. + node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_crosses = ls_prop-val. + node3 ?= node2->find_from_name( name = 'crossBetween' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). + lv_crossbetween = ls_prop-val. + CALL METHOD lo_linechart->create_ax + EXPORTING + ip_axid = lv_axid + ip_type = zcl_excel_graph_line=>c_valax + ip_orientation = lv_orientation + ip_delete = lv_delete + ip_axpos = lv_axpos + ip_formatcode = lv_formatcode + ip_sourcelinked = lv_sourcelinked + ip_majortickmark = lv_majortickmark + ip_minortickmark = lv_minortickmark + ip_ticklblpos = lv_ticklblpos + ip_crossax = lv_crossax + ip_crosses = lv_crosses + ip_crossbetween = lv_crossbetween. + ENDIF. + lo_node = lo_iterator->get_next( ). + IF lo_node IS BOUND. + node2 ?= lo_node->query_interface( ixml_iid_element ). + ENDIF. + ENDWHILE. WHEN OTHERS. ENDCASE. @@ -763,10 +998,17 @@ endmethod. WHEN c_graph_bars. node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_legendposval = ls_prop-val. + lo_barchart->ns_legendposval = ls_prop-val. node2 ?= node->find_from_name( name = 'overlay' namespace = 'c' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_overlayval = ls_prop-val. + lo_barchart->ns_overlayval = ls_prop-val. + WHEN c_graph_line. + node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_legendposval = ls_prop-val. + node2 ?= node->find_from_name( name = 'overlay' namespace = 'c' ). + zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). + lo_linechart->ns_overlayval = ls_prop-val. WHEN c_graph_pie. node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). @@ -780,6 +1022,7 @@ endmethod. node2 ?= node->find_from_name( name = 'endParaRPr' namespace = 'a' ). zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). lo_piechart->ns_endpararprlang = ls_prop-lang. + WHEN OTHERS. ENDCASE. diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk index 2fb0c11..60b2b17 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk @@ -5,18 +5,20 @@ cstyle type i, end of s_style "/> - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + method CONSTRUCTOR. @@ -612,18 +631,20 @@ endmethod. - - - - - - - - - - - - + + + + + + + + + + + + + + METHOD create_serie. DATA ls_serie TYPE s_series. @@ -662,10 +683,18 @@ endmethod. ls_serie-idx = ip_idx. ls_serie-order = ip_order. ls_serie-invertifnegative = ip_invertifnegative. + ls_serie-symbol = ip_symbol. + ls_serie-smooth = ip_smooth. ls_serie-sername = ip_sername. APPEND ls_serie TO me->series. SORT me->series BY order ASCENDING. ENDMETHOD. + + + + method SET_PRINT_LBL. + me->print_label = ip_value. +endmethod. diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk index a4f02b7..bb3187c 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk @@ -93,29 +93,31 @@ public section. !IP_LBLALGN type STRING optional !IP_LBLOFFSET type STRING optional !IP_NOMULTILVLLBL type STRING optional - !IP_CROSSBETWEEN type STRING optional . + !IP_CROSSBETWEEN type STRING optional . + methods SET_SHOW_LEGEND_KEY + importing + !IP_VALUE type C . + methods SET_SHOW_VALUES + importing + !IP_VALUE type C . + methods SET_SHOW_CAT_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_SER_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_PERCENT + importing + !IP_VALUE type C . + methods SET_VARYCOLOR + importing + !IP_VALUE type C . protected section. *"* protected components of class ZCL_EXCEL_GRAPH_BARS *"* do not include other source files here!!! private section. *"* private components of class ZCL_EXCEL_GRAPH_BARS -*"* do not include other source files here!!! - - methods SET_SHOW_LEGEND_KEY - importing - !IP_VALUE type CHAR1 . - methods SET_SHOW_VALUES - importing - !IP_VALUE type CHAR1 . - methods SET_SHOW_CAT_NAME - importing - !IP_VALUE type CHAR1 . - methods SET_SHOW_SER_NAME - importing - !IP_VALUE type CHAR1 . - methods SET_SHOW_PERCENT - importing - !IP_VALUE type CHAR1 . +*"* do not include other source files here!!! *"* use this source file for the definition and implementation of *"* local helper classes, interface definitions and type *"* declarations @@ -309,34 +311,40 @@ public section. sort me->axes by axid ascending. ENDMETHOD. - - + + METHOD set_show_cat_name. ns_showcatnameval = ip_value. ENDMETHOD. - - + + METHOD set_show_legend_key. ns_showlegendkeyval = ip_value. ENDMETHOD. - - + + METHOD set_show_percent. ns_showpercentval = ip_value. ENDMETHOD. - - + + METHOD set_show_ser_name. ns_showsernameval = ip_value. ENDMETHOD. - - + + METHOD set_show_values. ns_showvalval = ip_value. +ENDMETHOD. + + + + METHOD set_varycolor. + ns_varycolorsval = ip_value. ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk new file mode 100644 index 0000000..56ca13c --- /dev/null +++ b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk @@ -0,0 +1,350 @@ + + + + + class ZCL_EXCEL_GRAPH_LINE definition + public + inheriting from ZCL_EXCEL_GRAPH + final + create public . + +public section. +*"* public components of class ZCL_EXCEL_GRAPH_LINE +*"* do not include other source files here!!! + + types: + BEGIN OF s_ax, + axid TYPE string, + type TYPE char5, + orientation TYPE string, + delete TYPE string, + axpos TYPE string, + formatcode TYPE string, + sourcelinked TYPE string, + majortickmark TYPE string, + minortickmark TYPE string, + ticklblpos TYPE string, + crossax TYPE string, + crosses TYPE string, + auto TYPE string, + lblalgn TYPE string, + lbloffset TYPE string, + nomultilvllbl TYPE string, + crossbetween TYPE string, + END OF s_ax . + types: + t_ax TYPE STANDARD TABLE OF s_ax . + + data NS_GROUPINGVAL type STRING value 'standard'. "#EC NOTEXT . + data NS_VARYCOLORSVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWLEGENDKEYVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWVALVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWCATNAMEVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWSERNAMEVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWPERCENTVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWBUBBLESIZEVAL type STRING value '0'. "#EC NOTEXT . + data NS_MARKERVAL type STRING value '1'. "#EC NOTEXT . + data NS_SMOOTHVAL type STRING value '0'. "#EC NOTEXT . + data AXES type T_AX . + constants: + C_VALAX type c length 5 value 'VALAX'. "#EC NOTEXT + constants: + C_CATAX type c length 5 value 'CATAX'. "#EC NOTEXT + data NS_LEGENDPOSVAL type STRING value 'r'. "#EC NOTEXT . + data NS_OVERLAYVAL type STRING value '0'. "#EC NOTEXT . + constants C_SYMBOL_AUTO type STRING value 'auto'. "#EC NOTEXT + constants C_SYMBOL_NONE type STRING value 'none'. "#EC NOTEXT + + methods CREATE_AX + importing + !IP_AXID type STRING optional + !IP_TYPE type CHAR5 + !IP_ORIENTATION type STRING optional + !IP_DELETE type STRING optional + !IP_AXPOS type STRING optional + !IP_FORMATCODE type STRING optional + !IP_SOURCELINKED type STRING optional + !IP_MAJORTICKMARK type STRING optional + !IP_MINORTICKMARK type STRING optional + !IP_TICKLBLPOS type STRING optional + !IP_CROSSAX type STRING optional + !IP_CROSSES type STRING optional + !IP_AUTO type STRING optional + !IP_LBLALGN type STRING optional + !IP_LBLOFFSET type STRING optional + !IP_NOMULTILVLLBL type STRING optional + !IP_CROSSBETWEEN type STRING optional . + methods SET_SHOW_LEGEND_KEY + importing + !IP_VALUE type C . + methods SET_SHOW_VALUES + importing + !IP_VALUE type C . + methods SET_SHOW_CAT_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_SER_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_PERCENT + importing + !IP_VALUE type C . + methods SET_VARYCOLOR + importing + !IP_VALUE type C . + protected section. +*"* protected components of class ZCL_EXCEL_GRAPH_LINE +*"* do not include other source files here!!! + private section. +*"* private components of class ZCL_EXCEL_GRAPH_LINE +*"* do not include other source files here!!! + *"* use this source file for the definition and implementation of +*"* local helper classes, interface definitions and type +*"* declarations + *"* use this source file for any type of declarations (class +*"* definitions, interfaces or type declarations) you need for +*"* components in the private section + *"* use this source file for any macro definitions you need +*"* in the implementation part of the class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + METHOD create_ax. + DATA ls_ax TYPE s_ax. + ls_ax-type = ip_type. + + IF ip_type = c_catax. + IF ip_axid IS SUPPLIED. + ls_ax-axid = ip_axid. + ELSE. + ls_ax-axid = '1'. + ENDIF. + IF ip_orientation IS SUPPLIED. + ls_ax-orientation = ip_orientation. + ELSE. + ls_ax-orientation = 'minMax'. + ENDIF. + IF ip_delete IS SUPPLIED. + ls_ax-delete = ip_delete. + ELSE. + ls_ax-delete = '0'. + ENDIF. + IF ip_axpos IS SUPPLIED. + ls_ax-axpos = ip_axpos. + ELSE. + ls_ax-axpos = 'b'. + ENDIF. + IF ip_formatcode IS SUPPLIED. + ls_ax-formatcode = ip_formatcode. + ELSE. + ls_ax-formatcode = 'General'. + ENDIF. + IF ip_sourcelinked IS SUPPLIED. + ls_ax-sourcelinked = ip_sourcelinked. + ELSE. + ls_ax-sourcelinked = '1'. + ENDIF. + IF ip_majortickmark IS SUPPLIED. + ls_ax-majortickmark = ip_majortickmark. + ELSE. + ls_ax-majortickmark = 'out'. + ENDIF. + IF ip_minortickmark IS SUPPLIED. + ls_ax-minortickmark = ip_minortickmark. + ELSE. + ls_ax-minortickmark = 'none'. + ENDIF. + IF ip_ticklblpos IS SUPPLIED. + ls_ax-ticklblpos = ip_ticklblpos. + ELSE. + ls_ax-ticklblpos = 'nextTo'. + ENDIF. + IF ip_crossax IS SUPPLIED. + ls_ax-crossax = ip_crossax. + ELSE. + ls_ax-crossax = '2'. + ENDIF. + IF ip_crosses IS SUPPLIED. + ls_ax-crosses = ip_crosses. + ELSE. + ls_ax-crosses = 'autoZero'. + ENDIF. + IF ip_auto IS SUPPLIED. + ls_ax-auto = ip_auto. + ELSE. + ls_ax-auto = '1'. + ENDIF. + IF ip_lblalgn IS SUPPLIED. + ls_ax-lblalgn = ip_lblalgn. + ELSE. + ls_ax-lblalgn = 'ctr'. + ENDIF. + IF ip_lbloffset IS SUPPLIED. + ls_ax-lbloffset = ip_lbloffset. + ELSE. + ls_ax-lbloffset = '100'. + ENDIF. + IF ip_nomultilvllbl IS SUPPLIED. + ls_ax-nomultilvllbl = ip_nomultilvllbl. + ELSE. + ls_ax-nomultilvllbl = '0'. + ENDIF. + ELSEIF ip_type = c_valax. + IF ip_axid IS SUPPLIED. + ls_ax-axid = ip_axid. + ELSE. + ls_ax-axid = '2'. + ENDIF. + IF ip_orientation IS SUPPLIED. + ls_ax-orientation = ip_orientation. + ELSE. + ls_ax-orientation = 'minMax'. + ENDIF. + IF ip_delete IS SUPPLIED. + ls_ax-delete = ip_delete. + ELSE. + ls_ax-delete = '0'. + ENDIF. + IF ip_axpos IS SUPPLIED. + ls_ax-axpos = ip_axpos. + ELSE. + ls_ax-axpos = 'l'. + ENDIF. + IF ip_formatcode IS SUPPLIED. + ls_ax-formatcode = ip_formatcode. + ELSE. + ls_ax-formatcode = 'General'. + ENDIF. + IF ip_sourcelinked IS SUPPLIED. + ls_ax-sourcelinked = ip_sourcelinked. + ELSE. + ls_ax-sourcelinked = '1'. + ENDIF. + IF ip_majortickmark IS SUPPLIED. + ls_ax-majortickmark = ip_majortickmark. + ELSE. + ls_ax-majortickmark = 'out'. + ENDIF. + IF ip_minortickmark IS SUPPLIED. + ls_ax-minortickmark = ip_minortickmark. + ELSE. + ls_ax-minortickmark = 'none'. + ENDIF. + IF ip_ticklblpos IS SUPPLIED. + ls_ax-ticklblpos = ip_ticklblpos. + ELSE. + ls_ax-ticklblpos = 'nextTo'. + ENDIF. + IF ip_crossax IS SUPPLIED. + ls_ax-crossax = ip_crossax. + ELSE. + ls_ax-crossax = '1'. + ENDIF. + IF ip_crosses IS SUPPLIED. + ls_ax-crosses = ip_crosses. + ELSE. + ls_ax-crosses = 'autoZero'. + ENDIF. + IF ip_crossbetween IS SUPPLIED. + ls_ax-crossbetween = ip_crossbetween. + ELSE. + ls_ax-crossbetween = 'between'. + ENDIF. + ENDIF. + + APPEND ls_ax TO me->axes. + SORT me->axes BY axid ASCENDING. +ENDMETHOD. + + + + METHOD SET_SHOW_CAT_NAME. + ns_showcatnameval = ip_value. +ENDMETHOD. + + + + METHOD SET_SHOW_LEGEND_KEY. + ns_showlegendkeyval = ip_value. +ENDMETHOD. + + + + METHOD SET_SHOW_PERCENT. + ns_showpercentval = ip_value. +ENDMETHOD. + + + + METHOD SET_SHOW_SER_NAME. + ns_showsernameval = ip_value. +ENDMETHOD. + + + + METHOD SET_SHOW_VALUES. + ns_showvalval = ip_value. +ENDMETHOD. + + + + METHOD set_varycolor. + ns_varycolorsval = ip_value. +ENDMETHOD. + + diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk index 8fe7e1e..edc09e1 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk @@ -1,54 +1,50 @@ - *----------------------------------------------------------------------* -* CLASS ZCL_EXCEL_GRAPH_PIE DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS zcl_excel_graph_pie DEFINITION - PUBLIC - INHERITING FROM zcl_excel_graph - FINAL - CREATE PUBLIC . + class ZCL_EXCEL_GRAPH_PIE definition + public + inheriting from ZCL_EXCEL_GRAPH + final + create public . - PUBLIC SECTION. +public section. *"* public components of class ZCL_EXCEL_GRAPH_PIE *"* do not include other source files here!!! - DATA ns_legendposval TYPE string VALUE 'r'. "#EC NOTEXT . - DATA ns_overlayval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_pprrtl TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_endpararprlang TYPE string VALUE 'it-IT'. "#EC NOTEXT . - DATA ns_varycolorsval TYPE string VALUE '1'. "#EC NOTEXT . - DATA ns_firstsliceangval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showlegendkeyval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showvalval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showcatnameval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showsernameval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showpercentval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showbubblesizeval TYPE string VALUE '0'. "#EC NOTEXT . - DATA ns_showleaderlinesval TYPE string VALUE '1'. "#EC NOTEXT . - CONSTANTS c_show_true TYPE char1 VALUE '1'. "#EC NOTEXT - CONSTANTS c_show_false TYPE char1 VALUE '0'. "#EC NOTEXT + data NS_LEGENDPOSVAL type STRING value 'r'. "#EC NOTEXT . + data NS_OVERLAYVAL type STRING value '0'. "#EC NOTEXT . + data NS_PPRRTL type STRING value '0'. "#EC NOTEXT . + data NS_ENDPARARPRLANG type STRING value 'it-IT'. "#EC NOTEXT . + data NS_VARYCOLORSVAL type STRING value '1'. "#EC NOTEXT . + data NS_FIRSTSLICEANGVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWLEGENDKEYVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWVALVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWCATNAMEVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWSERNAMEVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWPERCENTVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWBUBBLESIZEVAL type STRING value '0'. "#EC NOTEXT . + data NS_SHOWLEADERLINESVAL type STRING value '1'. "#EC NOTEXT . - METHODS set_show_legend_key - IMPORTING - !ip_value TYPE char1 . - METHODS set_show_values - IMPORTING - !ip_value TYPE char1 . - METHODS set_show_cat_name - IMPORTING - !ip_value TYPE char1 . - METHODS set_show_ser_name - IMPORTING - !ip_value TYPE char1 . - METHODS set_show_percent - IMPORTING - !ip_value TYPE char1 . - METHODS set_show_leader_lines - IMPORTING - !ip_value TYPE char1 . + methods SET_SHOW_LEGEND_KEY + importing + !IP_VALUE type C . + methods SET_SHOW_VALUES + importing + !IP_VALUE type C . + methods SET_SHOW_CAT_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_SER_NAME + importing + !IP_VALUE type C . + methods SET_SHOW_PERCENT + importing + !IP_VALUE type C . + methods SET_SHOW_LEADER_LINES + importing + !IP_VALUE type C . + methods SET_VARYCOLOR + importing + !IP_VALUE type C . protected section. *"* protected components of class ZCL_EXCEL_GRAPH_PIE *"* do not include other source files here!!! @@ -63,8 +59,6 @@ CLASS zcl_excel_graph_pie DEFINITION *"* components in the private section *"* use this source file for any macro definitions you need *"* in the implementation part of the class - - @@ -80,39 +74,45 @@ CLASS zcl_excel_graph_pie DEFINITION - + METHOD set_show_cat_name. ns_showcatnameval = ip_value. ENDMETHOD. - + METHOD set_show_leader_lines. ns_showleaderlinesval = ip_value. ENDMETHOD. - + METHOD set_show_legend_key. ns_showlegendkeyval = ip_value. ENDMETHOD. - + METHOD set_show_percent. ns_showpercentval = ip_value. ENDMETHOD. - + METHOD set_show_ser_name. ns_showsernameval = ip_value. ENDMETHOD. - + METHOD set_show_values. ns_showvalval = ip_value. +ENDMETHOD. + + + + METHOD set_varycolor. + ns_varycolorsval = ip_value. ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk index 427a6d2..ba3135b 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk @@ -1135,31 +1135,37 @@ endmethod. lc_xml_node_piechart TYPE string VALUE 'c:pieChart', lc_xml_node_showleaderlines TYPE string VALUE 'c:showLeaderLines', lc_xml_node_firstsliceang TYPE string VALUE 'c:firstSliceAng', + "plotArea->line + lc_xml_node_linechart TYPE string VALUE 'c:lineChart', + lc_xml_node_symbol TYPE string VALUE 'c:symbol', + lc_xml_node_marker TYPE string VALUE 'c:marker', + lc_xml_node_smooth TYPE string VALUE 'c:smooth', "plotArea->bar - lc_xml_node_invertIfNegative TYPE string VALUE 'c:invertIfNegative', + lc_xml_node_invertifnegative TYPE string VALUE 'c:invertIfNegative', lc_xml_node_barchart TYPE string VALUE 'c:barChart', lc_xml_node_bardir TYPE string VALUE 'c:barDir', - lc_xml_node_grouping TYPE string VALUE 'c:grouping', lc_xml_node_gapwidth TYPE string VALUE 'c:gapwidth', - lc_xml_node_axId TYPE string VALUE 'c:axId', + "plotArea->line + plotArea->bar + lc_xml_node_grouping TYPE string VALUE 'c:grouping', + lc_xml_node_axid TYPE string VALUE 'c:axId', lc_xml_node_catax TYPE string VALUE 'c:catAx', lc_xml_node_valax TYPE string VALUE 'c:valAx', lc_xml_node_scaling TYPE string VALUE 'c:scaling', lc_xml_node_orientation TYPE string VALUE 'c:orientation', lc_xml_node_delete TYPE string VALUE 'c:delete', - lc_xml_node_axPos TYPE string VALUE 'c:axPos', - lc_xml_node_numFmt TYPE string VALUE 'c:numFmt', - lc_xml_node_majorGridlines TYPE string VALUE 'c:majorGridlines', - lc_xml_node_majorTickMark TYPE string VALUE 'c:majorTickMark', - lc_xml_node_minorTickMark TYPE string VALUE 'c:minorTickMark', - lc_xml_node_tickLblPos TYPE string VALUE 'c:tickLblPos', - lc_xml_node_crossAx TYPE string VALUE 'c:crossAx', + lc_xml_node_axpos TYPE string VALUE 'c:axPos', + lc_xml_node_numfmt TYPE string VALUE 'c:numFmt', + lc_xml_node_majorgridlines TYPE string VALUE 'c:majorGridlines', + lc_xml_node_majortickmark TYPE string VALUE 'c:majorTickMark', + lc_xml_node_minortickmark TYPE string VALUE 'c:minorTickMark', + lc_xml_node_ticklblpos TYPE string VALUE 'c:tickLblPos', + lc_xml_node_crossax TYPE string VALUE 'c:crossAx', lc_xml_node_crosses TYPE string VALUE 'c:crosses', lc_xml_node_auto TYPE string VALUE 'c:auto', - lc_xml_node_lblAlgn TYPE string VALUE 'c:lblAlgn', - lc_xml_node_lblOffset TYPE string VALUE 'c:lblOffset', - lc_xml_node_noMultiLvlLbl TYPE string VALUE 'c:noMultiLvlLbl', - lc_xml_node_crossBetween TYPE string VALUE 'c:crossBetween', + lc_xml_node_lblalgn TYPE string VALUE 'c:lblAlgn', + lc_xml_node_lbloffset TYPE string VALUE 'c:lblOffset', + lc_xml_node_nomultilvllbl TYPE string VALUE 'c:noMultiLvlLbl', + lc_xml_node_crossbetween TYPE string VALUE 'c:crossBetween', "legend lc_xml_node_legend TYPE string VALUE 'c:legend', "legend->pie @@ -1173,10 +1179,10 @@ endmethod. lc_xml_node_ppr TYPE string VALUE 'a:pPr', lc_xml_node_defrpr TYPE string VALUE 'a:defRPr', lc_xml_node_endpararpr TYPE string VALUE 'a:endParaRPr', - "legend->bar - lc_xml_node_plotvisonly TYPE string VALUE 'c:plotVisOnly', - lc_xml_node_dispblanksas TYPE string VALUE 'c:dispBlanksAs', - lc_xml_node_showdlblsovermax TYPE string VALUE 'c:showDLblsOverMax', + "legend->bar + legend->line + lc_xml_node_plotvisonly TYPE string VALUE 'c:plotVisOnly', + lc_xml_node_dispblanksas TYPE string VALUE 'c:dispBlanksAs', + lc_xml_node_showdlblsovermax TYPE string VALUE 'c:showDLblsOverMax', "---------------------------END OF CHART lc_xml_node_printsettings TYPE string VALUE 'c:printSettings', @@ -1198,7 +1204,7 @@ endmethod. DATA lo_element TYPE REF TO if_ixml_element. DATA lo_element2 TYPE REF TO if_ixml_element. DATA lo_element3 TYPE REF TO if_ixml_element. - DATA lo_el_barchart TYPE REF TO if_ixml_element. + DATA lo_el_rootchart TYPE REF TO if_ixml_element. DATA lo_element4 TYPE REF TO if_ixml_element. DATA lo_element5 TYPE REF TO if_ixml_element. DATA lo_element6 TYPE REF TO if_ixml_element. @@ -1232,11 +1238,12 @@ endmethod. DATA lo_chartb TYPE REF TO zcl_excel_graph_bars. DATA lo_chartp TYPE REF TO zcl_excel_graph_pie. + DATA lo_chartl TYPE REF TO zcl_excel_graph_line. DATA lo_chart TYPE REF TO zcl_excel_graph. - data ls_serie type zcl_excel_graph=>s_series. - data ls_ax type zcl_excel_graph_bars=>s_ax. - data lv_str type string. + DATA ls_serie TYPE zcl_excel_graph=>s_series. + DATA ls_ax TYPE zcl_excel_graph_bars=>s_ax. + DATA lv_str TYPE string. "Identify chart type CASE io_drawing->graph_type. @@ -1244,9 +1251,8 @@ endmethod. lo_chartb ?= io_drawing->graph. WHEN zcl_excel_drawing=>c_graph_pie. lo_chartp ?= io_drawing->graph. - - - + WHEN zcl_excel_drawing=>c_graph_line. + lo_chartl ?= io_drawing->graph. WHEN OTHERS. ENDCASE. @@ -1329,36 +1335,36 @@ endmethod. value = lo_chartb->ns_varycolorsval ). "series - loop at lo_chartb->SERIES into ls_serie. + LOOP AT lo_chartb->series INTO ls_serie. lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser parent = lo_element3 ). lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx parent = lo_element4 ). - if ls_serie-idx is not initial. + IF ls_serie-idx IS NOT INITIAL. lv_str = ls_serie-idx. - else. - lv_str = sy-index. - endif. - condense lv_str. + ELSE. + lv_str = sy-tabix - 1. + ENDIF. + CONDENSE lv_str. lo_element5->set_attribute_ns( name = 'val' value = lv_str ). lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order parent = lo_element4 ). lv_str = ls_serie-order. - condense lv_str. + CONDENSE lv_str. lo_element5->set_attribute_ns( name = 'val' value = lv_str ). - if ls_serie-sername is not initial. + IF ls_serie-sername IS NOT INITIAL. lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx parent = lo_element4 ). lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v parent = lo_element5 ). lo_element6->set_value( value = ls_serie-sername ). - endif. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_invertIfNegative + ENDIF. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_invertifnegative parent = lo_element4 ). lo_element5->set_attribute_ns( name = 'val' - value = ls_serie-invertIfNegative ). + value = ls_serie-invertifnegative ). IF ls_serie-lbl IS NOT INITIAL. lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat parent = lo_element4 ). @@ -1377,7 +1383,7 @@ endmethod. parent = lo_element6 ). lo_element7->set_value( value = ls_serie-ref ). ENDIF. - endloop. + ENDLOOP. "endseries lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls @@ -1407,23 +1413,23 @@ endmethod. lo_element5->set_attribute_ns( name = 'val' value = lo_chartb->ns_showbubblesizeval ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_gapWidth + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_gapwidth parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = lo_chartb->ns_gapwidthval ). "axes - lo_el_barchart = lo_element3. - loop at lo_chartb->axes into ls_ax. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axId - parent = lo_el_barchart ). + lo_el_rootchart = lo_element3. + LOOP AT lo_chartb->axes INTO ls_ax. + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid + parent = lo_el_rootchart ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-axid ). CASE ls_ax-type. - WHEN zcl_excel_graph_bars=>C_CATAX. + WHEN zcl_excel_graph_bars=>c_catax. lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catax parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axId + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-axid ). @@ -1437,32 +1443,32 @@ endmethod. parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axPos + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axPos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numFmt + value = ls_ax-axpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'formatCode' - value = ls_ax-formatCode ). + value = ls_ax-formatcode ). lo_element4->set_attribute_ns( name = 'sourceLinked' - value = ls_ax-sourceLinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorTickMark + value = ls_ax-sourcelinked ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majorTickMark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minorTickMark + value = ls_ax-majortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minorTickMark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_tickLblPos + value = ls_ax-minortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-tickLblPos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossAx + value = ls_ax-ticklblpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossAx ). + value = ls_ax-crossax ). lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' @@ -1471,22 +1477,22 @@ endmethod. parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-auto ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblAlgn + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblalgn parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lblAlgn ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblOffset + value = ls_ax-lblalgn ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lbloffset parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lblOffset ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_noMultiLvlLbl + value = ls_ax-lbloffset ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_nomultilvllbl parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-noMultiLvlLbl ). - WHEN zcl_excel_graph_bars=>C_VALAX. + value = ls_ax-nomultilvllbl ). + WHEN zcl_excel_graph_bars=>c_valax. lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valax parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axId + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-axid ). @@ -1500,34 +1506,34 @@ endmethod. parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axPos + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axPos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorGridlines + value = ls_ax-axpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorgridlines parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numFmt + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'formatCode' - value = ls_ax-formatCode ). + value = ls_ax-formatcode ). lo_element4->set_attribute_ns( name = 'sourceLinked' - value = ls_ax-sourceLinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorTickMark + value = ls_ax-sourcelinked ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majorTickMark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minorTickMark + value = ls_ax-majortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minorTickMark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_tickLblPos + value = ls_ax-minortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-tickLblPos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossAx + value = ls_ax-ticklblpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossAx ). + value = ls_ax-crossax ). lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' @@ -1538,7 +1544,7 @@ endmethod. value = ls_ax-crossbetween ). WHEN OTHERS. ENDCASE. - endloop. + ENDLOOP. "endaxes WHEN zcl_excel_drawing=>c_graph_pie. @@ -1551,32 +1557,32 @@ endmethod. value = lo_chartp->ns_varycolorsval ). "series - loop at lo_chartp->SERIES into ls_serie. + LOOP AT lo_chartp->series INTO ls_serie. lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser parent = lo_element3 ). lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx parent = lo_element4 ). - if ls_serie-idx is not initial. + IF ls_serie-idx IS NOT INITIAL. lv_str = ls_serie-idx. - else. - lv_str = sy-index. - endif. - condense lv_str. + ELSE. + lv_str = sy-tabix - 1. + ENDIF. + CONDENSE lv_str. lo_element5->set_attribute_ns( name = 'val' value = lv_str ). lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order parent = lo_element4 ). lv_str = ls_serie-order. - condense lv_str. + CONDENSE lv_str. lo_element5->set_attribute_ns( name = 'val' value = lv_str ). - if ls_serie-sername is not initial. + IF ls_serie-sername IS NOT INITIAL. lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx parent = lo_element4 ). lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v parent = lo_element5 ). lo_element6->set_value( value = ls_serie-sername ). - endif. + ENDIF. IF ls_serie-lbl IS NOT INITIAL. lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat parent = lo_element4 ). @@ -1595,7 +1601,7 @@ endmethod. parent = lo_element6 ). lo_element7->set_value( value = ls_serie-ref ). ENDIF. - endloop. + ENDLOOP. "endseries lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls @@ -1632,57 +1638,307 @@ endmethod. parent = lo_element3 ). lo_element4->set_attribute_ns( name = 'val' value = lo_chartp->ns_firstsliceangval ). + WHEN zcl_excel_drawing=>c_graph_line. + "----line + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_linechart + parent = lo_element2 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_grouping + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = lo_chartl->ns_groupingval ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varycolors + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = lo_chartl->ns_varycolorsval ). + + "series + LOOP AT lo_chartl->series INTO ls_serie. + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx + parent = lo_element4 ). + IF ls_serie-idx IS NOT INITIAL. + lv_str = ls_serie-idx. + ELSE. + lv_str = sy-tabix - 1. + ENDIF. + CONDENSE lv_str. + lo_element5->set_attribute_ns( name = 'val' + value = lv_str ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order + parent = lo_element4 ). + lv_str = ls_serie-order. + CONDENSE lv_str. + lo_element5->set_attribute_ns( name = 'val' + value = lv_str ). + IF ls_serie-sername IS NOT INITIAL. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx + parent = lo_element4 ). + lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v + parent = lo_element5 ). + lo_element6->set_value( value = ls_serie-sername ). + ENDIF. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_marker + parent = lo_element4 ). + lo_element6 = lo_document->create_simple_element( name = lc_xml_node_symbol + parent = lo_element5 ). + lo_element6->set_attribute_ns( name = 'val' + value = ls_serie-symbol ). + IF ls_serie-lbl IS NOT INITIAL. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat + parent = lo_element4 ). + lo_element6 = lo_document->create_simple_element( name = lc_xml_node_strref + parent = lo_element5 ). + lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f + parent = lo_element6 ). + lo_element7->set_value( value = ls_serie-lbl ). + ENDIF. + IF ls_serie-ref IS NOT INITIAL. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_val + parent = lo_element4 ). + lo_element6 = lo_document->create_simple_element( name = lc_xml_node_numref + parent = lo_element5 ). + lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f + parent = lo_element6 ). + lo_element7->set_value( value = ls_serie-ref ). + ENDIF. + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_smooth + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = ls_serie-smooth ). + ENDLOOP. + "endseries + + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showlegendkey + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showlegendkeyval ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showval + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showvalval ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showcatname + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showcatnameval ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showsername + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showsernameval ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showpercent + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showpercentval ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showbubblesize + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = lo_chartl->ns_showbubblesizeval ). + + 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 ). + 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 ). + + "axes + lo_el_rootchart = lo_element3. + LOOP AT lo_chartl->axes INTO ls_ax. + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid + parent = lo_el_rootchart ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-axid ). + CASE ls_ax-type. + WHEN zcl_excel_graph_line=>c_catax. + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catax + parent = lo_element2 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-axid ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = ls_ax-orientation ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-delete ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-axpos ). +* lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt +* parent = lo_element3 ). +* lo_element4->set_attribute_ns( name = 'formatCode' +* value = ls_ax-formatcode ). +* lo_element4->set_attribute_ns( name = 'sourceLinked' +* value = ls_ax-sourcelinked ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-majortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-minortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-ticklblpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-crossax ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-crosses ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_auto + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-auto ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblalgn + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-lblalgn ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lbloffset + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-lbloffset ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_nomultilvllbl + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-nomultilvllbl ). + WHEN zcl_excel_graph_line=>c_valax. + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valax + parent = lo_element2 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-axid ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'val' + value = ls_ax-orientation ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-delete ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-axpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorgridlines + parent = lo_element3 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'formatCode' + value = ls_ax-formatcode ). + lo_element4->set_attribute_ns( name = 'sourceLinked' + value = ls_ax-sourcelinked ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-majortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-minortickmark ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-ticklblpos ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-crossax ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-crosses ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossbetween + parent = lo_element3 ). + lo_element4->set_attribute_ns( name = 'val' + value = ls_ax-crossbetween ). + WHEN OTHERS. + ENDCASE. + ENDLOOP. + "endaxes + WHEN OTHERS. ENDCASE. "legend - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_legend - parent = lo_element ). - CASE io_drawing->graph_type. - WHEN zcl_excel_drawing=>c_graph_bars. - "----bar - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartb->ns_legendposval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartb->ns_overlayval ). - WHEN zcl_excel_drawing=>c_graph_pie. - "----pie - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartp->ns_legendposval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartp->ns_overlayval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_txpr - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_bodypr - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lststyle - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_p - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_ppr - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'rtl' - value = lo_chartp->ns_pprrtl ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_defrpr - parent = lo_element5 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_endpararpr - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'lang' - value = lo_chartp->ns_endpararprlang ). - WHEN OTHERS. - ENDCASE. + IF lo_chart->print_label EQ abap_true. + lo_element2 = lo_document->create_simple_element( name = lc_xml_node_legend + parent = lo_element ). + CASE io_drawing->graph_type. + WHEN zcl_excel_drawing=>c_graph_bars. + "----bar + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartb->ns_legendposval ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout + parent = lo_element2 ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartb->ns_overlayval ). + WHEN zcl_excel_drawing=>c_graph_line. + "----line + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartl->ns_legendposval ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout + parent = lo_element2 ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartl->ns_overlayval ). + WHEN zcl_excel_drawing=>c_graph_pie. + "----pie + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartp->ns_legendposval ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout + parent = lo_element2 ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay + parent = lo_element2 ). + lo_element3->set_attribute_ns( name = 'val' + value = lo_chartp->ns_overlayval ). + lo_element3 = lo_document->create_simple_element( name = lc_xml_node_txpr + parent = lo_element2 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_bodypr + parent = lo_element3 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lststyle + parent = lo_element3 ). + lo_element4 = lo_document->create_simple_element( name = lc_xml_node_p + parent = lo_element3 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_ppr + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'rtl' + value = lo_chartp->ns_pprrtl ). + lo_element6 = lo_document->create_simple_element( name = lc_xml_node_defrpr + parent = lo_element5 ). + lo_element5 = lo_document->create_simple_element( name = lc_xml_node_endpararpr + parent = lo_element4 ). + lo_element5->set_attribute_ns( name = 'lang' + value = lo_chartp->ns_endpararprlang ). + WHEN OTHERS. + ENDCASE. + ENDIF. lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotvisonly parent = lo_element ). diff --git a/ZA2X/PROG/ZDEMO_EXCEL.slnk b/ZA2X/PROG/ZDEMO_EXCEL.slnk index bb25671..ca7e766 100644 --- a/ZA2X/PROG/ZDEMO_EXCEL.slnk +++ b/ZA2X/PROG/ZDEMO_EXCEL.slnk @@ -79,6 +79,7 @@ START-OF-SELECTION. SUBMIT zdemo_excel37 WITH p_upfile = lv_upfile WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Simplest call of the reader and writer - passthrough data SUBMIT zdemo_excel38 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Show off integration of drawings ( here using the SAP-Icons ) + SUBMIT ZDEMO_EXCEL39 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Charts " " Reader/Writer Demo must always run at the end " to make sure all documents where created diff --git a/ZA2X/PROG/ZDEMO_EXCEL39.slnk b/ZA2X/PROG/ZDEMO_EXCEL39.slnk index de47890..1aaeb05 100644 --- a/ZA2X/PROG/ZDEMO_EXCEL39.slnk +++ b/ZA2X/PROG/ZDEMO_EXCEL39.slnk @@ -30,21 +30,355 @@ DATA: ls_io TYPE skwf_io. DATA: ls_upper TYPE zexcel_drawing_location, ls_lower TYPE zexcel_drawing_location. -DATA lo_bar TYPE REF TO zcl_excel_graph_bars. +DATA lo_bar1 TYPE REF TO zcl_excel_graph_bars. DATA lo_bar2 TYPE REF TO zcl_excel_graph_bars. DATA lo_pie TYPE REF TO zcl_excel_graph_pie. +DATA lo_line TYPE REF TO zcl_excel_graph_line. CONSTANTS: gc_save_file_name TYPE string VALUE '39_Charts.xlsx'. INCLUDE zdemo_excel_outputopt_incl. START-OF-SELECTION. + " Create a pie chart and series + CREATE OBJECT lo_pie. + + CALL METHOD lo_pie->create_serie + EXPORTING + ip_order = 0 + ip_sheet = 'Values' + ip_lbl_from_col = 'B' + ip_lbl_from_row = '1' + ip_lbl_to_col = 'B' + ip_lbl_to_row = '3' + ip_ref_from_col = 'A' + ip_ref_from_row = '1' + ip_ref_to_col = 'A' + ip_ref_to_row = '3' + ip_sername = 'My serie 1'. + + " Set style + lo_pie->set_style( zcl_excel_graph=>c_style_15 ). + + " Create a bar chart, series and axes + CREATE OBJECT lo_bar1. + + CALL METHOD lo_bar1->create_serie + EXPORTING + ip_order = 0 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_bar1->create_serie + EXPORTING + ip_order = 1 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$B$1:$B$3' + ip_ref = 'Values!$A$1:$A$3' + ip_sername = 'My serie 2'. + + CALL METHOD lo_bar1->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_bar1->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + " Set style + lo_bar1->set_style( zcl_excel_graph=>c_style_default ). + + " Set label to none + lo_bar1->set_print_lbl( zcl_excel_graph_bars=>c_show_false ). + + " Create a bar chart, series and axes + CREATE OBJECT lo_bar2. + + CALL METHOD lo_bar2->create_serie + EXPORTING + ip_order = 0 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_yes + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_bar2->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_bar2->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + " Set layout + lo_bar2->set_show_legend_key( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_values( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_cat_name( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_ser_name( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_percent( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_varycolor( zcl_excel_graph_bars=>c_show_true ). + + " Create a line chart, series and axes + CREATE OBJECT lo_line. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 0 + ip_symbol = zcl_excel_graph_line=>c_symbol_auto + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 1 + ip_symbol = zcl_excel_graph_line=>c_symbol_none + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$B$1:$B$3' + ip_ref = 'Values!$A$1:$A$3' + ip_sername = 'My serie 2'. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 2 + ip_symbol = zcl_excel_graph_line=>c_symbol_auto + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$F$1:$F$3' + ip_ref = 'Values!$E$1:$E$3' + ip_sername = 'My serie 3'. + + CALL METHOD lo_line->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_line=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_line->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_line=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + + + + + + " Creates active sheet CREATE OBJECT lo_excel. - " Get active sheet + " Get active sheet (Pie sheet) lo_worksheet = lo_excel->get_active_worksheet( ). - lo_worksheet->set_title( 'Sheet1' ). + lo_worksheet->set_title( 'PieChart' ). + + " Create global drawing, set type as pie chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART PIE' ). + lo_drawing->graph = lo_pie. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie. + + "Set chart position (anchor 2 cells) + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " BarChart1 sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'BarChart1' ). + + " Create global drawing, set type as bar chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART BARS WITH 2 SERIES' ). + lo_drawing->graph = lo_bar1. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 11. + ls_lower-row = 22. + ls_lower-col = 21. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " BarChart2 sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'BarChart2' ). + + " Create global drawing, set type as bar chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART BARS WITH 1 SERIE' ). + lo_drawing->graph = lo_bar2. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 0. + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " LineChart sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'LineChart' ). + + " Create global drawing, set type as line chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART LINES' ). + lo_drawing->graph = lo_line. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_line. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 0. + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " Values sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). " Set values for chart lv_value = 1. @@ -64,223 +398,26 @@ START-OF-SELECTION. lo_worksheet->set_cell( ip_column = 'C' ip_row = 1 ip_value = lv_value ). lv_value = 2. lo_worksheet->set_cell( ip_column = 'C' ip_row = 2 ip_value = lv_value ). - lv_value = 1. + lv_value = -1. lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = lv_value ). " Set labels for chart - lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = 'One' ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = 'One (Minus)' ). lo_worksheet->set_cell( ip_column = 'D' ip_row = 2 ip_value = 'Two' ). lo_worksheet->set_cell( ip_column = 'D' ip_row = 1 ip_value = 'Three' ). + " Set values for chart + lv_value = 3. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 1 ip_value = lv_value ). + lv_value = 1. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 2 ip_value = lv_value ). + lv_value = 2. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 3 ip_value = lv_value ). - - - - " Create a pie chart and series - CREATE OBJECT lo_pie. - - CALL METHOD lo_pie->create_serie - EXPORTING - ip_order = 0 - ip_sheet = 'Sheet1' - ip_lbl_from_col = 'B' - ip_lbl_from_row = '1' - ip_lbl_to_col = 'B' - ip_lbl_to_row = '3' - ip_ref_from_col = 'A' - ip_ref_from_row = '1' - ip_ref_to_col = 'A' - ip_ref_to_row = '3' - ip_sername = 'My serie 1'. - - " Set style - lo_pie->set_style( zcl_excel_graph=>c_style_15 ). - - " Create a bar chart, series and axes - CREATE OBJECT lo_bar. - - CALL METHOD lo_bar->create_serie - EXPORTING - ip_order = 0 - ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no - ip_lbl = 'Sheet1!$D$1:$D$3' - ip_ref = 'Sheet1!$C$1:$C$3' - ip_sername = 'My serie 1'. - - CALL METHOD lo_bar->create_serie - EXPORTING - ip_order = 1 - ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no - ip_lbl = 'Sheet1!$B$1:$B$3' - ip_ref = 'Sheet1!$A$1:$A$3' - ip_sername = 'My serie 2'. - - CALL METHOD lo_bar->create_ax - EXPORTING -* ip_axid = - ip_type = zcl_excel_graph_bars=>c_catax -* ip_orientation = -* ip_delete = -* ip_axpos = -* ip_formatcode = -* ip_sourcelinked = -* ip_majortickmark = -* ip_minortickmark = -* ip_ticklblpos = -* ip_crossax = -* ip_crosses = -* ip_auto = -* ip_lblalgn = -* ip_lbloffset = -* ip_nomultilvllbl = -* ip_crossbetween = - . - - CALL METHOD lo_bar->create_ax - EXPORTING -* ip_axid = - ip_type = zcl_excel_graph_bars=>c_valax -* ip_orientation = -* ip_delete = -* ip_axpos = -* ip_formatcode = -* ip_sourcelinked = -* ip_majortickmark = -* ip_minortickmark = -* ip_ticklblpos = -* ip_crossax = -* ip_crosses = -* ip_auto = -* ip_lblalgn = -* ip_lbloffset = -* ip_nomultilvllbl = -* ip_crossbetween = - . - - " Set style - lo_bar->set_style( zcl_excel_graph=>c_style_16 ). - - " Create a bar chart, series and axes - CREATE OBJECT lo_bar2. - - CALL METHOD lo_bar2->create_serie - EXPORTING - ip_order = 0 - ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no - ip_lbl = 'Sheet1!$D$1:$D$3' - ip_ref = 'Sheet1!$C$1:$C$3' - ip_sername = 'My serie 1'. - - CALL METHOD lo_bar2->create_ax - EXPORTING -* ip_axid = - ip_type = zcl_excel_graph_bars=>c_catax -* ip_orientation = -* ip_delete = -* ip_axpos = -* ip_formatcode = -* ip_sourcelinked = -* ip_majortickmark = -* ip_minortickmark = -* ip_ticklblpos = -* ip_crossax = -* ip_crosses = -* ip_auto = -* ip_lblalgn = -* ip_lbloffset = -* ip_nomultilvllbl = -* ip_crossbetween = - . - - CALL METHOD lo_bar2->create_ax - EXPORTING -* ip_axid = - ip_type = zcl_excel_graph_bars=>c_valax -* ip_orientation = -* ip_delete = -* ip_axpos = -* ip_formatcode = -* ip_sourcelinked = -* ip_majortickmark = -* ip_minortickmark = -* ip_ticklblpos = -* ip_crossax = -* ip_crosses = -* ip_auto = -* ip_lblalgn = -* ip_lbloffset = -* ip_nomultilvllbl = -* ip_crossbetween = - . - - - " Create global drawing, set type as pie chart, assign chart, set position and media type - lo_drawing = lo_worksheet->excel->add_new_drawing( - ip_type = zcl_excel_drawing=>type_chart - ip_title = 'CHART PIE' ). - lo_drawing->graph = lo_pie. - lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie. - - "Set chart position (anchor 2 cells) - ls_lower-row = 22. - ls_lower-col = 10. - lo_drawing->set_position2( - EXPORTING - ip_from = ls_upper - ip_to = ls_lower ). - - lo_drawing->set_media( - EXPORTING - ip_media_type = zcl_excel_drawing=>c_media_type_xml ). - - - lo_worksheet->add_drawing( lo_drawing ). - - " Create global drawing, set type as pie chart, assign chart, set position and media type - lo_drawing = lo_worksheet->excel->add_new_drawing( - ip_type = zcl_excel_drawing=>type_chart - ip_title = 'CHART BARS' ). - lo_drawing->graph = lo_bar. - lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. - - "Set chart position (anchor 2 cells) - ls_upper-row = 0. - ls_upper-col = 11. - ls_lower-row = 22. - ls_lower-col = 21. - lo_drawing->set_position2( - EXPORTING - ip_from = ls_upper - ip_to = ls_lower ). - - lo_drawing->set_media( - EXPORTING - ip_media_type = zcl_excel_drawing=>c_media_type_xml ). - - lo_worksheet->add_drawing( lo_drawing ). - - " Create global drawing, set type as pie chart, assign chart, set position and media type - lo_drawing = lo_worksheet->excel->add_new_drawing( - ip_type = zcl_excel_drawing=>type_chart - ip_title = 'CHART BARS WITH 1 SERIE' ). - lo_drawing->graph = lo_bar2. - lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. - - "Set chart position (anchor 2 cells) - ls_upper-row = 23. - ls_upper-col = 0. - ls_lower-row = 31. - ls_lower-col = 10. - lo_drawing->set_position2( - EXPORTING - ip_from = ls_upper - ip_to = ls_lower ). - - lo_drawing->set_media( - EXPORTING - ip_media_type = zcl_excel_drawing=>c_media_type_xml ). - - lo_worksheet->add_drawing( lo_drawing ). + " Set labels for chart + lo_worksheet->set_cell( ip_column = 'F' ip_row = 3 ip_value = 'Two' ). + lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'One' ). + lo_worksheet->set_cell( ip_column = 'F' ip_row = 1 ip_value = 'Three' ). *** Create output