mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 07:56:15 +08:00
#236: Chart creation in a worksheet from ABAP
Added: - Labels management - Serie name TODO: Multiple series and bar charts git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@383 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
This commit is contained in:
parent
181ac2cb38
commit
f73376b3e0
|
@ -426,8 +426,20 @@ endmethod.</source>
|
|||
node2 ?= node->find_from_name( name = 'order' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
lo_piechart->ns_orderval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'f' namespace = 'c' ).
|
||||
lo_piechart->REF = node3->get_value( ).
|
||||
node2 ?= node->find_from_name( name = 'v' namespace = 'c' ).
|
||||
if node2 is bound.
|
||||
lo_piechart->sername = node2->get_value( ).
|
||||
endif.
|
||||
node2 ?= node->find_from_name( name = 'strRef' namespace = 'c' ).
|
||||
if node2 is bound.
|
||||
node3 ?= node2->find_from_name( name = 'f' namespace = 'c' ).
|
||||
lo_piechart->LBL = node3->get_value( ).
|
||||
endif.
|
||||
node2 ?= node->find_from_name( name = 'numRef' namespace = 'c' ).
|
||||
if node2 is bound.
|
||||
node3 ?= node2->find_from_name( name = 'f' namespace = 'c' ).
|
||||
lo_piechart->REF = node3->get_value( ).
|
||||
endif.
|
||||
"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 ).
|
||||
|
|
|
@ -27,7 +27,9 @@ public section.
|
|||
footer TYPE string,
|
||||
END OF t_pagemargins .
|
||||
|
||||
data LBL type STRING .
|
||||
data REF type STRING .
|
||||
data SERNAME type STRING .
|
||||
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 .
|
||||
|
@ -52,15 +54,17 @@ public section.
|
|||
*"* components in the private section</localTypes>
|
||||
<localMacros>*"* use this source file for any macro definitions you need
|
||||
*"* in the implementation part of the class</localMacros>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_1904VAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="2 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_AUTOTITLEDELETEDVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="6 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_DISPBLANKSASVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="8 " ATTDECLTYP="0" ATTVALUE="'gap'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_LANGVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="3 " ATTDECLTYP="0" ATTVALUE="'it-IT'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_PLOTVISONLYVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="7 " ATTDECLTYP="0" ATTVALUE="'1'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_ROUNDEDCORNERSVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="4 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_SHOWDLBLSOVERMAXVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="9 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="PAGEMARGINS" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="5 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="T_PAGEMARGINS" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="REF" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="1 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="LBL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="1 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_1904VAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="4 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_AUTOTITLEDELETEDVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="8 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_DISPBLANKSASVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="10 " ATTDECLTYP="0" ATTVALUE="'gap'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_LANGVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="5 " ATTDECLTYP="0" ATTVALUE="'it-IT'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_PLOTVISONLYVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="9 " ATTDECLTYP="0" ATTVALUE="'1'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_ROUNDEDCORNERSVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="6 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="NS_SHOWDLBLSOVERMAXVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="11 " ATTDECLTYP="0" ATTVALUE="'0'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="PAGEMARGINS" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="7 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="T_PAGEMARGINS" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="REF" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="2 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="SERNAME" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="3 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<method CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="CONSTRUCTOR" VERSION="1" LANGU="E" DESCRIPT="CONSTRUCTOR" EXPOSURE="2" STATE="1" EDITORDER="1 " DISPID="0 " MTDTYPE="2" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<source>method CONSTRUCTOR.
|
||||
"Load default values
|
||||
|
|
|
@ -1110,50 +1110,54 @@ endmethod.</source>
|
|||
|
||||
"---------------------------CHART
|
||||
lc_xml_node_chart TYPE string VALUE 'c:chart',
|
||||
lc_xml_node_autoTitleDeleted TYPE string VALUE 'c:autoTitleDeleted',
|
||||
lc_xml_node_autotitledeleted TYPE string VALUE 'c:autoTitleDeleted',
|
||||
"plotArea
|
||||
lc_xml_node_plotArea TYPE string VALUE 'c:plotArea',
|
||||
lc_xml_node_plotarea TYPE string VALUE 'c:plotArea',
|
||||
lc_xml_node_layout TYPE string VALUE 'c:layout',
|
||||
"plotArea->pie
|
||||
lc_xml_node_pieChart TYPE string VALUE 'c:pieChart',
|
||||
lc_xml_node_varyColors TYPE string VALUE 'c:varyColors',
|
||||
lc_xml_node_piechart TYPE string VALUE 'c:pieChart',
|
||||
lc_xml_node_varycolors TYPE string VALUE 'c:varyColors',
|
||||
lc_xml_node_ser TYPE string VALUE 'c:ser',
|
||||
lc_xml_node_idx TYPE string VALUE 'c:idx',
|
||||
lc_xml_node_order TYPE string VALUE 'c:order',
|
||||
lc_xml_node_tx TYPE string VALUE 'c:tx',
|
||||
lc_xml_node_v TYPE string VALUE 'c:v',
|
||||
lc_xml_node_val TYPE string VALUE 'c:val',
|
||||
lc_xml_node_numRef TYPE string VALUE 'c:numRef',
|
||||
lc_xml_node_cat TYPE string VALUE 'c:cat',
|
||||
lc_xml_node_numref TYPE string VALUE 'c:numRef',
|
||||
lc_xml_node_strref TYPE string VALUE 'c:strRef',
|
||||
lc_xml_node_f TYPE string VALUE 'c:f', "this is the range
|
||||
"note: numcache avoided
|
||||
lc_xml_node_dLbls TYPE string VALUE 'c:dLbls',
|
||||
lc_xml_node_showLegendKey TYPE string VALUE 'c:showLegendKey',
|
||||
lc_xml_node_showVal TYPE string VALUE 'c:showVal',
|
||||
lc_xml_node_showCatName TYPE string VALUE 'c:showCatName',
|
||||
lc_xml_node_showSerName TYPE string VALUE 'c:showSerName',
|
||||
lc_xml_node_showPercent TYPE string VALUE 'c:showPercent',
|
||||
lc_xml_node_showBubbleSize TYPE string VALUE 'c:showBubbleSize',
|
||||
lc_xml_node_showLeaderLines TYPE string VALUE 'c:showLeaderLines',
|
||||
lc_xml_node_firstSliceAng TYPE string VALUE 'c:firstSliceAng',
|
||||
lc_xml_node_dlbls TYPE string VALUE 'c:dLbls',
|
||||
lc_xml_node_showlegendkey TYPE string VALUE 'c:showLegendKey',
|
||||
lc_xml_node_showval TYPE string VALUE 'c:showVal',
|
||||
lc_xml_node_showcatname TYPE string VALUE 'c:showCatName',
|
||||
lc_xml_node_showsername TYPE string VALUE 'c:showSerName',
|
||||
lc_xml_node_showpercent TYPE string VALUE 'c:showPercent',
|
||||
lc_xml_node_showbubblesize TYPE string VALUE 'c:showBubbleSize',
|
||||
lc_xml_node_showleaderlines TYPE string VALUE 'c:showLeaderLines',
|
||||
lc_xml_node_firstsliceang TYPE string VALUE 'c:firstSliceAng',
|
||||
"plotArea->bar
|
||||
lc_xml_node_barChart TYPE string VALUE 'c:barChart',
|
||||
lc_xml_node_catAx TYPE string VALUE 'c:catAx',
|
||||
lc_xml_node_valAx TYPE string VALUE 'c:valAx',
|
||||
lc_xml_node_barchart TYPE string VALUE 'c:barChart',
|
||||
lc_xml_node_catax TYPE string VALUE 'c:catAx',
|
||||
lc_xml_node_valax TYPE string VALUE 'c:valAx',
|
||||
"legend
|
||||
lc_xml_node_legend TYPE string VALUE 'c:legend',
|
||||
"legend->pie
|
||||
lc_xml_node_legendPos TYPE string VALUE 'c:legendPos',
|
||||
lc_xml_node_legendpos TYPE string VALUE 'c:legendPos',
|
||||
* lc_xml_node_layout TYPE string VALUE 'c:layout', "already exist
|
||||
lc_xml_node_overlay TYPE string VALUE 'c:overlay',
|
||||
lc_xml_node_txPr TYPE string VALUE 'c:txPr',
|
||||
lc_xml_node_bodyPr TYPE string VALUE 'a:bodyPr',
|
||||
lc_xml_node_lstStyle TYPE string VALUE 'a:lstStyle',
|
||||
lc_xml_node_txpr TYPE string VALUE 'c:txPr',
|
||||
lc_xml_node_bodypr TYPE string VALUE 'a:bodyPr',
|
||||
lc_xml_node_lststyle TYPE string VALUE 'a:lstStyle',
|
||||
lc_xml_node_p TYPE string VALUE 'a:p',
|
||||
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',
|
||||
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',
|
||||
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',
|
||||
|
@ -1271,140 +1275,158 @@ endmethod.</source>
|
|||
"---------------------------CHART
|
||||
lo_element = lo_document->create_simple_element( name = lc_xml_node_chart
|
||||
parent = lo_element_root ).
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_autoTitleDeleted
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_autotitledeleted
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
value = lo_chart->ns_autoTitleDeletedval ).
|
||||
value = lo_chart->ns_autotitledeletedval ).
|
||||
|
||||
"plotArea
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotArea
|
||||
parent = lo_element ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout
|
||||
parent = lo_element2 ).
|
||||
CASE io_drawing->graph_type.
|
||||
WHEN zcl_excel_drawing=>c_graph_bars.
|
||||
"----bar
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_barChart
|
||||
parent = lo_element2 ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catAx
|
||||
parent = lo_element2 ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valAx
|
||||
parent = lo_element2 ).
|
||||
"TODO
|
||||
WHEN zcl_excel_drawing=>c_graph_pie.
|
||||
"----pie
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_pieChart
|
||||
parent = lo_element2 ).
|
||||
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varyColors
|
||||
parent = lo_element3 ).
|
||||
lo_element4->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_varyColorsval ).
|
||||
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 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_idxval ).
|
||||
lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order
|
||||
parent = lo_element4 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_orderval ).
|
||||
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 = lo_chartp->REF ).
|
||||
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_chartp->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_chartp->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_chartp->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_chartp->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_chartp->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_chartp->ns_showBubbleSizeval ).
|
||||
lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showLeaderLines
|
||||
parent = lo_element4 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_showLeaderLinesval ).
|
||||
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_firstSliceAng
|
||||
parent = lo_element3 ).
|
||||
lo_element4->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_firstSliceAngval ).
|
||||
WHEN OTHERS.
|
||||
ENDCASE.
|
||||
"plotArea
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotarea
|
||||
parent = lo_element ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout
|
||||
parent = lo_element2 ).
|
||||
CASE io_drawing->graph_type.
|
||||
WHEN zcl_excel_drawing=>c_graph_bars.
|
||||
"----bar
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_barchart
|
||||
parent = lo_element2 ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catax
|
||||
parent = lo_element2 ).
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valax
|
||||
parent = lo_element2 ).
|
||||
"TODO
|
||||
WHEN zcl_excel_drawing=>c_graph_pie.
|
||||
"----pie
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_piechart
|
||||
parent = lo_element2 ).
|
||||
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varycolors
|
||||
parent = lo_element3 ).
|
||||
lo_element4->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_varycolorsval ).
|
||||
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 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_idxval ).
|
||||
lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order
|
||||
parent = lo_element4 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_orderval ).
|
||||
if lo_chartp->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 = lo_chartp->sername ).
|
||||
endif.
|
||||
IF lo_chartp->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 = lo_chartp->lbl ).
|
||||
ENDIF.
|
||||
IF lo_chartp->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 = lo_chartp->ref ).
|
||||
ENDIF.
|
||||
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_chartp->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_chartp->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_chartp->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_chartp->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_chartp->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_chartp->ns_showbubblesizeval ).
|
||||
lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showleaderlines
|
||||
parent = lo_element4 ).
|
||||
lo_element5->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_showleaderlinesval ).
|
||||
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_firstsliceang
|
||||
parent = lo_element3 ).
|
||||
lo_element4->set_attribute_ns( name = 'val'
|
||||
value = lo_chartp->ns_firstsliceangval ).
|
||||
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
|
||||
"TODO
|
||||
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.
|
||||
"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
|
||||
"TODO
|
||||
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.
|
||||
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotVisOnly
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotvisonly
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
value = lo_chart->ns_plotVisOnlyval ).
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_dispBlanksAs
|
||||
value = lo_chart->ns_plotvisonlyval ).
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_dispblanksas
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
value = lo_chart->ns_dispBlanksAsval ).
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_showDLblsOverMax
|
||||
value = lo_chart->ns_dispblanksasval ).
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_showdlblsovermax
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
value = lo_chart->ns_showDLblsOverMaxval ).
|
||||
value = lo_chart->ns_showdlblsovermaxval ).
|
||||
"---------------------------END OF CHART
|
||||
|
||||
"printSettings
|
||||
|
@ -1429,7 +1451,7 @@ endmethod.</source>
|
|||
lo_element2->set_attribute_ns( name = 'footer'
|
||||
value = lo_chart->pagemargins-footer ).
|
||||
"pageSetup
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_pageSetup
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_pagesetup
|
||||
parent = lo_element ).
|
||||
|
||||
**********************************************************************
|
||||
|
|
|
@ -46,6 +46,14 @@ START-OF-SELECTION.
|
|||
lo_worksheet = lo_excel->get_active_worksheet( ).
|
||||
lo_worksheet->set_title( 'Sheet1' ).
|
||||
|
||||
" Set labels for chart
|
||||
lv_value = 1.
|
||||
lo_worksheet->set_cell( ip_column = 'K' ip_row = 1 ip_value = 'One' ).
|
||||
lv_value = 2.
|
||||
lo_worksheet->set_cell( ip_column = 'K' ip_row = 2 ip_value = 'Two' ).
|
||||
lv_value = 3.
|
||||
lo_worksheet->set_cell( ip_column = 'K' ip_row = 3 ip_value = 'Three' ).
|
||||
|
||||
" Set values for chart
|
||||
lv_value = 1.
|
||||
lo_worksheet->set_cell( ip_column = 'J' ip_row = 1 ip_value = lv_value ).
|
||||
|
@ -57,6 +65,8 @@ START-OF-SELECTION.
|
|||
" Create a pie chart and assign value range
|
||||
CREATE OBJECT lo_pie.
|
||||
lo_pie->ref = 'Sheet1!$J$1:$J$3'. "VALUE RANGE FOR CHART
|
||||
lo_pie->lbl = 'Sheet1!$K$1:$K$3'. "VALUE RANGE FOR CHART
|
||||
lo_pie->sername = 'My serie'. "Serie name
|
||||
|
||||
" Create global drawing, set type as pie chart, assign chart, set position and media type
|
||||
lo_drawing = lo_worksheet->excel->add_new_drawing(
|
||||
|
@ -66,8 +76,8 @@ START-OF-SELECTION.
|
|||
lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie.
|
||||
|
||||
"Set chart position (anchor 2 cells)
|
||||
ls_lower-row = 10.
|
||||
ls_lower-col = 10.
|
||||
ls_lower-row = 22.
|
||||
ls_lower-col = 11.
|
||||
lo_drawing->set_position2(
|
||||
EXPORTING
|
||||
ip_from = ls_upper
|
||||
|
|
Loading…
Reference in New Issue
Block a user