Removed also issue with style class
This commit is contained in:
Ivan Femia 2017-05-20 00:42:59 +02:00
parent 6c124bf61d
commit d4464072c1
4 changed files with 53 additions and 44 deletions

View File

@ -14,12 +14,6 @@ public section.
data SECURITY type ref to ZCL_EXCEL_SECURITY . data SECURITY type ref to ZCL_EXCEL_SECURITY .
data USE_TEMPLATE type XFELD . data USE_TEMPLATE type XFELD .
methods SET_THEME
importing
!IO_THEME type ref to ZCL_EXCEL_THEME .
methods GET_THEME
exporting
!EO_THEME type ref to ZCL_EXCEL_THEME .
methods ADD_NEW_AUTOFILTER methods ADD_NEW_AUTOFILTER
importing importing
!IO_SHEET type ref to ZCL_EXCEL_WORKSHEET !IO_SHEET type ref to ZCL_EXCEL_WORKSHEET
@ -55,12 +49,12 @@ public section.
!IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET
raising raising
ZCX_EXCEL . ZCX_EXCEL .
methods DELETE_WORKSHEET_BY_NAME
importing
!IV_TITLE type CLIKE .
methods DELETE_WORKSHEET_BY_INDEX methods DELETE_WORKSHEET_BY_INDEX
importing importing
!IV_INDEX type NUMERIC . !IV_INDEX type NUMERIC .
methods DELETE_WORKSHEET_BY_NAME
importing
!IV_TITLE type CLIKE .
methods GET_ACTIVE_SHEET_INDEX methods GET_ACTIVE_SHEET_INDEX
returning returning
value(R_ACTIVE_WORKSHEET) type ZEXCEL_ACTIVE_WORKSHEET . value(R_ACTIVE_WORKSHEET) type ZEXCEL_ACTIVE_WORKSHEET .
@ -107,6 +101,9 @@ public section.
value(EP_STYLEMAPPING) type ZEXCEL_S_STYLEMAPPING value(EP_STYLEMAPPING) type ZEXCEL_S_STYLEMAPPING
raising raising
ZCX_EXCEL . ZCX_EXCEL .
methods GET_THEME
exporting
!EO_THEME type ref to ZCL_EXCEL_THEME .
methods GET_WORKSHEETS_ITERATOR methods GET_WORKSHEETS_ITERATOR
returning returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
@ -116,16 +113,16 @@ public section.
methods GET_WORKSHEETS_SIZE methods GET_WORKSHEETS_SIZE
returning returning
value(EP_SIZE) type I . value(EP_SIZE) type I .
methods GET_WORKSHEET_BY_NAME
importing
!IP_SHEET_NAME type ZEXCEL_SHEET_TITLE
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
methods GET_WORKSHEET_BY_INDEX methods GET_WORKSHEET_BY_INDEX
importing importing
!IV_INDEX type NUMERIC !IV_INDEX type NUMERIC
returning returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET . value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
methods GET_WORKSHEET_BY_NAME
importing
!IP_SHEET_NAME type ZEXCEL_SHEET_TITLE
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
methods SET_ACTIVE_SHEET_INDEX methods SET_ACTIVE_SHEET_INDEX
importing importing
!I_ACTIVE_WORKSHEET type ZEXCEL_ACTIVE_WORKSHEET !I_ACTIVE_WORKSHEET type ZEXCEL_ACTIVE_WORKSHEET
@ -139,6 +136,9 @@ public section.
!IP_STYLE type ZEXCEL_CELL_STYLE !IP_STYLE type ZEXCEL_CELL_STYLE
raising raising
ZCX_EXCEL . ZCX_EXCEL .
methods SET_THEME
importing
!IO_THEME type ref to ZCL_EXCEL_THEME .
*"* protected components of class ZCL_EXCEL *"* protected components of class ZCL_EXCEL
*"* do not include other source files here!!! *"* do not include other source files here!!!
protected section. protected section.
@ -159,6 +159,11 @@ private section.
data T_STYLEMAPPING2 type ZEXCEL_T_STYLEMAPPING2 . data T_STYLEMAPPING2 type ZEXCEL_T_STYLEMAPPING2 .
data THEME type ref to ZCL_EXCEL_THEME . data THEME type ref to ZCL_EXCEL_THEME .
methods GET_STYLE_FROM_GUID
importing
!IP_GUID type ZEXCEL_CELL_STYLE
returning
value(EO_STYLE) type ref to ZCL_EXCEL_STYLE .
methods STYLEMAPPING_DYNAMIC_STYLE methods STYLEMAPPING_DYNAMIC_STYLE
importing importing
!IP_STYLE type ref to ZCL_EXCEL_STYLE !IP_STYLE type ref to ZCL_EXCEL_STYLE
@ -436,6 +441,23 @@ method GET_STYLES_ITERATOR.
endmethod. endmethod.
METHOD get_style_from_guid.
DATA: lo_style TYPE REF TO zcl_excel_style,
lo_iterator TYPE REF TO cl_object_collection_iterator.
lo_iterator = styles->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_style ?= lo_iterator->get_next( ).
IF lo_style->get_guid( ) = ip_guid.
eo_style = lo_style.
RETURN.
ENDIF.
ENDWHILE.
ENDMETHOD.
method GET_STYLE_INDEX_IN_STYLES. method GET_STYLE_INDEX_IN_STYLES.
DATA: index TYPE syindex. DATA: index TYPE syindex.
DATA: lo_iterator TYPE REF TO cl_object_collection_iterator, DATA: lo_iterator TYPE REF TO cl_object_collection_iterator,
@ -464,9 +486,9 @@ method GET_STYLE_INDEX_IN_STYLES.
endmethod. endmethod.
method GET_STYLE_TO_GUID. METHOD get_style_to_guid.
DATA: lo_style TYPE REF TO zcl_excel_style.
" # issue 139 " # issue 139
READ TABLE me->t_stylemapping2 INTO ep_stylemapping WITH TABLE KEY guid = ip_guid. READ TABLE me->t_stylemapping2 INTO ep_stylemapping WITH TABLE KEY guid = ip_guid.
IF sy-subrc <> 0. IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_excel RAISE EXCEPTION TYPE zcx_excel
@ -475,13 +497,12 @@ method GET_STYLE_TO_GUID.
ENDIF. ENDIF.
IF ep_stylemapping-dynamic_style_guid IS NOT INITIAL. IF ep_stylemapping-dynamic_style_guid IS NOT INITIAL.
zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = ep_stylemapping-cl_style lo_style = me->get_style_from_guid( ip_guid ).
zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = lo_style
CHANGING e_target = ep_stylemapping-complete_style CHANGING e_target = ep_stylemapping-complete_style
e_targetx = ep_stylemapping-complete_stylex ). e_targetx = ep_stylemapping-complete_stylex ).
ENDIF. ENDIF.
ENDMETHOD.
endmethod.
method GET_THEME. method GET_THEME.
@ -598,7 +619,6 @@ method STYLEMAPPING_DYNAMIC_STYLE.
eo_style2-dynamic_style_guid = ip_style->get_guid( ). eo_style2-dynamic_style_guid = ip_style->get_guid( ).
eo_style2-guid = eo_style2-dynamic_style_guid. eo_style2-guid = eo_style2-dynamic_style_guid.
eo_style2-added_to_iterator = abap_true. eo_style2-added_to_iterator = abap_true.
eo_style2-cl_style = ip_style.
* don't care about attributes here, since this data may change * don't care about attributes here, since this data may change
* dynamically * dynamically

View File

@ -286,6 +286,12 @@
<LANGU>I</LANGU> <LANGU>I</LANGU>
<DESCRIPT>Get styles iterator</DESCRIPT> <DESCRIPT>Get styles iterator</DESCRIPT>
</SEOCOMPOTX> </SEOCOMPOTX>
<SEOCOMPOTX>
<CLSNAME>ZCL_EXCEL</CLSNAME>
<CMPNAME>GET_STYLE_FROM_GUID</CMPNAME>
<LANGU>E</LANGU>
<DESCRIPT>Return a style object from a GUID</DESCRIPT>
</SEOCOMPOTX>
<SEOCOMPOTX> <SEOCOMPOTX>
<CLSNAME>ZCL_EXCEL</CLSNAME> <CLSNAME>ZCL_EXCEL</CLSNAME>
<CMPNAME>GET_STYLE_INDEX_IN_STYLES</CMPNAME> <CMPNAME>GET_STYLE_INDEX_IN_STYLES</CMPNAME>

View File

@ -49,11 +49,9 @@ ENDCLASS.
CLASS ZCL_EXCEL_STYLES IMPLEMENTATION. CLASS ZCL_EXCEL_STYLES IMPLEMENTATION.
method ADD. METHOD add.
styles->add( ip_style ). styles->add( ip_style ).
endmethod. ENDMETHOD.
method CLEAR. method CLEAR.
@ -70,11 +68,9 @@ method CONSTRUCTOR.
endmethod. endmethod.
method GET. METHOD get.
eo_style ?= styles->if_object_collection~get( ip_index ). eo_style ?= styles->if_object_collection~get( ip_index ).
endmethod. ENDMETHOD.
method GET_ITERATOR. method GET_ITERATOR.
@ -91,12 +87,10 @@ method IS_EMPTY.
endmethod. endmethod.
method REGISTER_NEW_STYLE. METHOD register_new_style.
me->add( io_style ). me->add( io_style ).
ep_style_code = me->size( ) - 1. "style count starts from 0 ep_style_code = me->size( ) - 1. "style count starts from 0
endmethod. ENDMETHOD.
method REMOVE. method REMOVE.

View File

@ -56,17 +56,6 @@
<SHLPORIGIN>F</SHLPORIGIN> <SHLPORIGIN>F</SHLPORIGIN>
<COMPTYPE>E</COMPTYPE> <COMPTYPE>E</COMPTYPE>
</DD03P> </DD03P>
<DD03P>
<TABNAME>ZEXCEL_S_STYLEMAPPING</TABNAME>
<FIELDNAME>CL_STYLE</FIELDNAME>
<POSITION>0194</POSITION>
<ROLLNAME>ZCL_EXCEL_STYLE</ROLLNAME>
<ADMINFIELD>0</ADMINFIELD>
<DATATYPE>REF</DATATYPE>
<MASK> REF RC</MASK>
<COMPTYPE>R</COMPTYPE>
<REFTYPE>C</REFTYPE>
</DD03P>
</DD03P_TABLE> </DD03P_TABLE>
<DD05M_TABLE/> <DD05M_TABLE/>
<DD08V_TABLE/> <DD08V_TABLE/>