class ZCL_EXCEL definition
public
final
create public .
*"* public components of class ZCL_EXCEL
*"* do not include other source files here!!!
public section.
data PROPERTIES type ref to ZCL_EXCEL_PROPERTIES .
data SECURITY type ref to ZCL_EXCEL_SECURITY .
methods ADD_NEW_DRAWING
importing
!IP_TITLE type ZEXCEL_SHEET_TITLE optional
returning
value(EO_DRAWING) type ref to ZCL_EXCEL_DRAWING .
methods ADD_NEW_RANGE
returning
value(EO_RANGE) type ref to ZCL_EXCEL_RANGE .
methods ADD_NEW_STYLE
returning
value(EO_STYLE) type ref to ZCL_EXCEL_STYLE .
methods ADD_NEW_WORKSHEET
importing
!IP_TITLE type ZEXCEL_SHEET_TITLE optional
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
methods CONSTRUCTOR .
methods GET_ACTIVE_WORKSHEET
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
methods GET_DRAWINGS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_RANGES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_STYLES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_WORKSHEETS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_WORKSHEETS_NAME
returning
value(EP_NAME) type ZEXCEL_WORKSHEETS_NAME .
methods GET_WORKSHEETS_SIZE
returning
value(EP_SIZE) type I .
methods GET_NEXT_TABLE_ID
returning
value(EP_ID) type I .*"* protected components of class ZCL_EXCEL
*"* do not include other source files here!!!
protected section.*"* private components of class ZCL_EXCEL
*"* do not include other source files here!!!
private section.
data DRAWINGS type ref to ZCL_EXCEL_DRAWINGS .
data RANGES type ref to ZCL_EXCEL_RANGES .
data STYLES type ref to ZCL_EXCEL_STYLES .
data WORKSHEETS type ref to ZCL_EXCEL_WORKSHEETS .*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature*"* use this source file for any macro definitions you need
*"* in the implementation part of the classmethod ADD_NEW_DRAWING.
DATA: lv_guid TYPE guid_16.
* Create default blank worksheet
CREATE OBJECT eo_drawing
EXPORTING
ip_title = ip_title.
drawings->add( eo_drawing ).
endmethod.method ADD_NEW_RANGE.
* Create default blank range
CREATE OBJECT eo_range.
ranges->add( eo_range ).
endmethod.method ADD_NEW_STYLE.
* Create default style
CREATE OBJECT eo_style.
styles->add( eo_style ).
endmethod.method ADD_NEW_WORKSHEET.
DATA: lv_guid TYPE guid_16.
* Create default blank worksheet
CREATE OBJECT eo_worksheet
EXPORTING
ip_excel = me
ip_title = ip_title.
worksheets->add( eo_worksheet ).
worksheets->active_worksheet = worksheets->size( ).
endmethod.method CONSTRUCTOR.
DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style TYPE REF TO zcl_excel_style.
* Inizialize instance objects
CREATE OBJECT properties.
CREATE OBJECT security.
CREATE OBJECT worksheets.
CREATE OBJECT ranges.
CREATE OBJECT styles.
CREATE OBJECT drawings.
me->add_new_worksheet( ).
me->add_new_style( ). " Standard style
lo_style = me->add_new_style( ). " Standard style with fill gray125
lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_pattern_gray125.
endmethod.method GET_ACTIVE_WORKSHEET.
eo_worksheet = me->worksheets->get( me->worksheets->active_worksheet ).
endmethod.method GET_DRAWINGS_ITERATOR.
eo_iterator = me->drawings->get_iterator( ).
endmethod.method GET_NEXT_TABLE_ID.
DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_iterator TYPE REF TO cl_object_collection_iterator,
lv_tables_count TYPE i.
lo_iterator = me->get_worksheets_iterator( ).
WHILE lo_iterator->has_next( ) EQ abap_true.
lo_worksheet ?= lo_iterator->get_next( ).
lv_tables_count = lo_worksheet->get_tables_size( ).
ADD lv_tables_count TO ep_id.
ENDWHILE.
ADD 1 TO ep_id.
endmethod.method GET_RANGES_ITERATOR.
eo_iterator = me->ranges->get_iterator( ).
endmethod.method GET_STYLES_ITERATOR.
eo_iterator = me->styles->get_iterator( ).
endmethod.method GET_WORKSHEETS_ITERATOR.
eo_iterator = me->worksheets->get_iterator( ).
endmethod.method GET_WORKSHEETS_NAME.
ep_name = me->worksheets->name.
endmethod.method GET_WORKSHEETS_SIZE.
ep_size = me->worksheets->size( ).
endmethod.