This commit is contained in:
szelbi 2022-08-23 16:33:28 +02:00 committed by GitHub
commit a630f84b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 798 additions and 77 deletions

View File

@ -48,6 +48,13 @@ CLASS zcl_excel DEFINITION
VALUE(eo_worksheet) TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel .
METHODS clone_worksheet
IMPORTING
!io_worksheet TYPE REF TO zcl_excel_worksheet
RETURNING
VALUE(ro_worksheet) TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel.
METHODS add_static_styles .
METHODS constructor .
METHODS delete_worksheet
@ -263,6 +270,48 @@ CLASS zcl_excel IMPLEMENTATION.
ENDMETHOD.
METHOD clone_worksheet.
DATA lo_worksheet_clone TYPE REF TO zcl_excel_worksheet.
DATA lv_old_title TYPE zexcel_sheet_title.
DATA lv_new_title TYPE zexcel_sheet_title.
DATA lo_ranges_iterator TYPE REF TO zcl_excel_collection_iterator.
DATA lo_range TYPE REF TO zcl_excel_range.
DATA ls_range_sheet_title TYPE zcl_excel_range=>ts_sheet_title.
DATA lo_range_clone TYPE REF TO zcl_excel_range.
DATA lo_range_clones TYPE STANDARD TABLE OF REF TO zcl_excel_range.
lo_worksheet_clone ?= io_worksheet->clone( ).
lv_old_title = io_worksheet->get_title( ).
lv_new_title = lo_worksheet_clone->get_title( ).
lo_ranges_iterator = get_ranges_iterator( ).
WHILE lo_ranges_iterator->has_next( ) = abap_true.
lo_range ?= lo_ranges_iterator->get_next( ).
ls_range_sheet_title = lo_range->get_sheet_title( ).
IF ls_range_sheet_title-title <> lv_old_title.
CONTINUE.
ENDIF.
lo_range_clone ?= lo_range->clone( ).
lo_range_clone->replace_sheet_title( lv_new_title ).
INSERT lo_range_clone INTO TABLE lo_range_clones.
ENDWHILE.
LOOP AT lo_range_clones INTO lo_range_clone.
ranges->add( lo_range_clone ).
ENDLOOP.
worksheets->add( lo_worksheet_clone ).
worksheets->active_worksheet = worksheets->size( ).
ro_worksheet = lo_worksheet_clone.
ENDMETHOD.
METHOD add_static_styles.
" # issue 139
FIELD-SYMBOLS: <style1> LIKE LINE OF t_stylemapping1,

View File

@ -0,0 +1,23 @@
"! <p class="shorttext synchronized" lang="en">Base class for Excel components and groups of components</p>
CLASS zcl_excel_base DEFINITION
PUBLIC
ABSTRACT
CREATE PROTECTED.
PUBLIC SECTION.
METHODS clone
ABSTRACT
RETURNING
VALUE(ro_object) TYPE REF TO zcl_excel_base
RAISING
zcx_excel.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_excel_base IMPLEMENTATION.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>ZCL_EXCEL_BASE</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Base class for Excel components and groups of components</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -1,12 +1,13 @@
CLASS zcl_excel_collection DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
TYPES:
ty_collection TYPE STANDARD TABLE OF REF TO object .
ty_collection TYPE STANDARD TABLE OF REF TO zcl_excel_base.
DATA collection TYPE ty_collection READ-ONLY .
@ -20,17 +21,18 @@ CLASS zcl_excel_collection DEFINITION
IMPORTING
!index TYPE i
RETURNING
VALUE(object) TYPE REF TO object .
VALUE(object) TYPE REF TO zcl_excel_base.
METHODS get_iterator
RETURNING
VALUE(iterator) TYPE REF TO zcl_excel_collection_iterator .
METHODS add
IMPORTING
!element TYPE REF TO object .
!element TYPE REF TO zcl_excel_base.
METHODS remove
IMPORTING
!element TYPE REF TO object .
!element TYPE REF TO zcl_excel_base.
METHODS clear .
METHODS clone REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
@ -81,4 +83,20 @@ CLASS zcl_excel_collection IMPLEMENTATION.
METHOD size.
size = lines( collection ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_collection TYPE REF TO zcl_excel_collection.
DATA lo_element TYPE REF TO zcl_excel_base.
DATA lo_clone TYPE REF TO zcl_excel_base.
CREATE OBJECT lo_excel_collection.
LOOP AT me->collection INTO lo_element.
lo_clone = lo_element->clone( ).
INSERT lo_clone INTO TABLE lo_excel_collection->collection.
ENDLOOP.
ro_object = lo_excel_collection.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_column DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_COLUMN
*"* do not include other source files here!!!
@ -82,6 +83,7 @@ CLASS zcl_excel_column DEFINITION
VALUE(ep_style_guid) TYPE zexcel_cell_style
RAISING
zcx_excel .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_COLUMN
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -107,6 +109,8 @@ CLASS zcl_excel_column IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
me->column_index = zcl_excel_common=>convert_column2int( ip_index ).
me->width = -1.
me->auto_size = abap_false.
@ -226,4 +230,29 @@ CLASS zcl_excel_column IMPLEMENTATION.
me->xf_index = ip_xf_index.
io_column = me.
ENDMETHOD.
METHOD clone.
DATA lo_excel_column TYPE REF TO zcl_excel_column.
DATA lv_index TYPE zexcel_cell_column_alpha.
lv_index = column_index.
CREATE OBJECT lo_excel_column
EXPORTING
ip_index = lv_index
ip_worksheet = worksheet
ip_excel = excel.
lo_excel_column->width = width.
lo_excel_column->auto_size = auto_size.
lo_excel_column->visible = visible.
lo_excel_column->outline_level = outline_level.
lo_excel_column->collapsed = collapsed.
lo_excel_column->xf_index = xf_index.
lo_excel_column->style_guid = style_guid.
ro_object = lo_excel_column.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_columns DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_COLUMNS
*"* do not include other source files here!!!
@ -28,6 +29,7 @@ CLASS zcl_excel_columns DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -69,6 +71,7 @@ CLASS zcl_excel_columns IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT columns.
@ -104,4 +107,18 @@ CLASS zcl_excel_columns IMPLEMENTATION.
METHOD size.
ep_size = columns->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_columns TYPE REF TO zcl_excel_columns.
CREATE OBJECT lo_excel_columns.
lo_excel_columns->columns ?= columns->clone( ).
lo_excel_columns->columns_hashed = columns_hashed.
ro_object = lo_excel_columns.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_comment DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
@ -22,6 +23,7 @@ CLASS zcl_excel_comment DEFINITION
IMPORTING
!ip_text TYPE string
!ip_ref TYPE string OPTIONAL .
METHODS clone REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
@ -36,7 +38,7 @@ CLASS zcl_excel_comment IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
ENDMETHOD.
@ -67,4 +69,18 @@ CLASS zcl_excel_comment IMPLEMENTATION.
me->ref = ip_ref.
ENDIF.
ENDMETHOD.
METHOD clone.
DATA lo_excel_comment TYPE REF TO zcl_excel_comment.
CREATE OBJECT lo_excel_comment.
lo_excel_comment->index = index.
lo_excel_comment->ref = ref.
lo_excel_comment->text = text.
ro_object = lo_excel_comment.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_comments DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
@ -30,6 +31,7 @@ CLASS zcl_excel_comments DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
@ -57,6 +59,7 @@ CLASS zcl_excel_comments IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT comments.
ENDMETHOD.
@ -97,4 +100,16 @@ CLASS zcl_excel_comments IMPLEMENTATION.
ep_size = comments->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_comments TYPE REF TO zcl_excel_comments.
CREATE OBJECT lo_excel_comments.
lo_excel_comments->comments ?= comments->clone( ).
ro_object = lo_excel_comments.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_data_validation DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_DATA_VALIDATION
@ -45,6 +46,7 @@ CLASS zcl_excel_data_validation DEFINITION
DATA prompt TYPE string .
METHODS constructor .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
@ -61,6 +63,7 @@ CLASS zcl_excel_data_validation IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
" Initialise instance variables
formula1 = ''.
formula2 = ''.
@ -79,4 +82,32 @@ CLASS zcl_excel_data_validation IMPLEMENTATION.
cell_row = 1.
cell_column = 'A'.
ENDMETHOD.
METHOD clone.
DATA lo_excel_data_validation TYPE REF TO zcl_excel_data_validation.
CREATE OBJECT lo_excel_data_validation.
lo_excel_data_validation->allowblank = allowblank.
lo_excel_data_validation->cell_column = cell_column.
lo_excel_data_validation->cell_column_to = cell_column_to.
lo_excel_data_validation->cell_row = cell_row.
lo_excel_data_validation->cell_row_to = cell_row_to.
lo_excel_data_validation->error = error.
lo_excel_data_validation->errorstyle = errorstyle.
lo_excel_data_validation->errortitle = errortitle.
lo_excel_data_validation->formula1 = formula1.
lo_excel_data_validation->formula2 = formula2.
lo_excel_data_validation->operator = operator.
lo_excel_data_validation->prompt = prompt.
lo_excel_data_validation->prompttitle = prompttitle.
lo_excel_data_validation->showdropdown = showdropdown.
lo_excel_data_validation->showerrormessage = showerrormessage.
lo_excel_data_validation->showinputmessage = showinputmessage.
lo_excel_data_validation->type = type.
ro_object = lo_excel_data_validation.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_data_validations DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_DATA_VALIDATIONS
*"* do not include other source files here!!!
@ -24,6 +25,7 @@ CLASS zcl_excel_data_validations DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_DATA_VALIDATIONS
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -50,6 +52,7 @@ CLASS zcl_excel_data_validations IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT data_validations.
@ -74,4 +77,16 @@ CLASS zcl_excel_data_validations IMPLEMENTATION.
METHOD size.
ep_size = data_validations->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_data_validations TYPE REF TO zcl_excel_data_validations.
CREATE OBJECT lo_excel_data_validations.
lo_excel_data_validations->data_validations ?= data_validations->clone( ).
ro_object = lo_excel_data_validations.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_drawing DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
CONSTANTS c_graph_pie TYPE zexcel_graph_type VALUE 1. "#EC NOTEXT
@ -120,6 +121,7 @@ CLASS zcl_excel_drawing DEFINITION
METHODS load_chart_attributes
IMPORTING
VALUE(ip_chart) TYPE REF TO if_ixml_document .
METHODS clone REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
@ -147,10 +149,11 @@ ENDCLASS.
CLASS ZCL_EXCEL_DRAWING IMPLEMENTATION.
CLASS zcl_excel_drawing IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call
@ -1133,4 +1136,33 @@ CLASS ZCL_EXCEL_DRAWING IMPLEMENTATION.
me->anchor = lv_anchor.
ENDMETHOD.
METHOD clone.
DATA lo_excel_drawing TYPE REF TO zcl_excel_drawing.
CREATE OBJECT lo_excel_drawing.
IF graph IS BOUND.
lo_excel_drawing->graph ?= graph->clone( ).
ENDIF.
lo_excel_drawing->anchor = anchor.
lo_excel_drawing->from_loc = from_loc.
lo_excel_drawing->graph_type = graph_type.
lo_excel_drawing->index = index.
lo_excel_drawing->io = io.
lo_excel_drawing->media = media.
lo_excel_drawing->media_key_www = media_key_www.
lo_excel_drawing->media_name = media_name.
lo_excel_drawing->media_source = media_source.
lo_excel_drawing->media_type = media_type.
lo_excel_drawing->size = size.
lo_excel_drawing->title = title.
lo_excel_drawing->to_loc = to_loc.
lo_excel_drawing->type = type.
ro_object = lo_excel_drawing.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_drawings DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
@ -39,6 +40,7 @@ CLASS zcl_excel_drawings DEFINITION
METHODS get_type
RETURNING
VALUE(rp_type) TYPE zexcel_drawing_type .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_DRAWINGS
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_DRAWINGS
@ -73,6 +75,7 @@ CLASS zcl_excel_drawings IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT drawings.
type = ip_type.
@ -120,4 +123,16 @@ CLASS zcl_excel_drawings IMPLEMENTATION.
ep_size = drawings->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_drawings TYPE REF TO zcl_excel_drawings.
CREATE OBJECT lo_excel_drawings EXPORTING ip_type = type.
lo_excel_drawings->drawings ?= drawings->clone( ).
ro_object = lo_excel_drawings.
ENDMETHOD.
ENDCLASS.

View File

@ -1,6 +1,7 @@
CLASS zcl_excel_graph DEFINITION
PUBLIC
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
@ -320,7 +321,8 @@ CLASS zcl_excel_graph DEFINITION
!ip_value TYPE c .
METHODS set_title
IMPORTING
ip_value TYPE string .
VALUE(ip_value) TYPE string .
METHODS clone REDEFINITION.
PROTECTED SECTION.
*"* protected components of class ZCL_EXCEL_GRAPH
*"* do not include other source files here!!!
@ -335,6 +337,7 @@ CLASS zcl_excel_graph IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
"Load default values
me->pagemargins-b = '0.75'.
me->pagemargins-l = '0.7'.
@ -407,4 +410,27 @@ CLASS zcl_excel_graph IMPLEMENTATION.
METHOD set_title.
me->title = ip_value.
ENDMETHOD.
METHOD clone.
DATA lo_excel_graph TYPE REF TO zcl_excel_graph.
CREATE OBJECT lo_excel_graph.
lo_excel_graph->ns_1904val = ns_1904val.
lo_excel_graph->ns_autotitledeletedval = ns_autotitledeletedval.
lo_excel_graph->ns_c14styleval = ns_c14styleval.
lo_excel_graph->ns_dispblanksasval = ns_dispblanksasval.
lo_excel_graph->ns_langval = ns_langval.
lo_excel_graph->ns_plotvisonlyval = ns_plotvisonlyval.
lo_excel_graph->ns_roundedcornersval = ns_roundedcornersval.
lo_excel_graph->ns_showdlblsovermaxval = ns_showdlblsovermaxval.
lo_excel_graph->ns_styleval = ns_styleval.
lo_excel_graph->pagemargins = pagemargins.
lo_excel_graph->print_label = print_label.
lo_excel_graph->series = series.
lo_excel_graph->title = title.
ro_object = lo_excel_graph.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_hyperlink DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
CREATE PRIVATE
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_HYPERLINK
*"* do not include other source files here!!!
@ -32,6 +33,7 @@ CLASS zcl_excel_hyperlink DEFINITION
METHODS get_url
RETURNING
VALUE(ev_url) TYPE string .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_HYPERLINK
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -104,4 +106,20 @@ CLASS zcl_excel_hyperlink IMPLEMENTATION.
me->column = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column
me->row = ip_row.
ENDMETHOD.
METHOD clone.
DATA lo_excel_hyperlink TYPE REF TO zcl_excel_hyperlink.
CREATE OBJECT lo_excel_hyperlink.
lo_excel_hyperlink->cell_reference = cell_reference.
lo_excel_hyperlink->column = column.
lo_excel_hyperlink->internal = internal.
lo_excel_hyperlink->location = location.
lo_excel_hyperlink->row = row.
ro_object = lo_excel_hyperlink.
ENDMETHOD.
ENDCLASS.

View File

@ -1,13 +1,22 @@
CLASS zcl_excel_range DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_RANGE
*"* do not include other source files here!!!
PUBLIC SECTION.
CONSTANTS gcv_print_title_name TYPE string VALUE '_xlnm.Print_Titles'. "#EC NOTEXT
TYPES:
BEGIN OF ts_sheet_title,
title TYPE zexcel_sheet_title,
offset TYPE i,
length TYPE i,
END OF ts_sheet_title.
DATA name TYPE zexcel_range_name .
DATA guid TYPE zexcel_range_guid .
@ -27,6 +36,17 @@ CLASS zcl_excel_range DEFINITION
METHODS set_range_value
IMPORTING
!ip_value TYPE zexcel_range_value .
METHODS clone REDEFINITION.
METHODS get_sheet_title
RETURNING
VALUE(rs_sheet_title) TYPE ts_sheet_title
RAISING
zcx_excel.
METHODS replace_sheet_title
IMPORTING
!iv_new_sheet_title TYPE zexcel_sheet_title
RAISING
zcx_excel.
*"* protected components of class ZABAP_EXCEL_WORKSHEET
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -34,7 +54,8 @@ CLASS zcl_excel_range DEFINITION
*"* do not include other source files here!!!
PRIVATE SECTION.
DATA value TYPE zexcel_range_value .
DATA value TYPE zexcel_range_value.
DATA ms_sheet_title TYPE ts_sheet_title.
ENDCLASS.
@ -42,6 +63,18 @@ ENDCLASS.
CLASS zcl_excel_range IMPLEMENTATION.
METHOD clone.
DATA lo_excel_range TYPE REF TO zcl_excel_range.
CREATE OBJECT lo_excel_range.
lo_excel_range->name = name.
lo_excel_range->value = value.
ro_object = lo_excel_range.
ENDMETHOD.
METHOD get_guid.
ep_guid = me->guid.
@ -49,6 +82,41 @@ CLASS zcl_excel_range IMPLEMENTATION.
ENDMETHOD.
METHOD get_sheet_title.
CONSTANTS lc_title_submatch_index TYPE i VALUE 1.
DATA ls_sheet_title TYPE ts_sheet_title.
DATA lo_regex TYPE REF TO cl_abap_regex.
DATA lo_matcher TYPE REF TO cl_abap_matcher.
DATA lv_matches TYPE abap_bool.
DATA lv_pattern TYPE string.
IF ms_sheet_title IS NOT INITIAL.
rs_sheet_title = ms_sheet_title.
RETURN.
ENDIF.
lv_pattern =
`^([^\\\[\]\*\?\:]{1,31})(?:\!\${0,1})(?:[a-zA-Z]+[0-9]+|[a-zA-Z]+\${0,1}[0-9]+\:\${0,1}[a-zA-Z]+\${0,1}[0-9]+)$`.
CREATE OBJECT lo_regex EXPORTING pattern = lv_pattern.
lo_matcher = lo_regex->create_matcher( text = value ).
lv_matches = lo_matcher->match( ).
IF lv_matches = abap_false.
zcx_excel=>raise_text( `Failed to match the regular expression.` ).
ENDIF.
ls_sheet_title-title = lo_matcher->get_submatch( lc_title_submatch_index ).
ls_sheet_title-offset = lo_matcher->get_offset( lc_title_submatch_index ).
ls_sheet_title-length = lo_matcher->get_length( lc_title_submatch_index ).
ms_sheet_title = ls_sheet_title.
rs_sheet_title = ls_sheet_title.
ENDMETHOD.
METHOD get_value.
ep_value = me->value.
@ -56,6 +124,18 @@ CLASS zcl_excel_range IMPLEMENTATION.
ENDMETHOD.
METHOD replace_sheet_title.
DATA ls_sheet_title TYPE ts_sheet_title.
ls_sheet_title = get_sheet_title( ).
REPLACE SECTION OFFSET ls_sheet_title-offset LENGTH ls_sheet_title-length OF value WITH iv_new_sheet_title.
ms_sheet_title-title = iv_new_sheet_title.
ms_sheet_title-offset = 0.
ms_sheet_title-length = strlen( iv_new_sheet_title ).
ENDMETHOD.
METHOD set_range_value.
me->value = ip_value.
ENDMETHOD.
@ -64,20 +144,27 @@ CLASS zcl_excel_range IMPLEMENTATION.
METHOD set_value.
DATA: lv_start_row_c TYPE c LENGTH 7,
lv_stop_row_c TYPE c LENGTH 7,
lv_value TYPE string.
lv_value TYPE string,
ls_sheet_title TYPE ts_sheet_title.
lv_stop_row_c = ip_stop_row.
SHIFT lv_stop_row_c RIGHT DELETING TRAILING space.
SHIFT lv_stop_row_c LEFT DELETING LEADING space.
lv_start_row_c = ip_start_row.
SHIFT lv_start_row_c RIGHT DELETING TRAILING space.
SHIFT lv_start_row_c LEFT DELETING LEADING space.
lv_value = ip_sheet_name.
ls_sheet_title-title = ip_sheet_name.
ls_sheet_title-offset = 0.
ls_sheet_title-length = strlen( ip_sheet_name ).
me->value = zcl_excel_common=>escape_string( ip_value = lv_value ).
IF ip_stop_column IS INITIAL AND ip_stop_row IS INITIAL.
CONCATENATE me->value '!$' ip_start_column '$' lv_start_row_c INTO me->value.
CONCATENATE ls_sheet_title-title '!$' ip_start_column '$' lv_start_row_c INTO me->value.
ELSE.
CONCATENATE me->value '!$' ip_start_column '$' lv_start_row_c ':$' ip_stop_column '$' lv_stop_row_c INTO me->value.
CONCATENATE ls_sheet_title-title '!$' ip_start_column '$' lv_start_row_c ':$' ip_stop_column '$' lv_stop_row_c INTO me->value.
ENDIF.
ms_sheet_title = ls_sheet_title.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_ranges DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_RANGES
*"* do not include other source files here!!!
@ -29,6 +30,7 @@ CLASS zcl_excel_ranges DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -55,7 +57,7 @@ CLASS zcl_excel_ranges IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT ranges.
@ -85,4 +87,16 @@ CLASS zcl_excel_ranges IMPLEMENTATION.
METHOD size.
ep_size = ranges->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_ranges TYPE REF TO zcl_excel_ranges.
CREATE OBJECT lo_excel_ranges.
lo_excel_ranges->ranges ?= ranges->clone( ).
ro_object = lo_excel_ranges.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_row DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_ROW
*"* do not include other source files here!!!
@ -60,6 +61,7 @@ CLASS zcl_excel_row DEFINITION
METHODS set_xf_index
IMPORTING
!ip_xf_index TYPE int4 .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_ROW
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -82,6 +84,8 @@ CLASS zcl_excel_row IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
" Initialise values
me->row_index = ip_index.
me->row_height = -1.
@ -235,4 +239,22 @@ CLASS zcl_excel_row IMPLEMENTATION.
METHOD set_xf_index.
me->xf_index = ip_xf_index.
ENDMETHOD.
METHOD clone.
DATA lo_excel_row TYPE REF TO zcl_excel_row.
CREATE OBJECT lo_excel_row.
lo_excel_row->collapsed = collapsed.
lo_excel_row->custom_height = custom_height.
lo_excel_row->outline_level = outline_level.
lo_excel_row->row_height = row_height.
lo_excel_row->row_index = row_index.
lo_excel_row->visible = visible.
lo_excel_row->xf_index = xf_index.
ro_object = lo_excel_row.
ENDMETHOD.
ENDCLASS.

View File

@ -6,7 +6,8 @@
CLASS zcl_excel_rows DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_ROWS
*"* do not include other source files here!!!
@ -41,6 +42,7 @@ CLASS zcl_excel_rows DEFINITION
METHODS get_max_index
RETURNING
VALUE(ep_index) TYPE i .
METHODS clone REDEFINITION.
PROTECTED SECTION.
*"* private components of class ZABAP_EXCEL_RANGES
*"* do not include other source files here!!!
@ -81,7 +83,7 @@ CLASS zcl_excel_rows IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT rows.
ENDMETHOD. "CONSTRUCTOR
@ -138,4 +140,18 @@ CLASS zcl_excel_rows IMPLEMENTATION.
METHOD size.
ep_size = rows->size( ).
ENDMETHOD. "SIZE
METHOD clone.
DATA lo_excel_rows TYPE REF TO zcl_excel_rows.
CREATE OBJECT lo_excel_rows.
lo_excel_rows->rows ?= rows->clone( ).
lo_excel_rows->rows_hashed = rows_hashed.
ro_object = lo_excel_rows.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_sheet_setup DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_SHEET_SETUP
@ -149,6 +150,7 @@ CLASS zcl_excel_sheet_setup DEFINITION
!ep_odd_footer TYPE zexcel_s_worksheet_head_foot
!ep_even_header TYPE zexcel_s_worksheet_head_foot
!ep_even_footer TYPE zexcel_s_worksheet_head_foot .
METHODS clone REDEFINITION.
PROTECTED SECTION.
*"* protected components of class ZCL_EXCEL_SHEET_SETUP
@ -170,6 +172,8 @@ CLASS zcl_excel_sheet_setup IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
orientation = me->c_orientation_default.
* default margins
@ -475,4 +479,46 @@ CLASS zcl_excel_sheet_setup IMPLEMENTATION.
IF ip_top IS SUPPLIED. margin_top = lv_coef * ip_top. ENDIF.
ENDMETHOD.
METHOD clone.
DATA lo_excel_sheet_setup TYPE REF TO zcl_excel_sheet_setup.
CREATE OBJECT lo_excel_sheet_setup.
lo_excel_sheet_setup->black_and_white = black_and_white.
lo_excel_sheet_setup->cell_comments = cell_comments.
lo_excel_sheet_setup->copies = copies.
lo_excel_sheet_setup->diff_oddeven_headerfooter = diff_oddeven_headerfooter.
lo_excel_sheet_setup->draft = draft.
lo_excel_sheet_setup->errors = errors.
lo_excel_sheet_setup->even_footer = even_footer.
lo_excel_sheet_setup->even_header = even_header.
lo_excel_sheet_setup->first_page_number = first_page_number.
lo_excel_sheet_setup->fit_to_height = fit_to_height.
lo_excel_sheet_setup->fit_to_page = fit_to_page.
lo_excel_sheet_setup->fit_to_width = fit_to_width.
lo_excel_sheet_setup->horizontal_centered = horizontal_centered.
lo_excel_sheet_setup->horizontal_dpi = horizontal_dpi.
lo_excel_sheet_setup->margin_bottom = margin_bottom.
lo_excel_sheet_setup->margin_footer = margin_footer.
lo_excel_sheet_setup->margin_header = margin_header.
lo_excel_sheet_setup->margin_left = margin_left.
lo_excel_sheet_setup->margin_right = margin_right.
lo_excel_sheet_setup->margin_top = margin_top.
lo_excel_sheet_setup->odd_footer = odd_footer.
lo_excel_sheet_setup->odd_header = odd_header.
lo_excel_sheet_setup->orientation = orientation.
lo_excel_sheet_setup->page_order = page_order.
lo_excel_sheet_setup->paper_height = paper_height.
lo_excel_sheet_setup->paper_size = paper_size.
lo_excel_sheet_setup->paper_width = paper_width.
lo_excel_sheet_setup->scale = scale.
lo_excel_sheet_setup->use_first_page_num = use_first_page_num.
lo_excel_sheet_setup->use_printer_defaults = use_printer_defaults.
lo_excel_sheet_setup->vertical_centered = vertical_centered.
lo_excel_sheet_setup->vertical_dpi = vertical_dpi.
ro_object = lo_excel_sheet_setup.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_style DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_STYLE
*"* do not include other source files here!!!
@ -21,6 +22,7 @@ CLASS zcl_excel_style DEFINITION
METHODS get_guid
RETURNING
VALUE(ep_guid) TYPE zexcel_cell_style .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_STYLE
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -37,7 +39,7 @@ CLASS zcl_excel_style IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT font.
CREATE OBJECT fill.
@ -101,4 +103,12 @@ CLASS zcl_excel_style IMPLEMENTATION.
ep_guid = me->guid.
ENDMETHOD.
METHOD clone.
DATA lo_excel_style TYPE REF TO zcl_excel_style.
CREATE OBJECT lo_excel_style EXPORTING io_clone_of = me.
ro_object = lo_excel_style.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_style_cond DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
CLASS zcl_excel_style_conditional DEFINITION LOAD .
@ -120,6 +121,7 @@ CLASS zcl_excel_style_cond DEFINITION
METHODS get_guid
RETURNING
VALUE(ep_guid) TYPE zexcel_cell_style .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_STYLE_FONT
*"* do not include other source files here!!!
*"* protected components of class ZABAP_EXCEL_STYLE_FONT
@ -184,6 +186,9 @@ CLASS zcl_excel_style_cond IMPLEMENTATION.
METHOD constructor.
DATA: ls_iconset TYPE zexcel_conditional_iconset.
super->constructor( ).
ls_iconset-iconset = zcl_excel_style_cond=>c_iconset_3trafficlights.
ls_iconset-cfvo1_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo1_value = '0'.
@ -240,4 +245,24 @@ CLASS zcl_excel_style_cond IMPLEMENTATION.
ip_stop_column = ip_stop_column ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_style_cond TYPE REF TO zcl_excel_style_cond.
CREATE OBJECT lo_excel_style_cond EXPORTING ip_dimension_range = mv_rule_range.
lo_excel_style_cond->mode_above_average = mode_above_average.
lo_excel_style_cond->mode_cellis = mode_cellis.
lo_excel_style_cond->mode_colorscale = mode_colorscale.
lo_excel_style_cond->mode_databar = mode_databar.
lo_excel_style_cond->mode_expression = mode_expression.
lo_excel_style_cond->mode_iconset = mode_iconset.
lo_excel_style_cond->mode_textfunction = mode_textfunction.
lo_excel_style_cond->mode_top10 = mode_top10.
lo_excel_style_cond->priority = priority.
lo_excel_style_cond->rule = rule.
ro_object = lo_excel_style_cond.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_styles DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_STYLES
*"* do not include other source files here!!!
@ -34,6 +35,7 @@ CLASS zcl_excel_styles DEFINITION
!io_style TYPE REF TO zcl_excel_style
RETURNING
VALUE(ep_style_code) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
@ -66,7 +68,7 @@ CLASS zcl_excel_styles IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT styles.
ENDMETHOD.
@ -113,4 +115,16 @@ CLASS zcl_excel_styles IMPLEMENTATION.
ep_size = styles->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_styles TYPE REF TO zcl_excel_styles.
CREATE OBJECT lo_excel_styles.
lo_excel_styles->styles ?= styles->clone( ).
ro_object = lo_excel_styles.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_styles_cond DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_STYLES_COND
*"* do not include other source files here!!!
@ -29,6 +30,7 @@ CLASS zcl_excel_styles_cond DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -55,6 +57,7 @@ CLASS zcl_excel_styles_cond IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT styles_cond.
@ -86,4 +89,16 @@ CLASS zcl_excel_styles_cond IMPLEMENTATION.
METHOD size.
ep_size = styles_cond->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_styles_cond TYPE REF TO zcl_excel_styles_cond.
CREATE OBJECT lo_excel_styles_cond.
lo_excel_styles_cond->styles_cond ?= styles_cond->clone( ).
ro_object = lo_excel_styles_cond.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_table DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_TABLE
*"* do not include other source files here!!!
@ -113,6 +114,7 @@ CLASS zcl_excel_table DEFINITION
VALUE(ev_column) TYPE i
RAISING
zcx_excel .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_TABLE
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_TABLE
@ -301,4 +303,20 @@ CLASS zcl_excel_table IMPLEMENTATION.
METHOD set_id.
id = iv_id.
ENDMETHOD.
METHOD clone.
DATA lo_excel_table TYPE REF TO zcl_excel_table.
CREATE OBJECT lo_excel_table.
lo_excel_table->fieldcat = fieldcat.
lo_excel_table->id = id.
lo_excel_table->name = name.
lo_excel_table->settings = settings.
lo_excel_table->table_data = table_data.
ro_object = lo_excel_table.
ENDMETHOD.
ENDCLASS.

View File

@ -1,6 +1,7 @@
CLASS zcl_excel_worksheet DEFINITION
PUBLIC
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_WORKSHEET
@ -664,6 +665,7 @@ CLASS zcl_excel_worksheet DEFINITION
!ip_is_internal TYPE abap_bool
RAISING
zcx_excel .
METHODS clone REDEFINITION.
PROTECTED SECTION.
METHODS set_table_reference
IMPORTING
@ -708,6 +710,7 @@ CLASS zcl_excel_worksheet DEFINITION
DATA upper_cell TYPE zexcel_s_cell_data .
DATA mt_ignored_errors TYPE mty_th_ignored_errors.
DATA right_to_left TYPE abap_bool.
DATA mv_clones TYPE i VALUE 0.
METHODS calculate_cell_width
IMPORTING
@ -2007,6 +2010,8 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
METHOD constructor.
DATA: lv_title TYPE zexcel_sheet_title.
super->constructor( ).
me->excel = ip_excel.
me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call
@ -2085,10 +2090,10 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
lv_column = zcl_excel_common=>convert_column2int( ip_cell_column ).
LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS
WHERE
( row_from <= ip_cell_row AND row_to >= ip_cell_row )
AND
( col_from <= lv_column AND col_to >= lv_column ).
WHERE row_from <= ip_cell_row
AND row_to >= ip_cell_row
AND col_from <= lv_column
AND col_to >= lv_column.
DELETE me->mt_merged_cells.
EXIT.
@ -4149,15 +4154,16 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
* - Stefan Schmoecker, 2012-12-02
* changes: added additional check for ' as first character
*--------------------------------------------------------------------*
DATA: lo_worksheets_iterator TYPE REF TO zcl_excel_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
errormessage TYPE string,
lv_rangesheetname_old TYPE string,
lv_rangesheetname_new TYPE string,
lo_ranges_iterator TYPE REF TO zcl_excel_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_range_value TYPE zexcel_range_value,
lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class
DATA: lo_worksheets_iterator TYPE REF TO zcl_excel_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
errormessage TYPE string,
lv_rangesheetname_old TYPE string,
lo_excel_ranges_iterator TYPE REF TO zcl_excel_collection_iterator,
lo_sheet_ranges_iterator TYPE REF TO zcl_excel_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_errormessage TYPE string,
ls_range_sheet_title TYPE zcl_excel_range=>ts_sheet_title.
" Can't pass '...'(abc) to exception-class
*--------------------------------------------------------------------*
@ -4193,34 +4199,28 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
ENDWHILE.
*--------------------------------------------------------------------*
* Remember old sheetname and rename sheet to desired name
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_old.
lv_rangesheetname_old = title.
me->title = ip_title.
*--------------------------------------------------------------------*
* After changing this worksheet's title we have to adjust
* all ranges that are referring to this worksheet.
*--------------------------------------------------------------------*
* 2do §1 - Check if the following quickfix is solid
* I fear it isn't - but this implementation is better then
* nothing at all since it handles a supposed majority of cases
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_new.
lo_ranges_iterator = me->excel->get_ranges_iterator( ).
WHILE lo_ranges_iterator->has_next( ) = 'X'.
lo_range ?= lo_ranges_iterator->get_next( ).
lv_range_value = lo_range->get_value( ).
REPLACE ALL OCCURRENCES OF lv_rangesheetname_old IN lv_range_value WITH lv_rangesheetname_new.
IF sy-subrc = 0.
lo_range->set_range_value( lv_range_value ).
lo_excel_ranges_iterator = me->excel->get_ranges_iterator( ).
WHILE lo_excel_ranges_iterator->has_next( ) = abap_true.
lo_range ?= lo_excel_ranges_iterator->get_next( ).
ls_range_sheet_title = lo_range->get_sheet_title( ).
IF ls_range_sheet_title-title <> lv_rangesheetname_old.
CONTINUE.
ENDIF.
lo_range->replace_sheet_title( ip_title ).
ENDWHILE.
IF ranges IS NOT BOUND.
RETURN.
ENDIF.
lo_sheet_ranges_iterator = ranges->get_iterator( ).
WHILE lo_sheet_ranges_iterator->has_next( ) = abap_true.
lo_range ?= lo_sheet_ranges_iterator->get_next( ).
lo_range->replace_sheet_title( ip_title ).
ENDWHILE.
ENDMETHOD. "SET_TITLE
@ -4467,4 +4467,108 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
METHOD zif_excel_sheet_vba_project~set_codename_pr.
me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr.
ENDMETHOD. "ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR
METHOD clone.
DATA lv_sheet_title TYPE zexcel_sheet_title.
DATA lo_excel_worksheet TYPE REF TO zcl_excel_worksheet.
DATA lo_range_iterator TYPE REF TO zcl_excel_collection_iterator.
DATA lo_range TYPE REF TO zcl_excel_range.
mv_clones = mv_clones + 1.
lv_sheet_title = |Clone{ mv_clones }_{ title }|.
CREATE OBJECT lo_excel_worksheet
EXPORTING
ip_excel = excel
ip_title = lv_sheet_title.
IF charts IS BOUND.
lo_excel_worksheet->charts ?= charts->clone( ).
ENDIF.
IF columns IS BOUND.
lo_excel_worksheet->columns ?= columns->clone( ).
ENDIF.
IF column_default IS BOUND.
lo_excel_worksheet->column_default ?= column_default->clone( ).
ENDIF.
IF comments IS BOUND.
lo_excel_worksheet->comments ?= comments->clone( ).
ENDIF.
IF data_validations IS BOUND.
lo_excel_worksheet->data_validations ?= data_validations->clone( ).
ENDIF.
IF drawings IS BOUND.
lo_excel_worksheet->drawings ?= drawings->clone( ).
ENDIF.
IF hyperlinks IS BOUND.
lo_excel_worksheet->hyperlinks ?= hyperlinks->clone( ).
ENDIF.
IF mo_pagebreaks IS BOUND.
lo_excel_worksheet->mo_pagebreaks ?= mo_pagebreaks->clone( ).
ENDIF.
IF ranges IS BOUND.
lo_excel_worksheet->ranges ?= ranges->clone( ).
lo_range_iterator = lo_excel_worksheet->ranges->get_iterator( ).
WHILE lo_range_iterator->has_next( ) = abap_true.
lo_range ?= lo_range_iterator->get_next( ).
lo_range->replace_sheet_title( lv_sheet_title ).
ENDWHILE.
ENDIF.
IF rows IS BOUND.
lo_excel_worksheet->rows ?= rows->clone( ).
ENDIF.
IF row_default IS BOUND.
lo_excel_worksheet->row_default ?= row_default->clone( ).
ENDIF.
IF sheet_setup IS BOUND.
lo_excel_worksheet->sheet_setup ?= sheet_setup->clone( ).
ENDIF.
IF styles_cond IS BOUND.
lo_excel_worksheet->styles_cond ?= styles_cond->clone( ).
ENDIF.
IF tables IS BOUND.
lo_excel_worksheet->tables ?= tables->clone( ).
ENDIF.
lo_excel_worksheet->active_cell = active_cell.
lo_excel_worksheet->column_formulas = column_formulas.
lo_excel_worksheet->default_excel_date_format = default_excel_date_format.
lo_excel_worksheet->default_excel_time_format = default_excel_time_format.
lo_excel_worksheet->excel = excel.
lo_excel_worksheet->freeze_pane_cell_column = freeze_pane_cell_column.
lo_excel_worksheet->freeze_pane_cell_row = freeze_pane_cell_row.
lo_excel_worksheet->lower_cell = lower_cell.
lo_excel_worksheet->mt_ignored_errors = mt_ignored_errors.
lo_excel_worksheet->mt_merged_cells = mt_merged_cells.
lo_excel_worksheet->mt_row_outlines = mt_row_outlines.
lo_excel_worksheet->print_gridlines = print_gridlines.
lo_excel_worksheet->print_title_col_from = print_title_col_from.
lo_excel_worksheet->print_title_col_to = print_title_col_to.
lo_excel_worksheet->print_title_row_from = print_title_row_from.
lo_excel_worksheet->print_title_row_to = print_title_row_to.
lo_excel_worksheet->right_to_left = right_to_left.
lo_excel_worksheet->sheet_content = sheet_content.
lo_excel_worksheet->show_gridlines = show_gridlines.
lo_excel_worksheet->show_rowcolheaders = show_rowcolheaders.
lo_excel_worksheet->tabcolor = tabcolor.
lo_excel_worksheet->upper_cell = upper_cell.
ro_object = lo_excel_worksheet.
ENDMETHOD.
ENDCLASS.

View File

@ -1,6 +1,7 @@
CLASS zcl_excel_worksheet_pagebreaks DEFINITION
PUBLIC
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
PUBLIC SECTION.
@ -21,6 +22,7 @@ CLASS zcl_excel_worksheet_pagebreaks DEFINITION
METHODS get_all_pagebreaks
RETURNING
VALUE(rt_pagebreaks) TYPE tt_pagebreak_at .
METHODS clone REDEFINITION.
PROTECTED SECTION.
DATA mt_pagebreaks TYPE tt_pagebreak_at .
@ -47,4 +49,16 @@ CLASS zcl_excel_worksheet_pagebreaks IMPLEMENTATION.
METHOD get_all_pagebreaks.
rt_pagebreaks = me->mt_pagebreaks.
ENDMETHOD.
METHOD clone.
DATA lo_excel_worksheet_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks.
CREATE OBJECT lo_excel_worksheet_pagebreaks.
lo_excel_worksheet_pagebreaks->mt_pagebreaks = mt_pagebreaks.
ro_object = lo_excel_worksheet_pagebreaks.
ENDMETHOD.
ENDCLASS.

View File

@ -1,7 +1,8 @@
CLASS zcl_excel_worksheets DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC
INHERITING FROM zcl_excel_base.
*"* public components of class ZCL_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
@ -32,6 +33,7 @@ CLASS zcl_excel_worksheets DEFINITION
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
METHODS clone REDEFINITION.
*"* protected components of class ZCL_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PROTECTED SECTION.
@ -62,7 +64,7 @@ CLASS zcl_excel_worksheets IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT worksheets.
ENDMETHOD.
@ -103,4 +105,18 @@ CLASS zcl_excel_worksheets IMPLEMENTATION.
ep_size = worksheets->size( ).
ENDMETHOD.
METHOD clone.
DATA lo_excel_worksheets TYPE REF TO zcl_excel_worksheets.
CREATE OBJECT lo_excel_worksheets.
lo_excel_worksheets->worksheets ?= worksheets->clone( ).
lo_excel_worksheets->active_worksheet = active_worksheet.
lo_excel_worksheets->name = name.
ro_object = lo_excel_worksheets.
ENDMETHOD.
ENDCLASS.