mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 07:56:15 +08:00
First Excel Pie Chart directly from ABAP via abap2xlsx
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@379 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
This commit is contained in:
parent
e7865e58cb
commit
e5bff62d2f
|
@ -354,10 +354,6 @@ endmethod.</source>
|
|||
DATA: node TYPE REF TO if_ixml_element.
|
||||
DATA: node2 TYPE REF TO if_ixml_element.
|
||||
DATA: node3 TYPE REF TO if_ixml_element.
|
||||
DATA: node4 TYPE REF TO if_ixml_element.
|
||||
DATA: node5 TYPE REF TO if_ixml_element.
|
||||
DATA: node6 TYPE REF TO if_ixml_element.
|
||||
DATA: node7 TYPE REF TO if_ixml_element.
|
||||
DATA: iterator TYPE REF TO if_ixml_node_iterator.
|
||||
|
||||
DATA: chartspace TYPE REF TO if_ixml_node_collection.
|
||||
|
@ -367,44 +363,26 @@ endmethod.</source>
|
|||
DATA lo_barchart TYPE REF TO zcl_excel_graph_bars.
|
||||
DATA lo_piechart TYPE REF TO zcl_excel_graph_pie.
|
||||
|
||||
* chartspace = ip_chart->get_elements_by_tag_name( name = 'chartSpace' namespace = 'c' ).
|
||||
* coll_length = chartspace->get_length( ).
|
||||
* iterator = chartspace->create_iterator( ).
|
||||
*
|
||||
* DO coll_length TIMES. "always 1
|
||||
* chartelem ?= iterator->get_next( ).
|
||||
*
|
||||
* node ?= chartelem->find_from_name( name = 'chart' namespace = 'c' ).
|
||||
|
||||
TYPES: BEGIN OF t_prop,
|
||||
val TYPE string,
|
||||
END OF t_prop.
|
||||
val TYPE string,
|
||||
rtl TYPE string,
|
||||
lang TYPE string,
|
||||
END OF t_prop.
|
||||
|
||||
TYPES: BEGIN OF t_pagemargins,
|
||||
b TYPE string,
|
||||
l TYPE string,
|
||||
r TYPE string,
|
||||
t TYPE string,
|
||||
header TYPE string,
|
||||
footer TYPE string,
|
||||
END OF t_pagemargins.
|
||||
|
||||
DATA ls_prop TYPE t_prop.
|
||||
DATA ls_pagemargins TYPE t_pagemargins.
|
||||
|
||||
node ?= ip_chart->if_ixml_node~get_first_child( ).
|
||||
CHECK node IS NOT INITIAL.
|
||||
node2 ?= node->find_from_name( name = 'plotArea' namespace = 'c' ).
|
||||
CHECK node2 IS NOT INITIAL.
|
||||
node3 ?= node2->find_from_name( name = 'pieChart' namespace = 'c' ).
|
||||
IF node3 IS INITIAL.
|
||||
node3 ?= node2->find_from_name( name = 'barChart' namespace = 'c' ).
|
||||
IF node3 IS NOT INITIAL.
|
||||
me->graph_type = c_graph_bars.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
me->graph_type = c_graph_pie.
|
||||
ENDIF.
|
||||
CHECK node3 IS NOT INITIAL.
|
||||
node4 ?= node3->find_from_name( name = 'ser' namespace = 'c' ).
|
||||
CHECK node4 IS NOT INITIAL.
|
||||
node5 ?= node4->find_from_name( name = 'val' namespace = 'c' ).
|
||||
CHECK node5 IS NOT INITIAL.
|
||||
node6 ?= node5->find_from_name( name = 'numRef' namespace = 'c' ).
|
||||
CHECK node6 IS NOT INITIAL.
|
||||
node7 ?= node6->find_from_name( name = 'f' namespace = 'c' ).
|
||||
CHECK node7 IS NOT INITIAL.
|
||||
|
||||
|
||||
CASE me->graph_type.
|
||||
WHEN c_graph_bars.
|
||||
|
@ -416,30 +394,100 @@ endmethod.</source>
|
|||
WHEN OTHERS.
|
||||
ENDCASE.
|
||||
|
||||
me->graph->ref = node7->get_value( ).
|
||||
|
||||
"Fill properties
|
||||
node2 ?= node->find_from_name( name = 'date1904' namespace = 'c' ).
|
||||
ZCL_EXCEL_READER_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_1904val = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'lang' namespace = 'c' ).
|
||||
ZCL_EXCEL_READER_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_langval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'roundedCorners' namespace = 'c' ).
|
||||
ZCL_EXCEL_READER_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_roundedcornersval = ls_prop-val.
|
||||
|
||||
* node ?= chartElem->find_from_name( name = 'graphicFrame' namespace = 'xdr' ).
|
||||
* IF node IS NOT INITIAL.
|
||||
* node2 ?= node->find_from_name( name = 'nvGraphicFramePr' namespace = 'xdr' ).
|
||||
* CHECK node2 IS NOT INITIAL.
|
||||
* node3 ?= node2->find_from_name( name = 'cNvPr' namespace = 'xdr' ).
|
||||
* CHECK node3 IS NOT INITIAL.
|
||||
* me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = cnvpr ).
|
||||
* lv_title = cnvpr-name.
|
||||
* ENDIF.
|
||||
"---------------------------Read graph properties
|
||||
node2 ?= node->find_from_name( name = 'autoTitleDeleted' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_autoTitleDeletedval = ls_prop-val.
|
||||
|
||||
"plotArea
|
||||
CASE me->graph_type.
|
||||
WHEN c_graph_bars.
|
||||
"TODO
|
||||
WHEN c_graph_pie.
|
||||
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_piechart->ns_varyColorsval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'idx' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
lo_piechart->ns_idxval = ls_prop-val.
|
||||
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( ).
|
||||
"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_piechart->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_piechart->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_piechart->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_piechart->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_piechart->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_piechart->ns_showBubbleSizeval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'showLeaderLines' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
lo_piechart->ns_showLeaderLinesval = ls_prop-val.
|
||||
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 OTHERS.
|
||||
ENDCASE.
|
||||
"legend
|
||||
CASE me->graph_type.
|
||||
WHEN c_graph_bars.
|
||||
"TODO
|
||||
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 ).
|
||||
lo_piechart->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.
|
||||
node2 ?= node->find_from_name( name = 'pPr' namespace = 'a' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
lo_piechart->ns_pPrrtl = ls_prop-rtl.
|
||||
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.
|
||||
|
||||
node2 ?= node->find_from_name( name = 'plotVisOnly' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_plotVisOnlyval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'dispBlanksAs' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_dispBlanksAsval = ls_prop-val.
|
||||
node2 ?= node->find_from_name( name = 'showDLblsOverMax' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
|
||||
me->graph->ns_showDLblsOverMaxval = ls_prop-val.
|
||||
"---------------------
|
||||
|
||||
node2 ?= node->find_from_name( name = 'pageMargins' namespace = 'c' ).
|
||||
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_pagemargins ).
|
||||
me->graph->pagemargins = ls_pagemargins.
|
||||
|
||||
* ENDDO.
|
||||
|
||||
ENDMETHOD.</source>
|
||||
</method>
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CLAS CLSNAME="ZCL_EXCEL_GRAPH" VERSION="1" LANGU="E" DESCRIPT="Graphic" UUID="02023211AE4F1EE28EDF2A8F8A97065E" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" CLSCCINCL="X" FIXPT="X" UNICODE="X" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 ">
|
||||
<types CLSNAME="ZCL_EXCEL_GRAPH" CMPNAME="T_PAGEMARGINS" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="1 " TYPTYPE="4" SRCROW1="10 " SRCCOLUMN1="4 " SRCROW2="17 " SRCCOLUMN2="23 " TYPESRC_LENG="229 " TYPESRC="BEGIN OF t_pagemargins,
|
||||
b TYPE string,
|
||||
l TYPE string,
|
||||
r TYPE string,
|
||||
t TYPE string,
|
||||
header TYPE string,
|
||||
footer TYPE string,
|
||||
END OF t_pagemargins
|
||||
"/>
|
||||
<publicSection>class ZCL_EXCEL_GRAPH definition
|
||||
public
|
||||
create public .
|
||||
|
@ -8,10 +17,27 @@ public section.
|
|||
*"* public components of class ZCL_EXCEL_GRAPH
|
||||
*"* do not include other source files here!!!
|
||||
|
||||
types:
|
||||
BEGIN OF t_pagemargins,
|
||||
b TYPE string,
|
||||
l TYPE string,
|
||||
r TYPE string,
|
||||
t TYPE string,
|
||||
header TYPE string,
|
||||
footer TYPE string,
|
||||
END OF t_pagemargins .
|
||||
|
||||
data REF 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 .</publicSection>
|
||||
data NS_ROUNDEDCORNERSVAL type STRING value '0'. "#EC NOTEXT .
|
||||
data PAGEMARGINS type T_PAGEMARGINS .
|
||||
data NS_AUTOTITLEDELETEDVAL type STRING value '0'. "#EC NOTEXT .
|
||||
data NS_PLOTVISONLYVAL type STRING value '1'. "#EC NOTEXT .
|
||||
data NS_DISPBLANKSASVAL type STRING value 'gap'. "#EC NOTEXT .
|
||||
data NS_SHOWDLBLSOVERMAXVAL type STRING value '0'. "#EC NOTEXT .
|
||||
|
||||
methods CONSTRUCTOR .</publicSection>
|
||||
<protectedSection>protected section.
|
||||
*"* protected components of class ZCL_EXCEL_GRAPH
|
||||
*"* do not include other source files here!!!</protectedSection>
|
||||
|
@ -27,7 +53,23 @@ public section.
|
|||
<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 "/>
|
||||
<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
|
||||
me->pagemargins-b = '0.75'.
|
||||
me->pagemargins-l = '0.7'.
|
||||
me->pagemargins-r = '0.7'.
|
||||
me->pagemargins-t = '0.75'.
|
||||
me->pagemargins-header = '0.3'.
|
||||
me->pagemargins-footer = '0.3'.
|
||||
endmethod.</source>
|
||||
</method>
|
||||
</CLAS>
|
||||
|
|
|
@ -8,7 +8,23 @@
|
|||
|
||||
public section.
|
||||
*"* public components of class ZCL_EXCEL_GRAPH_PIE
|
||||
*"* do not include other source files here!!!</publicSection>
|
||||
*"* 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_IDXVAL type STRING value '0'. "#EC NOTEXT .
|
||||
data NS_ORDERVAL 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 .</publicSection>
|
||||
<protectedSection>protected section.
|
||||
*"* protected components of class ZCL_EXCEL_GRAPH_PIE
|
||||
*"* do not include other source files here!!!</protectedSection>
|
||||
|
@ -23,5 +39,20 @@ 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_PIE" CMPNAME="NS_ENDPARARPRLANG" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="4 " 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_PIE" CMPNAME="NS_FIRSTSLICEANGVAL" 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_PIE" CMPNAME="NS_IDXVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="7 " 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_PIE" CMPNAME="NS_LEGENDPOSVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="1 " ATTDECLTYP="0" ATTVALUE="'r'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_GRAPH_PIE" CMPNAME="NS_ORDERVAL" 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_PIE" CMPNAME="NS_OVERLAYVAL" 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_PIE" CMPNAME="NS_PPRRTL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="3 " 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_PIE" CMPNAME="NS_SHOWBUBBLESIZEVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="14 " 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_PIE" CMPNAME="NS_SHOWCATNAMEVAL" 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_PIE" CMPNAME="NS_SHOWLEADERLINESVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="15 " 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_PIE" CMPNAME="NS_SHOWLEGENDKEYVAL" 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_PIE" CMPNAME="NS_SHOWPERCENTVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="13 " 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_PIE" CMPNAME="NS_SHOWSERNAMEVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="12 " 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_PIE" CMPNAME="NS_SHOWVALVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="10 " 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_PIE" CMPNAME="NS_VARYCOLORSVAL" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="5 " ATTDECLTYP="0" ATTVALUE="'1'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<inheritance CLSNAME="ZCL_EXCEL_GRAPH_PIE" REFCLSNAME="ZCL_EXCEL_GRAPH" VERSION="1" STATE="1"/>
|
||||
</CLAS>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CLAS CLSNAME="ZCL_EXCEL_WRITER_2007" VERSION="1" LANGU="E" DESCRIPT="Excel writer 2007" UUID="9551494D16947660E1000000C0A8FA28" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" CLSCCINCL="X" FIXPT="X" UNICODE="X" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 ">
|
||||
<implementing CLSNAME="ZCL_EXCEL_WRITER_2007" REFCLSNAME="ZIF_EXCEL_WRITER" VERSION="1" EXPOSURE="2" STATE="1" RELTYPE="1"/>
|
||||
<implementing CLSNAME="ZCL_EXCEL_WRITER_2007" REFCLSNAME="ZIF_EXCEL_WRITER" VERSION="1" EXPOSURE="2" STATE="1" RELTYPE="1" EDITORDER="0 "/>
|
||||
<publicSection>class ZCL_EXCEL_WRITER_2007 definition
|
||||
public
|
||||
create public .
|
||||
|
@ -166,7 +166,7 @@ endmethod.</source>
|
|||
</interfaceMethod>
|
||||
<method CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE" VERSION="1" LANGU="E" DESCRIPT="Create Excel" EXPOSURE="1" STATE="1" EDITORDER="1 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE" SCONAME="EP_EXCEL" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="XSTRING"/>
|
||||
<source>METHOD create.
|
||||
<source>method CREATE.
|
||||
|
||||
* Office 2007 file format is a cab of several xml files with extension .xlsx
|
||||
|
||||
|
@ -359,7 +359,7 @@ endmethod.</source>
|
|||
* STEP 12: Create the final zip
|
||||
ep_excel = lo_zip->save( ).
|
||||
|
||||
ENDMETHOD.</source>
|
||||
endmethod.</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_CONTENT_TYPES" VERSION="1" LANGU="E" DESCRIPT="Create '[Content_Types].xml'" EXPOSURE="1" STATE="1" EDITORDER="2 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_CONTENT_TYPES" SCONAME="EP_CONTENT" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="XSTRING"/>
|
||||
|
@ -1090,38 +1090,95 @@ endmethod.</source>
|
|||
|
||||
|
||||
** Constant node name
|
||||
CONSTANTS: lc_xml_node_chartspace TYPE string VALUE 'c:chartSpace',
|
||||
lc_xml_node_ns_c TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/chart',
|
||||
lc_xml_node_ns_a TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/main',
|
||||
lc_xml_node_ns_r TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
|
||||
lc_xml_node_date1904 TYPE string VALUE 'c:date1904',
|
||||
lc_xml_node_lang TYPE string VALUE 'c:lang',
|
||||
lc_xml_node_roundedcorners TYPE string VALUE 'c:roundedCorners',
|
||||
lc_xml_node_altcont TYPE string VALUE 'mc:AlternateContent',
|
||||
lc_xml_node_altcont_ns_mc TYPE string VALUE 'http://schemas.openxmlformats.org/markup-compatibility/2006',
|
||||
lc_xml_node_choice TYPE string VALUE 'mc:Choice',
|
||||
lc_xml_node_choice_ns_requires TYPE string VALUE 'c14',
|
||||
lc_xml_node_choice_ns_c14 TYPE string VALUE 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart',
|
||||
lc_xml_node_style TYPE string VALUE 'c14:style',
|
||||
lc_xml_node_style_ns_val TYPE string VALUE '102',
|
||||
lc_xml_node_fallback TYPE string VALUE 'mc:Fallback',
|
||||
lc_xml_node_style2 TYPE string VALUE 'c:style',
|
||||
lc_xml_node_style2_ns_val TYPE string VALUE '2'.
|
||||
CONSTANTS: lc_xml_node_chartspace TYPE string VALUE 'c:chartSpace',
|
||||
lc_xml_node_ns_c TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/chart',
|
||||
lc_xml_node_ns_a TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/main',
|
||||
lc_xml_node_ns_r TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
|
||||
lc_xml_node_date1904 TYPE string VALUE 'c:date1904',
|
||||
lc_xml_node_lang TYPE string VALUE 'c:lang',
|
||||
lc_xml_node_roundedcorners TYPE string VALUE 'c:roundedCorners',
|
||||
lc_xml_node_altcont TYPE string VALUE 'mc:AlternateContent',
|
||||
lc_xml_node_altcont_ns_mc TYPE string VALUE 'http://schemas.openxmlformats.org/markup-compatibility/2006',
|
||||
lc_xml_node_choice TYPE string VALUE 'mc:Choice',
|
||||
lc_xml_node_choice_ns_requires TYPE string VALUE 'c14',
|
||||
lc_xml_node_choice_ns_c14 TYPE string VALUE 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart',
|
||||
lc_xml_node_style TYPE string VALUE 'c14:style',
|
||||
lc_xml_node_style_ns_val TYPE string VALUE '102',
|
||||
lc_xml_node_fallback TYPE string VALUE 'mc:Fallback',
|
||||
lc_xml_node_style2 TYPE string VALUE 'c:style',
|
||||
lc_xml_node_style2_ns_val TYPE string VALUE '2',
|
||||
|
||||
"---------------------------CHART
|
||||
lc_xml_node_chart TYPE string VALUE 'c:chart',
|
||||
lc_xml_node_autoTitleDeleted TYPE string VALUE 'c:autoTitleDeleted',
|
||||
"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_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_val TYPE string VALUE 'c:val',
|
||||
lc_xml_node_numRef TYPE string VALUE 'c:numRef',
|
||||
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',
|
||||
"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',
|
||||
"legend
|
||||
lc_xml_node_legend TYPE string VALUE 'c:legend',
|
||||
"legend->pie
|
||||
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_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',
|
||||
"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',
|
||||
"---------------------------END OF CHART
|
||||
|
||||
lc_xml_node_printsettings TYPE string VALUE 'c:printSettings',
|
||||
lc_xml_node_headerfooter TYPE string VALUE 'c:headerFooter',
|
||||
lc_xml_node_pagemargins TYPE string VALUE 'c:pageMargins',
|
||||
lc_xml_node_pagesetup TYPE string VALUE 'c:pageSetup'.
|
||||
|
||||
|
||||
DATA: lo_ixml TYPE REF TO if_ixml,
|
||||
lo_document TYPE REF TO if_ixml_document,
|
||||
lo_element_root TYPE REF TO if_ixml_element,
|
||||
lo_element_cellanchor TYPE REF TO if_ixml_element,
|
||||
lo_encoding TYPE REF TO if_ixml_encoding,
|
||||
lo_streamfactory TYPE REF TO if_ixml_stream_factory,
|
||||
lo_ostream TYPE REF TO if_ixml_ostream,
|
||||
lo_renderer TYPE REF TO if_ixml_renderer.
|
||||
DATA: lv_rel_id TYPE i.
|
||||
DATA: lo_ixml TYPE REF TO if_ixml,
|
||||
lo_document TYPE REF TO if_ixml_document,
|
||||
lo_element_root TYPE REF TO if_ixml_element,
|
||||
lo_element_cellanchor TYPE REF TO if_ixml_element,
|
||||
lo_encoding TYPE REF TO if_ixml_encoding,
|
||||
lo_streamfactory TYPE REF TO if_ixml_stream_factory,
|
||||
lo_ostream TYPE REF TO if_ixml_ostream,
|
||||
lo_renderer TYPE REF TO if_ixml_renderer.
|
||||
DATA: lv_rel_id TYPE i.
|
||||
|
||||
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_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_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.
|
||||
DATA lo_element7 TYPE REF TO if_ixml_element.
|
||||
|
||||
**********************************************************************
|
||||
* STEP 1: Create [Content_Types].xml into the root of the ZIP
|
||||
|
@ -1149,6 +1206,21 @@ endmethod.</source>
|
|||
**********************************************************************
|
||||
* STEP 4: Create chart
|
||||
|
||||
DATA lo_chartb TYPE REF TO zcl_excel_graph_bars.
|
||||
DATA lo_chartp TYPE REF TO zcl_excel_graph_pie.
|
||||
|
||||
"Identify chart type
|
||||
CASE io_drawing->graph_type.
|
||||
WHEN zcl_excel_drawing=>c_graph_bars.
|
||||
lo_chartb ?= io_drawing->graph.
|
||||
WHEN zcl_excel_drawing=>c_graph_pie.
|
||||
lo_chartp ?= io_drawing->graph.
|
||||
|
||||
|
||||
|
||||
WHEN OTHERS.
|
||||
ENDCASE.
|
||||
|
||||
DATA lo_chart TYPE REF TO zcl_excel_graph.
|
||||
lo_chart = io_drawing->graph.
|
||||
|
||||
|
@ -1180,7 +1252,7 @@ endmethod.</source>
|
|||
lo_element2->set_attribute_ns( name = 'xmlns:c14'
|
||||
value = lc_xml_node_choice_ns_c14 ).
|
||||
|
||||
"C14:style
|
||||
"C14:style
|
||||
lo_element3 = lo_document->create_simple_element( name = lc_xml_node_style
|
||||
parent = lo_element2 ).
|
||||
lo_element3->set_attribute_ns( name = 'val'
|
||||
|
@ -1196,23 +1268,169 @@ endmethod.</source>
|
|||
lo_element3->set_attribute_ns( name = 'val'
|
||||
value = lc_xml_node_style2_ns_val ).
|
||||
|
||||
DATA lo_chartb TYPE REF TO zcl_excel_graph_bars.
|
||||
DATA lo_chartp TYPE REF TO zcl_excel_graph_pie.
|
||||
"---------------------------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
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
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.
|
||||
|
||||
CASE io_drawing->graph_type.
|
||||
WHEN zcl_excel_drawing=>c_graph_bars.
|
||||
lo_chartb ?= io_drawing->graph.
|
||||
WHEN zcl_excel_drawing=>c_graph_pie.
|
||||
lo_chartp ?= io_drawing->graph.
|
||||
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'val'
|
||||
value = lo_chart->ns_showDLblsOverMaxval ).
|
||||
"---------------------------END OF CHART
|
||||
|
||||
"printSettings
|
||||
lo_element = lo_document->create_simple_element( name = lc_xml_node_printsettings
|
||||
parent = lo_element_root ).
|
||||
"headerFooter
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_headerfooter
|
||||
parent = lo_element ).
|
||||
"pageMargins
|
||||
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_pagemargins
|
||||
parent = lo_element ).
|
||||
lo_element2->set_attribute_ns( name = 'b'
|
||||
value = lo_chart->pagemargins-b ).
|
||||
lo_element2->set_attribute_ns( name = 'l'
|
||||
value = lo_chart->pagemargins-l ).
|
||||
lo_element2->set_attribute_ns( name = 'r'
|
||||
value = lo_chart->pagemargins-r ).
|
||||
lo_element2->set_attribute_ns( name = 't'
|
||||
value = lo_chart->pagemargins-t ).
|
||||
lo_element2->set_attribute_ns( name = 'header'
|
||||
value = lo_chart->pagemargins-header ).
|
||||
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
|
||||
parent = lo_element ).
|
||||
|
||||
**********************************************************************
|
||||
* STEP 5: Create xstring stream
|
||||
|
@ -1986,7 +2204,7 @@ endmethod.</source>
|
|||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_SHEET" SCONAME="IV_ACTIVE" VERSION="1" LANGU="E" DESCRIPT="General Flag" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="FLAG" PARVALUE="''"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_SHEET" SCONAME="EP_CONTENT" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="XSTRING"/>
|
||||
<exception CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_SHEET" SCONAME="ZCX_EXCEL" VERSION="1" LANGU="E" DESCRIPT="Exceptions for ABAP2XLSX" MTDTYPE="0" EDITORDER="1 "/>
|
||||
<source>METHOD create_xl_sheet.
|
||||
<source>method CREATE_XL_SHEET.
|
||||
*--------------------------------------------------------------------*
|
||||
* issue #237 - Error writing column-style
|
||||
* - Stefan Schmöcker, 2012-11-01
|
||||
|
@ -3594,7 +3812,7 @@ endmethod.</source>
|
|||
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
|
||||
lo_renderer->render( ).
|
||||
|
||||
ENDMETHOD.</source>
|
||||
endmethod.</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_SHEET_RELS" VERSION="1" LANGU="E" DESCRIPT="Create 'xl/workbook/_rels/sheet.xml.rels'" EXPOSURE="1" STATE="1" EDITORDER="13 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_SHEET_RELS" SCONAME="IO_WORKSHEET" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET"/>
|
||||
|
@ -4999,7 +5217,7 @@ endmethod.</source>
|
|||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_WORKBOOK" VERSION="1" LANGU="E" DESCRIPT="Create 'xl/workbook.xml'" EXPOSURE="1" STATE="1" EDITORDER="18 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="CREATE_XL_WORKBOOK" SCONAME="EP_CONTENT" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="XSTRING"/>
|
||||
<source>METHOD create_xl_workbook.
|
||||
<source>method CREATE_XL_WORKBOOK.
|
||||
*--------------------------------------------------------------------*
|
||||
* issue #230 - Pimp my Code
|
||||
* - Stefan Schmöcker, (done) 2012-11-07
|
||||
|
@ -5316,7 +5534,7 @@ endmethod.</source>
|
|||
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
|
||||
lo_renderer->render( ).
|
||||
|
||||
ENDMETHOD.</source>
|
||||
endmethod.</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="FLAG2BOOL" VERSION="1" LANGU="E" DESCRIPT="Convert a FLAG to BOOLEAN value" EXPOSURE="0" STATE="1" EDITORDER="19 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_WRITER_2007" CMPNAME="FLAG2BOOL" SCONAME="IP_FLAG" VERSION="1" LANGU="E" DESCRIPT="General Flag" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="FLAG"/>
|
||||
|
|
|
@ -23,11 +23,16 @@ DATA: lo_excel TYPE REF TO zcl_excel,
|
|||
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||
lo_drawing TYPE REF TO zcl_excel_drawing.
|
||||
|
||||
DATA lv_value TYPE i.
|
||||
|
||||
DATA: ls_io TYPE skwf_io.
|
||||
|
||||
DATA: ls_upper TYPE ZEXCEL_DRAWING_LOCATION,
|
||||
ls_lower TYPE ZEXCEL_DRAWING_LOCATION.
|
||||
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_pie TYPE REF TO zcl_excel_graph_pie.
|
||||
DATA lv_media TYPE xstring.
|
||||
|
||||
CONSTANTS: gc_save_file_name TYPE string VALUE '39_Charts.xlsx'.
|
||||
INCLUDE zdemo_excel_outputopt_incl.
|
||||
|
@ -41,22 +46,28 @@ START-OF-SELECTION.
|
|||
lo_worksheet = lo_excel->get_active_worksheet( ).
|
||||
lo_worksheet->set_title( 'Sheet1' ).
|
||||
|
||||
" create global drawing, set position and media from web repository
|
||||
" Set values for chart
|
||||
lv_value = 1.
|
||||
lo_worksheet->set_cell( ip_column = 'J' ip_row = 1 ip_value = lv_value ).
|
||||
lv_value = 2.
|
||||
lo_worksheet->set_cell( ip_column = 'J' ip_row = 2 ip_value = lv_value ).
|
||||
lv_value = 3.
|
||||
lo_worksheet->set_cell( ip_column = 'J' ip_row = 3 ip_value = lv_value ).
|
||||
|
||||
" Create a pie chart and assign value range
|
||||
CREATE OBJECT lo_pie.
|
||||
lo_pie->ref = 'Sheet1!$J$1:$J$3'. "VALUE RANGE FOR CHART
|
||||
|
||||
" 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 = 'titolografico' ).
|
||||
|
||||
data lo_bar type ref to ZCL_EXCEL_GRAPH_BARS.
|
||||
|
||||
create object lo_bar.
|
||||
|
||||
lo_bar->REF = ''. "VALUE RANGE FOR CHART
|
||||
|
||||
lo_drawing->graph = lo_bar.
|
||||
ip_title = 'CHART TITLE' ).
|
||||
lo_drawing->graph = lo_pie.
|
||||
lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie.
|
||||
|
||||
"Set chart position (anchor 2 cells)
|
||||
ls_lower-row = 10.
|
||||
ls_lower-col = 10.
|
||||
|
||||
lo_drawing->set_position2(
|
||||
EXPORTING
|
||||
ip_from = ls_upper
|
||||
|
@ -64,10 +75,10 @@ START-OF-SELECTION.
|
|||
|
||||
lo_drawing->set_media(
|
||||
EXPORTING
|
||||
ip_media = '0' "usato per il template
|
||||
ip_media = lv_media "used for template (binary content)
|
||||
ip_media_type = 'xml'
|
||||
ip_width = 0 "usati solo per le immagini
|
||||
ip_height = 0 ). "usati solo per le immagini
|
||||
ip_width = 0 "used only for image types, not for charts
|
||||
ip_height = 0 ). "used only for image types, not for charts
|
||||
|
||||
|
||||
lo_worksheet->add_drawing( lo_drawing ).
|
||||
|
|
Loading…
Reference in New Issue
Block a user