Skip to content

Commit

Permalink
Fix #489
Browse files Browse the repository at this point in the history
Thanks to @Gh14Cc10
  • Loading branch information
ivanfemia committed Nov 15, 2017
1 parent 5e6bb3b commit e71644d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 30 deletions.
3 changes: 0 additions & 3 deletions src/package.devc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<asx:values>
<DEVC>
<CTEXT>Spreadsheet libraries</CTEXT>
<PDEVCLASS>ZTIR</PDEVCLASS>
<TRANSLATION_DEPTH>NOT_CLASSIFIED</TRANSLATION_DEPTH>
<TRANSLATION_DEPTH_TEXT>Not Classified</TRANSLATION_DEPTH_TEXT>
</DEVC>
<PERMISSION>
<SCOMPPDTLN>
Expand Down
35 changes: 22 additions & 13 deletions src/zcl_excel_drawing.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ method GET_WIDTH_EMU_STR.
endmethod.


method LOAD_CHART_ATTRIBUTES.
METHOD load_chart_attributes.
DATA: node TYPE REF TO if_ixml_element.
DATA: node2 TYPE REF TO if_ixml_element.
DATA: node3 TYPE REF TO if_ixml_element.
Expand Down Expand Up @@ -424,6 +424,15 @@ method LOAD_CHART_ATTRIBUTES.
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
me->graph->ns_styleval = ls_prop-val.
"---------------------------Read graph properties
"ADDED
CLEAR node2.
node2 ?= node->find_from_name( name = 'title' namespace = 'c' ).
IF node2 IS BOUND AND node2 IS NOT INITIAL.
node3 ?= node2->find_from_name( name = 't' namespace = 'a' ).
me->graph->title = node3->get_value( ).
ENDIF.
"END

node2 ?= node->find_from_name( name = 'autoTitleDeleted' namespace = 'c' ).
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
me->graph->ns_autotitledeletedval = ls_prop-val.
Expand Down Expand Up @@ -781,13 +790,13 @@ method LOAD_CHART_ATTRIBUTES.
ENDIF.
CALL METHOD lo_linechart->create_serie
EXPORTING
ip_idx = lv_idx
ip_order = lv_order
ip_symbol = lv_symbol
ip_smooth = lv_smooth
ip_lbl = lv_label
ip_ref = lv_value
ip_sername = lv_sername.
ip_idx = lv_idx
ip_order = lv_order
ip_symbol = lv_symbol
ip_smooth = lv_smooth
ip_lbl = lv_label
ip_ref = lv_value
ip_sername = lv_sername.
lo_node = lo_iterator->get_next( ).
IF lo_node IS BOUND.
node2 ?= lo_node->query_interface( ixml_iid_element ).
Expand All @@ -814,12 +823,12 @@ method LOAD_CHART_ATTRIBUTES.
lo_linechart->ns_showbubblesizeval = ls_prop-val.

node ?= node->find_from_name( name = 'lineChart' namespace = 'c' ).
node2 ?= node->find_from_name( name = 'marker' namespace = 'c' DEPTH = '1' ).
node2 ?= node->find_from_name( name = 'marker' namespace = 'c' depth = '1' ).
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
lo_linechart->NS_MARKERVAL = ls_prop-val.
node2 ?= node->find_from_name( name = 'smooth' namespace = 'c' DEPTH = '1' ).
lo_linechart->ns_markerval = ls_prop-val.
node2 ?= node->find_from_name( name = 'smooth' namespace = 'c' depth = '1' ).
zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ).
lo_linechart->NS_SMOOTHVAL = ls_prop-val.
lo_linechart->ns_smoothval = ls_prop-val.
node ?= ip_chart->if_ixml_node~get_first_child( ).
CHECK node IS NOT INITIAL.

Expand Down Expand Up @@ -1008,7 +1017,7 @@ method LOAD_CHART_ATTRIBUTES.
me->graph->pagemargins = ls_pagemargins.


endmethod.
ENDMETHOD.


method PIXEL2EMU.
Expand Down
29 changes: 19 additions & 10 deletions src/zcl_excel_graph.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ public section.
footer TYPE string,
END OF s_pagemargins .

data NS_1904VAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " .
data NS_LANGVAL type STRING value 'it-IT'. "#EC NOTEXT . . . . . . . . . . " .
data NS_ROUNDEDCORNERSVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " .
data NS_1904VAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_LANGVAL type STRING value 'it-IT'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_ROUNDEDCORNERSVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data PAGEMARGINS type S_PAGEMARGINS .
data NS_AUTOTITLEDELETEDVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " .
data NS_PLOTVISONLYVAL type STRING value '1'. "#EC NOTEXT . . . . . . . . . . " .
data NS_DISPBLANKSASVAL type STRING value 'gap'. "#EC NOTEXT . . . . . . . . . . " .
data NS_SHOWDLBLSOVERMAXVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . " .
data NS_AUTOTITLEDELETEDVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_PLOTVISONLYVAL type STRING value '1'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_DISPBLANKSASVAL type STRING value 'gap'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_SHOWDLBLSOVERMAXVAL type STRING value '0'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data TITLE type STRING . . . " .
data SERIES type T_SERIES .
data NS_C14STYLEVAL type STRING value '102'. "#EC NOTEXT . . . . . . . . . . " .
data PRINT_LABEL type C value 'X'. "#EC NOTEXT . . . . . . . . . . " .
data NS_STYLEVAL type STRING value '2'. "#EC NOTEXT . . . . . . . . . . " .
data NS_C14STYLEVAL type STRING value '102'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data PRINT_LABEL type C value 'X'. "#EC NOTEXT . . . . . . . . . . . . . . " .
data NS_STYLEVAL type STRING value '2'. "#EC NOTEXT . . . . . . . . . . . . . . " .
constants:
BEGIN OF c_style_default,
c14style type i value 102,
Expand Down Expand Up @@ -317,6 +318,9 @@ public section.
methods SET_PRINT_LBL
importing
!IP_VALUE type C .
methods SET_TITLE
importing
value(IP_VALUE) type STRING .
protected section.
*"* protected components of class ZCL_EXCEL_GRAPH
*"* do not include other source files here!!!
Expand Down Expand Up @@ -398,4 +402,9 @@ method SET_STYLE.
me->ns_styleval = ip_style-cstyle.
CONDENSE me->ns_styleval NO-GAPS.
endmethod.


method SET_TITLE.
me->title = ip_value.
endmethod.
ENDCLASS.
37 changes: 33 additions & 4 deletions src/zcl_excel_writer_2007.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ method CREATE_RELATIONSHIPS.
endmethod.


method CREATE_XL_CHARTS.
METHOD create_xl_charts.


** Constant node name
Expand Down Expand Up @@ -1444,6 +1444,35 @@ method CREATE_XL_CHARTS.
"---------------------------CHART
lo_element = lo_document->create_simple_element( name = lc_xml_node_chart
parent = lo_element_root ).
"Added
IF lo_chart->title IS NOT INITIAL.
lo_element2 = lo_document->create_simple_element( name = 'c:title'
parent = lo_element ).
lo_element3 = lo_document->create_simple_element( name = 'c:tx'
parent = lo_element2 ).
lo_element4 = lo_document->create_simple_element( name = 'c:rich'
parent = lo_element3 ).
lo_element5 = lo_document->create_simple_element( name = 'a:bodyPr'
parent = lo_element4 ).
lo_element5 = lo_document->create_simple_element( name = 'a:lstStyle'
parent = lo_element4 ).
lo_element5 = lo_document->create_simple_element( name = 'a:p'
parent = lo_element4 ).
lo_element6 = lo_document->create_simple_element( name = 'a:pPr'
parent = lo_element5 ).
lo_element7 = lo_document->create_simple_element( name = 'a:defRPr'
parent = lo_element6 ).
lo_element6 = lo_document->create_simple_element( name = 'a:r'
parent = lo_element5 ).
lo_element7 = lo_document->create_simple_element( name = 'a:rPr'
parent = lo_element6 ).
lo_element7->set_attribute_ns( name = 'lang'
value = 'en-US' ).
lo_element7 = lo_document->create_simple_element( name = 'a:t'
parent = lo_element6 ).
lo_element7->set_value( value = lo_chart->title ).
ENDIF.
"End
lo_element2 = lo_document->create_simple_element( name = lc_xml_node_autotitledeleted
parent = lo_element ).
lo_element2->set_attribute_ns( name = 'val'
Expand Down Expand Up @@ -1883,11 +1912,11 @@ method CREATE_XL_CHARTS.
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_marker
parent = lo_element3 ).
lo_element4->set_attribute_ns( name = 'val'
value = lo_chartl->NS_MARKERVAL ).
value = lo_chartl->ns_markerval ).
lo_element4 = lo_document->create_simple_element( name = lc_xml_node_smooth
parent = lo_element3 ).
lo_element4->set_attribute_ns( name = 'val'
value = lo_chartl->NS_SMOOTHVAL ).
value = lo_chartl->ns_smoothval ).

"axes
lo_el_rootchart = lo_element3.
Expand Down Expand Up @@ -2130,7 +2159,7 @@ method CREATE_XL_CHARTS.
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).

endmethod.
ENDMETHOD.


method CREATE_XL_DRAWINGS.
Expand Down
1 change: 1 addition & 0 deletions src/zdemo_excel39.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ START-OF-SELECTION.

" Set style
lo_bar1->set_style( zcl_excel_graph=>c_style_default ).
lo_bar1->set_title( ip_value = 'TITLE!' ).

" Set label to none
lo_bar1->set_print_lbl( zcl_excel_graph_bars=>c_show_false ).
Expand Down

0 comments on commit e71644d

Please sign in to comment.