diff --git a/ZA2X/CLAS/ZCL_EXCEL.slnk b/ZA2X/CLAS/ZCL_EXCEL.slnk
index 575ca2f..91cdea3 100644
--- a/ZA2X/CLAS/ZCL_EXCEL.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL.slnk
@@ -1,16 +1,16 @@
-
-
-
-
+
+
+
+
class ZCL_EXCEL definition
public
final
create public .
+public section.
*"* public components of class ZCL_EXCEL
*"* do not include other source files here!!!
-public section.
interfaces ZIF_EXCEL_BOOK_PROPERTIES .
interfaces ZIF_EXCEL_BOOK_PROTECTION .
@@ -19,20 +19,22 @@ public section.
data SECURITY type ref to ZCL_EXCEL_SECURITY .
data LEGACY_PALETTE type ref to ZCL_EXCEL_LEGACY_PALETTE read-only .
- 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_AUTOFILTER
importing
!IO_SHEET type ref to ZCL_EXCEL_WORKSHEET
returning
value(RO_AUTOFILTER) type ref to ZCL_EXCEL_AUTOFILTER .
+ 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
+ importing
+ !IP_GUID type ZEXCEL_CELL_STYLE optional
returning
value(EO_STYLE) type ref to ZCL_EXCEL_STYLE .
methods ADD_NEW_WORKSHEET
@@ -40,6 +42,7 @@ public section.
!IP_TITLE type ZEXCEL_SHEET_TITLE optional
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
+ methods ADD_STATIC_STYLES .
methods CONSTRUCTOR .
methods GET_ACTIVE_SHEET_INDEX
returning
@@ -47,6 +50,9 @@ public section.
methods GET_ACTIVE_WORKSHEET
returning
value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET .
+ methods GET_AUTOFILTERS_REFERENCE
+ returning
+ value(RO_AUTOFILTERS) type ref to ZCL_EXCEL_AUTOFILTERS .
methods GET_DRAWINGS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
@@ -56,12 +62,22 @@ public section.
methods GET_RANGES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
- methods GET_AUTOFILTERS_REFERENCE
+ methods GET_STATIC_CELLSTYLE_GUID
+ importing
+ !IP_CSTYLE_COMPLETE type ZEXCEL_S_CSTYLE_COMPLETE
+ !IP_CSTYLEX_COMPLETE type ZEXCEL_S_CSTYLEX_COMPLETE
returning
- value(RO_AUTOFILTERS) type ref to ZCL_EXCEL_AUTOFILTERS .
+ value(EP_GUID) type ZEXCEL_CELL_STYLE .
methods GET_STYLES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
+ methods GET_STYLE_TO_GUID
+ importing
+ !IP_GUID type ZEXCEL_CELL_STYLE
+ returning
+ value(EP_STYLEMAPPING) type ZEXCEL_S_STYLEMAPPING
+ raising
+ ZCX_EXCEL .
methods GET_WORKSHEETS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
@@ -80,15 +96,23 @@ public section.
*"* protected components of class ZCL_EXCEL
*"* do not include other source files here!!!
protected section.
- *"* private components of class ZCL_EXCEL
+ private 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 .
- data AUTOFILTERS type ref to ZCL_EXCEL_AUTOFILTERS .
+ data AUTOFILTERS type ref to ZCL_EXCEL_AUTOFILTERS .
+ data T_STYLEMAPPING1 type ZEXCEL_T_STYLEMAPPING1 .
+ data T_STYLEMAPPING2 type ZEXCEL_T_STYLEMAPPING2 .
+
+ methods STYLEMAPPING_DYNAMIC_STYLE
+ importing
+ !IP_STYLE type ref to ZCL_EXCEL_STYLE
+ returning
+ value(EO_STYLE2) type ZEXCEL_S_STYLEMAPPING .
*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes
@@ -97,13 +121,15 @@ private section.
*"* implementation or private method's signature
*"* use this source file for any macro definitions you need
*"* in the implementation part of the class
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
method ZIF_EXCEL_BOOK_PROPERTIES~INITIALIZE.
DATA: lv_timestamp TYPE timestampl.
@@ -143,17 +169,17 @@ endmethod.
me->zif_excel_book_vba_project~vbaproject = ip_vbaproject.
endmethod.
-
-
-
+
+
+
method ADD_NEW_AUTOFILTER.
* Check for autofilter reference: new or overwrite; only one per sheet
ro_autofilter = autofilters->add( io_sheet = io_sheet ) .
endmethod.
-
-
-
+
+
+
method ADD_NEW_DRAWING.
DATA: lv_guid TYPE guid_16.
* Create default blank worksheet
@@ -163,26 +189,41 @@ endmethod.
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.
+
+
+
+ METHOD add_new_style.
+* Start of deletion # issue 139 - Dateretention of cellstyles
+* CREATE OBJECT eo_style.
+* styles->add( eo_style ).
+* End of deletion # issue 139 - Dateretention of cellstyles
+* Start of insertion # issue 139 - Dateretention of cellstyles
* Create default style
- CREATE OBJECT eo_style.
+ CREATE OBJECT eo_style
+ EXPORTING
+ ip_guid = ip_guid.
styles->add( eo_style ).
-endmethod.
+ DATA: style2 TYPE zexcel_s_stylemapping.
+* Copy to new representations
+ style2 = stylemapping_dynamic_style( eo_style ).
+ INSERT style2 INTO TABLE t_stylemapping1.
+ INSERT style2 INTO TABLE t_stylemapping2.
+* End of insertion # issue 139 - Dateretention of cellstyles
+
+ENDMETHOD.
-
-
-
+
+
+
method ADD_NEW_WORKSHEET.
DATA: lv_guid TYPE guid_16.
* Create default blank worksheet
@@ -194,8 +235,33 @@ endmethod.
worksheets->active_worksheet = worksheets->size( ).
endmethod.
-
- METHOD constructor.
+
+ METHOD add_static_styles.
+ " # issue 139
+* später hier noch die Worksheets abklappern, welche Styles überhaupt noch benötigt werden
+* und nur diese dann auch hier zur Verfügung stellen
+* Da muss ich noch mal nachfragen, ob die beiden ersten Styles, die scheinbar immer mit dem
+* EXCEL-Objekt erzeugt werden evtl. immer benötigt werden, egal ob verwendet oder nicht
+* Aber als Start fange ich mal an einfach alle static styles der Reihe nach hinzuzufügen
+ FIELD-SYMBOLS: <style1> LIKE LINE OF t_stylemapping1,
+ <style2> LIKE LINE OF t_stylemapping2.
+ DATA: style TYPE REF TO zcl_excel_style.
+
+ LOOP AT me->t_stylemapping1 ASSIGNING <style1> WHERE added_to_iterator IS INITIAL.
+ READ TABLE me->t_stylemapping2 ASSIGNING <style2> WITH TABLE KEY guid = <style1>-guid.
+ CHECK sy-subrc = 0. " Should always be true since these tables are being filled parallel
+
+ style = me->add_new_style( <style1>-guid ).
+
+ zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <style1>-complete_style
+ i_sourcex = <style1>-complete_stylex
+ CHANGING e_target = style ).
+
+ ENDLOOP.
+ENDMETHOD.
+
+
+ method CONSTRUCTOR.
DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style TYPE REF TO zcl_excel_style.
@@ -216,40 +282,40 @@ endmethod.
lo_style = me->add_new_style( ). " Standard style with fill gray125
lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_pattern_gray125.
-ENDMETHOD.
+endmethod.
-
-
+
+
method GET_ACTIVE_SHEET_INDEX.
r_active_worksheet = me->worksheets->active_worksheet.
endmethod.
-
-
+
+
method GET_ACTIVE_WORKSHEET.
eo_worksheet = me->worksheets->get( me->worksheets->active_worksheet ).
endmethod.
-
-
- METHOD GET_AUTOFILTERS_REFERENCE.
+
+
+ method GET_AUTOFILTERS_REFERENCE.
ro_autofilters = autofilters.
-ENDMETHOD.
+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,
@@ -268,54 +334,103 @@ endmethod.
endmethod.
-
-
+
+
method GET_RANGES_ITERATOR.
eo_iterator = me->ranges->get_iterator( ).
endmethod.
-
-
+
+
+
+
+ method GET_STATIC_CELLSTYLE_GUID.
+" # issue 139
+ DATA: style LIKE LINE OF me->t_stylemapping1.
+
+ READ TABLE me->t_stylemapping1 INTO style
+ WITH TABLE KEY dynamic_style_guid = style-guid " no dynamic style --> look for initial guid here
+ complete_style = ip_cstyle_complete
+ complete_stylex = ip_cstylex_complete.
+ IF sy-subrc <> 0.
+ style-complete_style = ip_cstyle_complete.
+ style-complete_stylex = ip_cstylex_complete.
+ CALL FUNCTION 'GUID_CREATE'
+ IMPORTING
+ ev_guid_16 = style-guid.
+ INSERT style INTO TABLE me->t_stylemapping1.
+ INSERT style INTO TABLE me->t_stylemapping2.
+
+ ENDIF.
+
+ ep_guid = style-guid.
+endmethod.
+
+
+
method GET_STYLES_ITERATOR.
eo_iterator = me->styles->get_iterator( ).
endmethod.
-
-
+
+
+
+
+ METHOD get_style_to_guid.
+ " # issue 139
+
+ READ TABLE me->t_stylemapping2 INTO ep_stylemapping WITH TABLE KEY guid = ip_guid.
+ IF sy-subrc <> 0.
+ RAISE EXCEPTION TYPE zcx_excel
+ EXPORTING
+ error = 'GUID not found'.
+ ENDIF.
+
+ IF ep_stylemapping-dynamic_style_guid IS NOT INITIAL.
+ zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = ep_stylemapping-cl_style
+ CHANGING e_target = ep_stylemapping-complete_style
+ e_targetx = ep_stylemapping-complete_stylex ).
+ ENDIF.
+
+
+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.
-
-
+
+
method SET_ACTIVE_SHEET_INDEX.
me->worksheets->active_worksheet = i_active_worksheet.
endmethod.
-
-
+
+
method SET_ACTIVE_SHEET_INDEX_BY_NAME.
DATA: ws_it TYPE REF TO cl_object_collection_iterator,
@@ -335,6 +450,21 @@ endmethod.
count = count + 1.
ENDWHILE.
+endmethod.
+
+
+
+
+ method STYLEMAPPING_DYNAMIC_STYLE.
+" # issue 139
+ eo_style2-dynamic_style_guid = ip_style->get_guid( ).
+ eo_style2-guid = eo_style2-dynamic_style_guid.
+ eo_style2-added_to_iterator = abap_true.
+ eo_style2-cl_style = ip_style.
+
+* don't care about attributes here, since this data may change
+* dynamically
+
endmethod.
diff --git a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
index 2491f08..3783eda 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
@@ -76,6 +76,18 @@ public section.
value(IP_VALUE) type NUMERIC
returning
value(EP_VALUE) type ZEXCEL_CELL_VALUE .
+ class-methods RECURSIVE_CLASS_TO_STRUCT
+ importing
+ !I_SOURCE type ANY
+ changing
+ !E_TARGET type DATA
+ !E_TARGETX type DATA .
+ class-methods RECURSIVE_STRUCT_TO_CLASS
+ importing
+ !I_SOURCE type DATA
+ !I_SOURCEX type DATA
+ changing
+ !E_TARGET type ANY .
class-methods TIME_TO_EXCEL_STRING
importing
!IP_VALUE type T
@@ -127,7 +139,7 @@ protected section.
IF o_conv IS NOT BOUND.
o_conv = cl_abap_conv_out_ce=>create( endian = 'L'
- ignore_cerr = 'X'
+ ignore_cerr = abap_true
replacement = '#' ).
ENDIF.
@@ -440,7 +452,126 @@ endmethod.
ENDIF.
endmethod.
-
+
+
+
+
+ METHOD recursive_class_to_struct.
+ " # issue 139
+* is working for me - but after looking through this coding I guess
+* I'll rewrite this to a version w/o recursion
+* This is private an no one using it so far except me, so no need to hurry
+ DATA: descr TYPE REF TO cl_abap_structdescr,
+ wa_component LIKE LINE OF descr->components,
+ attribute_name TYPE fieldname,
+ flag_class TYPE flag,
+ o_border TYPE REF TO zcl_excel_style_border.
+
+ FIELD-SYMBOLS: <field> TYPE any,
+ <fieldx> TYPE any,
+ <class> TYPE REF TO object,
+ <attribute> TYPE any.
+
+
+ descr ?= cl_abap_structdescr=>describe_by_data( e_target ).
+
+ LOOP AT descr->components INTO wa_component.
+
+* Assign structure and X-structure
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <field>.
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO <fieldx>.
+* At least one field in the structure should be marked - otherwise continue with next field
+ CLEAR flag_class.
+* maybe source is just a structure - try assign component...
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <attribute>.
+ IF sy-subrc <> 0.
+* not - then it is an attribute of the class - use different assign then
+ CONCATENATE 'i_source->' wa_component-name INTO attribute_name.
+ ASSIGN (attribute_name) TO <attribute>.
+ IF sy-subrc <> 0.
+ EXIT.
+ ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps
+ flag_class = abap_true.
+ ENDIF.
+
+ CASE wa_component-type_kind.
+ WHEN cl_abap_structdescr=>typekind_struct1. " Structure --> use recursio
+* IF flag_class = abap_true.
+** Only borders will be passed as unbound references. But since we want to set a value we have to create an instance
+* ENDIF.
+ zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = <attribute>
+ CHANGING e_target = <field>
+ e_targetx = <fieldx> ).
+ WHEN OTHERS.
+ <field> = <attribute>.
+ <fieldx> = abap_true.
+
+ ENDCASE.
+ ENDLOOP.
+
+ENDMETHOD.
+
+
+
+
+
+ METHOD recursive_struct_to_class.
+ " # issue 139
+* is working for me - but after looking through this coding I guess
+* I'll rewrite this to a version w/o recursion
+* This is private an no one using it so far except me, so no need to hurry
+ DATA: descr TYPE REF TO cl_abap_structdescr,
+ wa_component LIKE LINE OF descr->components,
+ attribute_name TYPE fieldname,
+ flag_class TYPE flag,
+ o_border TYPE REF TO zcl_excel_style_border.
+
+ FIELD-SYMBOLS: <field> TYPE any,
+ <fieldx> TYPE any,
+ <class> TYPE REF TO object,
+ <attribute> TYPE any.
+
+
+ descr ?= cl_abap_structdescr=>describe_by_data( i_source ).
+
+ LOOP AT descr->components INTO wa_component.
+
+* Assign structure and X-structure
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <field>.
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO <fieldx>.
+* At least one field in the structure should be marked - otherwise continue with next field
+ CHECK <fieldx> CA abap_true.
+ CLEAR flag_class.
+* maybe target is just a structure - try assign component...
+ ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <attribute>.
+ IF sy-subrc <> 0.
+* not - then it is an attribute of the class - use different assign then
+ CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name.
+ ASSIGN (attribute_name) TO <attribute>.
+ IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps
+ flag_class = abap_true.
+ ENDIF.
+
+ CASE wa_component-type_kind.
+ WHEN cl_abap_structdescr=>typekind_struct1. " Structure --> use recursion
+ IF flag_class = abap_true AND <attribute> IS INITIAL.
+* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance
+ CREATE OBJECT o_border.
+ <attribute> = o_border.
+ ENDIF.
+ zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <field>
+ i_sourcex = <fieldx>
+ CHANGING e_target = <attribute> ).
+ WHEN OTHERS.
+ CHECK <fieldx> = abap_true. " Marked for change
+ <attribute> = <field>.
+
+ ENDCASE.
+ ENDLOOP.
+
+ENDMETHOD.
+
+
method SHL01.
@@ -460,7 +591,7 @@ endmethod.
endmethod.
-
+
method SHR14.
@@ -487,7 +618,7 @@ endmethod.
endmethod.
-
+
method TIME_TO_EXCEL_STRING.
diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk
index 66c961e..4faacc4 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk
@@ -1,5 +1,5 @@
-
-
+
+
class ZCL_EXCEL_STYLE definition
public
final
@@ -16,7 +16,9 @@ public section.
data NUMBER_FORMAT type ref to ZCL_EXCEL_STYLE_NUMBER_FORMAT .
data PROTECTION type ref to ZCL_EXCEL_STYLE_PROTECTION .
- methods CONSTRUCTOR .
+ methods CONSTRUCTOR
+ importing
+ !IP_GUID type ZEXCEL_CELL_STYLE optional .
methods GET_GUID
returning
value(EP_GUID) type ZEXCEL_CELL_STYLE .
@@ -36,15 +38,16 @@ private section.
*"* implementation or private method's signature
*"* use this source file for any macro definitions you need
*"* in the implementation part of the class
-
-
-
-
-
-
-
-
- method CONSTRUCTOR.
+
+
+
+
+
+
+
+
+
+ METHOD constructor.
CREATE OBJECT font.
@@ -54,14 +57,22 @@ private section.
CREATE OBJECT number_format.
CREATE OBJECT protection.
- CALL FUNCTION 'GUID_CREATE'
- IMPORTING
- ev_guid_16 = me->guid.
+* Start of insertion # issue 139 - Dateretention of cellstyles
+ IF ip_guid IS NOT INITIAL.
+ me->guid = ip_guid.
+ ELSE.
+* End of insertion # issue 139 - Dateretention of cellstyles
+ CALL FUNCTION 'GUID_CREATE'
+ IMPORTING
+ ev_guid_16 = me->guid.
+* Start of insertion # issue 139 - Dateretention of cellstyles
+ ENDIF.
+* End of insertion # issue 139 - Dateretention of cellstyles
-endmethod.
+ENDMETHOD.
-
-
+
+
method GET_GUID.
diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
index 0a78ffe..5a6b210 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
@@ -1,8 +1,8 @@
-
-
-
-
-
+
+
+
+
+
class ZCL_EXCEL_WORKSHEET definition
public
final
@@ -103,7 +103,8 @@ public section.
exporting
!EP_VALUE type ZEXCEL_CELL_VALUE
!EP_RC type SYSUBRC
- !EP_STYLE type ref to ZCL_EXCEL_STYLE .
+ !EP_STYLE type ref to ZCL_EXCEL_STYLE
+ !EP_GUID type ZEXCEL_CELL_STYLE .
methods GET_COLUMN_DIMENSION
importing
!IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
@@ -227,7 +228,111 @@ public section.
!IP_TITLE type ZEXCEL_SHEET_TITLE .
methods SET_SHOW_ROWCOLHEADERS
importing
- !I_SHOW_ROWCOLHEADERS type ZEXCEL_SHOW_ROWCOLHEADER .
+ !I_SHOW_ROWCOLHEADERS type ZEXCEL_SHOW_ROWCOLHEADER .
+ methods CHANGE_CELL_STYLE
+ importing
+ !IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
+ !IP_ROW type ZEXCEL_CELL_ROW
+ !IP_COMPLETE type ZEXCEL_S_CSTYLE_COMPLETE optional
+ !IP_XCOMPLETE type ZEXCEL_S_CSTYLEX_COMPLETE optional
+ !IP_FONT type ZEXCEL_S_CSTYLE_FONT optional
+ !IP_XFONT type ZEXCEL_S_CSTYLEX_FONT optional
+ !IP_FILL type ZEXCEL_S_CSTYLE_FILL optional
+ !IP_XFILL type ZEXCEL_S_CSTYLEX_FILL optional
+ !IP_BORDERS type ZEXCEL_S_CSTYLE_BORDERS optional
+ !IP_XBORDERS type ZEXCEL_S_CSTYLEX_BORDERS optional
+ !IP_ALIGNMENT type ZEXCEL_S_CSTYLE_ALIGNMENT optional
+ !IP_XALIGNMENT type ZEXCEL_S_CSTYLEX_ALIGNMENT optional
+ !IP_NUMBER_FORMAT_FORMAT_CODE type ZEXCEL_NUMBER_FORMAT optional
+ !IP_PROTECTION type ZEXCEL_S_CSTYLE_PROTECTION optional
+ !IP_XPROTECTION type ZEXCEL_S_CSTYLEX_PROTECTION optional
+ !IP_FONT_BOLD type FLAG optional
+ !IP_FONT_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_FONT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_FONT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_FONT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_FONT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_FONT_FAMILY type ZEXCEL_STYLE_FONT_FAMILY optional
+ !IP_FONT_ITALIC type FLAG optional
+ !IP_FONT_NAME type ZEXCEL_STYLE_FONT_NAME optional
+ !IP_FONT_SCHEME type ZEXCEL_STYLE_FONT_SCHEME optional
+ !IP_FONT_SIZE type ZEXCEL_STYLE_FONT_SIZE optional
+ !IP_FONT_STRIKETHROUGH type FLAG optional
+ !IP_FONT_UNDERLINE type FLAG optional
+ !IP_FONT_UNDERLINE_MODE type ZEXCEL_STYLE_FONT_UNDERLINE optional
+ !IP_FILL_FILLTYPE type ZEXCEL_FILL_TYPE optional
+ !IP_FILL_ROTATION type ZEXCEL_ROTATION optional
+ !IP_FILL_FGCOLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_FILL_FGCOLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_FILL_FGCOLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_FILL_FGCOLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_FILL_FGCOLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_FILL_BGCOLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_FILL_BGCOLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_FILL_BGCOLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_FILL_BGCOLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_FILL_BGCOLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_ALLBORDERS type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_ALLBORDERS type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_BORDERS_DIAGONAL type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_DIAGONAL type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_BORDERS_DIAGONAL_MODE type ZEXCEL_DIAGONAL optional
+ !IP_BORDERS_DOWN type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_DOWN type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_BORDERS_LEFT type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_LEFT type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_BORDERS_RIGHT type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_RIGHT type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_BORDERS_TOP type ZEXCEL_S_CSTYLE_BORDER optional
+ !IP_XBORDERS_TOP type ZEXCEL_S_CSTYLEX_BORDER optional
+ !IP_ALIGNMENT_HORIZONTAL type ZEXCEL_ALIGNMENT optional
+ !IP_ALIGNMENT_VERTICAL type ZEXCEL_ALIGNMENT optional
+ !IP_ALIGNMENT_TEXTROTATION type ZEXCEL_TEXT_ROTATION optional
+ !IP_ALIGNMENT_WRAPTEXT type FLAG optional
+ !IP_ALIGNMENT_SHRINKTOFIT type FLAG optional
+ !IP_ALIGNMENT_INDENT type ZEXCEL_INDENT optional
+ !IP_PROTECTION_HIDDEN type ZEXCEL_CELL_PROTECTION optional
+ !IP_PROTECTION_LOCKED type ZEXCEL_CELL_PROTECTION optional
+ !IP_BORDERS_ALLBORDERS_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_ALLBORDERS_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_ALLBO_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_ALLBO_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_ALLBO_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_ALLBO_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_DIAGONAL_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_DIAGONAL_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_DIAGONAL_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_DIAGONAL_COLOR_INDE type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_DIAGONAL_COLOR_THEM type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_DIAGONAL_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_DOWN_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_DOWN_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_DOWN_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_DOWN_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_DOWN_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_DOWN_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_LEFT_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_LEFT_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_LEFT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_LEFT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_LEFT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_LEFT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_RIGHT_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_RIGHT_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_RIGHT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_RIGHT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_RIGHT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_RIGHT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ !IP_BORDERS_TOP_STYLE type ZEXCEL_BORDER optional
+ !IP_BORDERS_TOP_COLOR type ZEXCEL_S_STYLE_COLOR optional
+ !IP_BORDERS_TOP_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
+ !IP_BORDERS_TOP_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
+ !IP_BORDERS_TOP_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
+ !IP_BORDERS_TOP_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
+ returning
+ value(EP_GUID) type ZEXCEL_CELL_STYLE
+ raising
+ ZCX_EXCEL .
*"* protected components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
protected section.
@@ -260,6 +365,12 @@ private section.
exporting
!EP_VALUE type SIMPLE
!EP_VALUE_TYPE type ABAP_TYPEKIND .
+ methods CALCULATE_CELL_WIDTH
+ importing
+ !IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
+ !IP_ROW type ZEXCEL_CELL_ROW
+ returning
+ value(EP_WIDTH) type I .
methods UPDATE_DIMENSION_RANGE .
*"* local class implementation for public class
*"* use this source file for the implementation part of
@@ -421,38 +532,38 @@ endclass.
ABAP
SLIS
SOI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
method ZIF_EXCEL_SHEET_PROPERTIES~GET_STYLE.
ep_style = zif_excel_sheet_properties~style.
@@ -513,35 +624,35 @@ endmethod.
me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr.
endmethod.
-
-
+
+
method ADD_DRAWING.
drawings->add( ip_drawing ).
endmethod.
-
-
+
+
method ADD_NEW_CONDITIONAL_STYLE.
CREATE OBJECT eo_conditional_style.
conditional_styles->add( eo_conditional_style ).
endmethod.
-
-
+
+
method ADD_NEW_DATA_VALIDATION.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
endmethod.
-
-
-
-
-
-
-
+
+
+
+
+
+
+
method BIND_ALV.
data: lo_converter type ref to zcl_excel_converter.
@@ -564,26 +675,26 @@ endmethod.
endmethod.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
method BIND_ALV_OLE2.
*--------------------------------------------------------------------*
* Method description:
@@ -2153,8 +2264,8 @@ endmethod.
set country space.
* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die
* Zeichen einer
-* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten.
-* Für die
+* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten.
+* Für die
* darf keine Kommaseparierung stattfinden.
* Changing for correction request - Y6BK041073
if contentsitem-value co '0123456789.,-+E '.
@@ -2653,11 +2764,11 @@ endmethod.
close_document.
endmethod.
-
-
-
-
-
+
+
+
+
+
method BIND_TABLE.
DATA:
@@ -2827,7 +2938,35 @@ endmethod.
endmethod.
-
+
+
+
+
+ METHOD CALCULATE_CELL_WIDTH.
+ DATA: cell_value TYPE zexcel_cell_value,
+ guid TYPE zexcel_cell_style,
+ stylemapping TYPE zexcel_s_stylemapping.
+
+ me->get_cell( EXPORTING ip_column = ip_column " Cell Column
+ ip_row = ip_row " Cell Row
+ IMPORTING ep_value = cell_value
+ ep_guid = guid )." Cell Value ).
+
+
+ ep_width = STRLEN( cell_value ).
+ TRY.
+ stylemapping = me->excel->get_style_to_guid( guid ).
+ CATCH zcx_excel.
+ EXIT. " Do nothing if no style was found
+ ENDTRY.
+
+ IF stylemapping-complete_stylex-font-size = 'X'.
+ ep_width = ep_width * stylemapping-complete_style-font-size / 11.
+ ENDIF.
+
+ENDMETHOD.
+
+
method CALCULATE_COLUMN_WIDTHS.
TYPES:
BEGIN OF t_auto_size,
@@ -2868,25 +3007,29 @@ endmethod.
col_alpha = zcl_excel_common=>convert_column2alpha( <auto_size>-col_index ).
count = 1.
WHILE count <= highest_row.
- IF cell_style IS BOUND.
- CREATE OBJECT cell_style.
- ENDIF.
- me->get_cell(
- EXPORTING
- ip_column = col_alpha " Cell Column
- ip_row = count " Cell Row
- IMPORTING
- ep_value = cell_value " Cell Value
- ep_style = cell_style " Request Cell Style as well
- ).
- " For an easy start we just take the number of characters as the width
- width = strlen( cell_value ).
- " Addition to solve issue #120, contribution by Stefan Schmöcker
- " Calculate width using Font Size and Font Type
- IF cell_style IS BOUND
- AND cell_style->font IS BOUND.
- width = cell_style->font->calculate_text_width( cell_value ).
- ENDIF.
+* Start of change # issue 139 - Dateretention of cellstyles
+* IF cell_style IS BOUND.
+* CREATE OBJECT cell_style.
+* ENDIF.
+* me->get_cell(
+* EXPORTING
+* ip_column = col_alpha " Cell Column
+* ip_row = count " Cell Row
+* IMPORTING
+* ep_value = cell_value " Cell Value
+* ep_style = cell_style " Request Cell Style as well
+* ).
+* " For an easy start we just take the number of characters as the width
+* width = strlen( cell_value ).
+* " Addition to solve issue #120, contribution by Stefan Schmöcker
+* " Calculate width using Font Size and Font Type
+* IF cell_style IS BOUND
+* AND cell_style->font IS BOUND.
+* width = cell_style->font->calculate_text_width( cell_value ).
+* ENDIF.
+ width = calculate_cell_width( ip_column = col_alpha
+ ip_row = count ).
+* End of change # issue 139 - Dateretention of cellstyles
IF width > <auto_size>-width.
<auto_size>-width = width.
ENDIF.
@@ -2899,10 +3042,408 @@ endmethod.
endmethod.
-
-
-
- METHOD constructor.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ METHOD CHANGE_CELL_STYLE.
+" issue # 139
+ DATA: stylemapping TYPE zexcel_s_stylemapping,
+
+ complete_style TYPE zexcel_s_cstyle_complete,
+ complete_stylex TYPE zexcel_s_cstylex_complete,
+
+ borderx TYPE zexcel_s_cstylex_border.
+
+* We have a lot of parameters. Use some macros to make the coding more structured
+
+ DEFINE clear_initial_colorxfields.
+ if &1-rgb is initial.
+ clear &2-rgb.
+ endif.
+ if &1-indexed is initial.
+ clear &2-indexed.
+ endif.
+ if &1-theme is initial.
+ clear &2-theme.
+ endif.
+ if &1-tint is initial.
+ clear &2-tint.
+ endif.
+ END-OF-DEFINITION.
+
+ DEFINE move_supplied_borders.
+ if ip_&1 is supplied. " only act if parameter was supplied
+ if ip_x&1 is supplied. "
+ borderx = ip_x&1. " use supplied x-parameter
+ else.
+ clear borderx with 'X'.
+* clear in a way that would be expected to work easily
+ if ip_&1-border_style is initial.
+ clear borderx-border_style.
+ endif.
+ clear_initial_colorxfields ip_&1-border_color borderx-border_color.
+ endif.
+ move-corresponding ip_&1 to complete_style-&2.
+ move-corresponding borderx to complete_stylex-&2.
+ endif.
+ END-OF-DEFINITION.
+
+* First get current stylsettings
+ TRY.
+ me->get_cell( EXPORTING ip_column = ip_column " Cell Column
+ ip_row = ip_row " Cell Row
+ IMPORTING ep_guid = guid )." Cell Value ).
+
+
+ stylemapping = me->excel->get_style_to_guid( guid ).
+ complete_style = stylemapping-COMPLETE_STYLE.
+ complete_stylex = stylemapping-COMPLETE_STYLEx.
+ CATCH zcx_excel.
+* Error --> use submitted style
+ ENDTRY.
+
+* move_supplied_multistyles: complete.
+ if ip_complete is SUPPLIED.
+ if ip_xcomplete is not supplied.
+ RAISE EXCEPTION TYPE zcx_excel
+ EXPORTING
+ error = 'Complete styleinfo has to be supplied with corresponding X-field'.
+ endif.
+ MOVE-CORRESPONDING ip_complete TO complete_style.
+ MOVE-CORRESPONDING ip_xcomplete TO complete_stylex.
+ endif.
+
+
+
+ IF ip_font IS SUPPLIED.
+ DATA: fontx LIKE ip_xfont.
+ IF ip_xfont IS SUPPLIED.
+ fontx = ip_xfont.
+ ELSE.
+* Only supplied values should be used - exception: Flags bold and italic strikethrough underline
+ MOVE 'X' TO: fontx-bold,
+ fontx-italic,
+ fontx-strikethrough,
+ fontx-underline_mode.
+ CLEAR fontx-color WITH 'X'.
+ clear_initial_colorxfields ip_font-color fontx-color.
+ IF ip_font-family IS NOT INITIAL.
+ fontx-family = 'X'.
+ ENDIF.
+ IF ip_font-name IS NOT INITIAL.
+ fontx-name = 'X'.
+ ENDIF.
+ IF ip_font-scheme IS NOT INITIAL.
+ fontx-scheme = 'X'.
+ ENDIF.
+ IF ip_font-size IS NOT INITIAL.
+ fontx-size = 'X'.
+ ENDIF.
+ IF ip_font-underline_mode IS NOT INITIAL.
+ fontx-underline_mode = 'X'.
+ ENDIF.
+ ENDIF.
+ MOVE-CORRESPONDING ip_font TO complete_style-font.
+ MOVE-CORRESPONDING fontx TO complete_stylex-font.
+* Correction for undeline mode
+ ENDIF.
+
+ IF ip_fill IS SUPPLIED.
+ DATA: fillx LIKE ip_xfill.
+ IF ip_xfill IS SUPPLIED.
+ fillx = ip_xfill.
+ ELSE.
+ CLEAR fillx WITH 'X'.
+ IF ip_fill-filltype IS INITIAL.
+ CLEAR fillx-filltype.
+ ENDIF.
+ clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor.
+ clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor.
+
+ ENDIF.
+ MOVE-CORRESPONDING ip_fill TO complete_style-fill.
+ MOVE-CORRESPONDING fillx TO complete_stylex-fill.
+ ENDIF.
+
+
+ IF ip_borders IS SUPPLIED.
+ DATA: bordersx LIKE ip_xborders.
+ IF ip_xborders IS SUPPLIED.
+ bordersx = ip_xborders.
+ ELSE.
+ CLEAR bordersx WITH 'X'.
+ IF ip_borders-allborders-border_style IS INITIAL.
+ CLEAR bordersx-allborders-border_style.
+ ENDIF.
+ IF ip_borders-diagonal-border_style IS INITIAL.
+ CLEAR bordersx-diagonal-border_style.
+ ENDIF.
+ IF ip_borders-down-border_style IS INITIAL.
+ CLEAR bordersx-down-border_style.
+ ENDIF.
+ IF ip_borders-left-border_style IS INITIAL.
+ CLEAR bordersx-left-border_style.
+ ENDIF.
+ IF ip_borders-right-border_style IS INITIAL.
+ CLEAR bordersx-right-border_style.
+ ENDIF.
+ IF ip_borders-top-border_style IS INITIAL.
+ CLEAR bordersx-top-border_style.
+ ENDIF.
+ clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color.
+ clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color.
+ clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color.
+ clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color.
+ clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color.
+ clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color.
+
+ ENDIF.
+ MOVE-CORRESPONDING ip_borders TO complete_style-borders.
+ MOVE-CORRESPONDING bordersx TO complete_stylex-borders.
+ ENDIF.
+
+ IF ip_alignment IS SUPPLIED.
+ DATA: alignmentx LIKE ip_xalignment.
+ IF ip_xalignment IS SUPPLIED.
+ alignmentx = ip_xalignment.
+ ELSE.
+ CLEAR alignmentx WITH 'X'.
+ IF ip_alignment-horizontal IS INITIAL.
+ CLEAR alignmentx-horizontal.
+ ENDIF.
+ IF ip_alignment-vertical IS INITIAL.
+ CLEAR alignmentx-vertical.
+ ENDIF.
+ ENDIF.
+ MOVE-CORRESPONDING ip_alignment TO complete_style-alignment.
+ MOVE-CORRESPONDING alignmentx TO complete_stylex-alignment.
+ ENDIF.
+
+ IF ip_protection IS SUPPLIED.
+ MOVE-CORRESPONDING ip_alignment TO complete_style-alignment.
+ IF ip_xprotection IS SUPPLIED.
+ MOVE-CORRESPONDING ip_xprotection TO complete_stylex-protection.
+ ELSE.
+ IF ip_protection-hidden IS NOT INITIAL.
+ complete_style-protection-hidden = 'X'.
+ ENDIF.
+ IF ip_protection-locked IS NOT INITIAL.
+ complete_style-protection-locked = 'X'.
+ ENDIF.
+ ENDIF.
+ ENDIF.
+
+
+ move_supplied_borders : borders_allborders borders-allborders,
+ borders_diagonal borders-diagonal ,
+ borders_down borders-down ,
+ borders_left borders-left ,
+ borders_right borders-right ,
+ borders_top borders-top .
+
+ DEFINE move_supplied_singlestyles.
+ if ip_&1 is supplied.
+ complete_style-&2 = ip_&1.
+ complete_stylex-&2 = 'X'.
+ endif.
+ END-OF-DEFINITION.
+
+ move_supplied_singlestyles: number_format_format_code number_format-format_code,
+ font_bold font-bold,
+ font_color font-color,
+ font_color_rgb font-color-rgb,
+ font_color_indexed font-color-indexed,
+ font_color_theme font-color-theme,
+ font_color_tint font-color-tint,
+
+ font_family font-family,
+ font_italic font-italic,
+ font_name font-name,
+ font_scheme font-scheme,
+ font_size font-size,
+ font_strikethrough font-strikethrough,
+ font_underline font-underline,
+ font_underline_mode font-underline_mode,
+ fill_filltype fill-filltype,
+ fill_rotation fill-rotation,
+ fill_fgcolor fill-fgcolor,
+ fill_fgcolor_rgb fill-fgcolor-rgb,
+ fill_fgcolor_indexed fill-fgcolor-indexed,
+ fill_fgcolor_theme fill-fgcolor-theme,
+ fill_fgcolor_tint fill-fgcolor-tint,
+
+ fill_bgcolor fill-bgcolor,
+ fill_bgcolor_rgb fill-bgcolor-rgb,
+ fill_bgcolor_indexed fill-bgcolor-indexed,
+ fill_bgcolor_theme fill-bgcolor-theme,
+ fill_bgcolor_tint fill-bgcolor-tint,
+
+ borders_diagonal_mode borders-diagonal_mode,
+ alignment_horizontal alignment-horizontal,
+ alignment_vertical alignment-vertical,
+ alignment_textrotation alignment-textrotation,
+ alignment_wraptext alignment-wraptext,
+ alignment_shrinktofit alignment-shrinktofit,
+ alignment_indent alignment-indent,
+ protection_hidden protection-hidden,
+ protection_locked protection-locked,
+
+ borders_allborders_style borders-allborders-border_style,
+ borders_allborders_color borders-allborders-border_color,
+ borders_allbo_color_rgb borders-allborders-border_color-rgb,
+ borders_allbo_color_indexed borders-allborders-border_color-indexed,
+ borders_allbo_color_theme borders-allborders-border_color-theme,
+ borders_allbo_color_tint borders-allborders-border_color-tint,
+
+ borders_diagonal_style borders-diagonal-border_style,
+ borders_diagonal_color borders-diagonal-border_color,
+ borders_diagonal_color_rgb borders-diagonal-border_color-rgb,
+ borders_diagonal_color_inde borders-diagonal-border_color-indexed,
+ borders_diagonal_color_them borders-diagonal-border_color-theme,
+ borders_diagonal_color_tint borders-diagonal-border_color-tint,
+
+ borders_down_style borders-down-border_style,
+ borders_down_color borders-down-border_color,
+ borders_down_color_rgb borders-down-border_color-rgb,
+ borders_down_color_indexed borders-down-border_color-indexed,
+ borders_down_color_theme borders-down-border_color-theme,
+ borders_down_color_tint borders-down-border_color-tint,
+
+ borders_left_style borders-left-border_style,
+ borders_left_color borders-left-border_color,
+ borders_left_color_rgb borders-left-border_color-rgb,
+ borders_left_color_indexed borders-left-border_color-indexed,
+ borders_left_color_theme borders-left-border_color-theme,
+ borders_left_color_tint borders-left-border_color-tint,
+
+ borders_right_style borders-right-border_style,
+ borders_right_color borders-right-border_color,
+ borders_right_color_rgb borders-right-border_color-rgb,
+ borders_right_color_indexed borders-right-border_color-indexed,
+ borders_right_color_theme borders-right-border_color-theme,
+ borders_right_color_tint borders-right-border_color-tint,
+
+ borders_top_style borders-top-border_style,
+ borders_top_color borders-top-border_color,
+ borders_top_color_rgb borders-top-border_color-rgb,
+ borders_top_color_indexed borders-top-border_color-indexed,
+ borders_top_color_theme borders-top-border_color-theme,
+ borders_top_color_tint borders-top-border_color-tint.
+
+
+* Now we have a completly filled styles.
+* This can be used to get the guid
+* Return guid if requested. Might be used if copy&paste of styles is requested
+ ep_guid = me->excel->get_static_cellstyle_guid( ip_cstyle_complete = complete_style
+ ip_cstylex_complete = complete_stylex ).
+ me->set_cell_style( ip_column = ip_column
+ ip_row = ip_row
+ ip_style = ep_guid ).
+
+ENDMETHOD.
+
+
+
+
+ method CONSTRUCTOR.
DATA: lv_title TYPE zexcel_sheet_title.
me->excel = ip_excel.
@@ -2940,9 +3481,9 @@ endmethod.
upper_cell-cell_row = 1.
upper_cell-cell_column = 1.
-ENDMETHOD.
+endmethod.
-
+
method DELETE_MERGE.
DELETE sheet_content_merge INDEX 1.
@@ -2950,10 +3491,10 @@ ENDMETHOD.
endmethod.
-
-
-
-
+
+
+
+
method FREEZE_PANES.
data: lv_xsplit type i,
lv_ysplit type i.
@@ -2980,8 +3521,8 @@ endmethod.
freeze_pane_cell_row = ip_num_rows + 1.
endmethod.
-
-
+
+
method GET_ACTIVE_CELL.
DATA: lv_active_column TYPE zexcel_cell_column_alpha,
@@ -2995,12 +3536,13 @@ endmethod.
endmethod.
-
-
-
-
-
-
+
+
+
+
+
+
+
method GET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
@@ -3015,8 +3557,9 @@ endmethod.
ep_rc = sy-subrc.
ep_value = ls_sheet_content-cell_value.
+ ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation
- " Addition to solve issue #120, contribution by Stefan Schmöcker
+ " Addition to solve issue #120, contribution by Stefan Schmöcker
DATA: style_iterator TYPE REF TO cl_object_collection_iterator,
style TYPE REF TO zcl_excel_style.
IF ep_style IS REQUESTED.
@@ -3031,9 +3574,9 @@ endmethod.
ENDIF.
endmethod.
-
-
-
+
+
+
method GET_COLUMN_DIMENSION.
FIELD-SYMBOLS: <fs_column_dimension> LIKE LINE OF column_dimensions.
@@ -3053,40 +3596,40 @@ endmethod.
endmethod.
-
-
+
+
method GET_COLUMN_DIMENSIONS.
r_column_dimension[] = me->column_dimensions[].
endmethod.
-
-
+
+
method GET_COND_STYLES_ITERATOR.
eo_iterator = me->conditional_styles->get_iterator( ).
endmethod.
-
-
+
+
method GET_DATA_VALIDATIONS_ITERATOR.
eo_iterator = me->data_validations->get_iterator( ).
endmethod.
-
-
+
+
method GET_DATA_VALIDATIONS_SIZE.
ep_size = me->data_validations->size( ).
endmethod.
-
-
+
+
method GET_DEFAULT_COLUMN_DIMENSION.
r_column_dimension = me->default_column_dimension.
endmethod.
-
-
+
+
method GET_DEFAULT_EXCEL_DATE_FORMAT.
CONSTANTS: c_lang_e TYPE lang VALUE 'E'.
@@ -3111,14 +3654,14 @@ endmethod.
ep_default_excel_date_format = default_excel_date_format.
endmethod.
-
-
+
+
method GET_DEFAULT_ROW_DIMENSION.
r_row_dimension = me->default_row_dimension.
endmethod.
-
-
+
+
method GET_DIMENSION_RANGE.
me->update_dimension_range( ).
@@ -3135,62 +3678,62 @@ endmethod.
endmethod.
-
-
+
+
method GET_DRAWINGS.
r_drawings = drawings.
endmethod.
-
-
+
+
method GET_DRAWINGS_ITERATOR.
eo_iterator = drawings->get_iterator( ).
endmethod.
-
-
-
+
+
+
method GET_FREEZE_CELL.
ep_row = me->freeze_pane_cell_row.
ep_column = me->freeze_pane_cell_column.
endmethod.
-
-
+
+
method GET_GUID.
ep_guid = me->guid.
endmethod.
-
-
+
+
method GET_HIGHEST_COLUMN.
me->update_dimension_range( ).
r_highest_column = me->lower_cell-cell_column.
endmethod.
-
-
+
+
method GET_HIGHEST_ROW.
me->update_dimension_range( ).
r_highest_row = me->lower_cell-cell_row.
endmethod.
-
-
+
+
method GET_HYPERLINKS_ITERATOR.
eo_iterator = hyperlinks->get_iterator( ).
endmethod.
-
-
+
+
method GET_HYPERLINKS_SIZE.
ep_size = hyperlinks->size( ).
endmethod.
-
-
+
+
method GET_MERGE.
DATA: lv_column_start TYPE string,
@@ -3264,9 +3807,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method GET_ROW_DIMENSION.
FIELD-SYMBOLS: <fs_row_dimension> LIKE LINE OF row_dimensions.
@@ -3286,27 +3829,27 @@ endmethod.
endmethod.
-
-
+
+
method GET_ROW_DIMENSIONS.
r_row_dimension[] = me->row_dimensions[].
endmethod.
-
-
+
+
method GET_TABLES_ITERATOR.
eo_iterator = tables->if_object_collection~get_iterator( ).
endmethod.
-
-
+
+
method GET_TABLES_SIZE.
ep_size = tables->if_object_collection~size( ).
endmethod.
-
-
-
+
+
+
method GET_TITLE.
DATA lv_value TYPE string.
IF ip_escaped EQ abap_true.
@@ -3317,11 +3860,11 @@ endmethod.
ENDIF.
endmethod.
-
-
-
-
- METHOD get_value_type.
+
+
+
+
+ method GET_VALUE_TYPE.
DATA: lo_addit TYPE REF TO cl_abap_elemdescr,
ls_dfies TYPE dfies,
l_function TYPE funcname,
@@ -3371,19 +3914,19 @@ endmethod.
ENDIF.
ENDIF.
-ENDMETHOD.
+endmethod.
-
-
-
-
-
-
-
-
-
-
- METHOD set_cell.
+
+
+
+
+
+
+
+
+
+
+ method SET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
@@ -3527,13 +4070,13 @@ ENDMETHOD.
ENDIF.
-ENDMETHOD.
+endmethod.
-
-
-
-
-
+
+
+
+
+
method SET_CELL_STYLE.
DATA: lv_column TYPE zexcel_cell_column,
@@ -3559,8 +4102,8 @@ ENDMETHOD.
endmethod.
-
-
+
+
method SET_DEFAULT_EXCEL_DATE_FORMAT.
IF ip_default_excel_date_format IS INITIAL.
@@ -3572,11 +4115,11 @@ endmethod.
default_excel_date_format = ip_default_excel_date_format.
endmethod.
-
-
-
-
-
+
+
+
+
+
method SET_MERGE.
DATA: lv_column_start TYPE zexcel_cell_column,
@@ -3613,31 +4156,31 @@ endmethod.
endmethod.
-
-
+
+
method SET_PRINT_GRIDLINES.
me->print_gridlines = i_print_gridlines.
endmethod.
-
-
+
+
method SET_SHOW_GRIDLINES.
me->show_gridlines = i_show_gridlines.
endmethod.
-
-
+
+
method SET_SHOW_ROWCOLHEADERS.
me->show_rowcolheaders = i_show_rowcolheaders.
endmethod.
-
-
-
-
-
-
-
+
+
+
+
+
+
+
method SET_TABLE.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
@@ -3694,13 +4237,13 @@ endmethod.
endmethod.
-
-
+
+
method SET_TITLE.
me->title = ip_title.
endmethod.
-
+
method UPDATE_DIMENSION_RANGE.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk
index 586a671..2f219c0 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk
@@ -1,6 +1,6 @@
-
-
+
+
class ZCL_EXCEL_WRITER_2007 definition
public
create public .
@@ -10,9 +10,9 @@ public section.
*"* do not include other source files here!!!
interfaces ZIF_EXCEL_WRITER .
- *"* protected components of class ZCL_EXCEL_WRITER_2007
+ protected section.
+*"* protected components of class ZCL_EXCEL_WRITER_2007
*"* do not include other source files here!!!
-protected section.
constants C_CONTENT_TYPES type STRING value '[Content_Types].xml'. "#EC NOTEXT
constants C_DOCPROPS_APP type STRING value 'docProps/app.xml'. "#EC NOTEXT
@@ -73,15 +73,15 @@ protected section.
!IV_DRAWING_INDEX type I
returning
value(EP_CONTENT) type XSTRING .
+ methods CREATE_XL_STYLES
+ returning
+ value(EP_CONTENT) type XSTRING .
methods CREATE_XL_STYLES_COLOR_NODE
importing
!IO_DOCUMENT type ref to IF_IXML_DOCUMENT
!IO_PARENT type ref to IF_IXML_ELEMENT
!IV_COLOR_ELEM_NAME type STRING default 'color'
!IS_COLOR type ZEXCEL_S_STYLE_COLOR .
- methods CREATE_XL_STYLES
- returning
- value(EP_CONTENT) type XSTRING .
methods CREATE_XL_TABLE
importing
!IO_TABLE type ref to ZCL_EXCEL_TABLE
@@ -93,9 +93,9 @@ protected section.
methods CREATE_XL_WORKBOOK
returning
value(EP_CONTENT) type XSTRING .
- *"* private components of class ZCL_EXCEL_WRITER_2007
+ private section.
+*"* private components of class ZCL_EXCEL_WRITER_2007
*"* do not include other source files here!!!
-private section.
constants C_OFF type STRING value '0'. "#EC NOTEXT
constants C_ON type STRING value '1'. "#EC NOTEXT
@@ -103,11 +103,6 @@ private section.
data STYLES_COND_MAPPING type ZEXCEL_T_STYLES_COND_MAPPING .
data STYLES_MAPPING type ZEXCEL_T_STYLES_MAPPING .
- methods CREATE_AUTOFILTER_NODE
- importing
- !IO_ROOT type ref to IF_IXML_ELEMENT
- !IO_DOCUMENT type ref to IF_IXML_DOCUMENT
- !IO_AUTOFILTER type ref to ZCL_EXCEL_AUTOFILTER .
methods FLAG2BOOL
importing
!IP_FLAG type FLAG
@@ -126,37 +121,37 @@ private section.
*"* implementation or private method's signature
*"* use this source file for any macro definitions you need
*"* in the implementation part of the class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
method ZIF_EXCEL_WRITER~WRITE_FILE.
me->excel = io_excel.
+
ep_file = me->create( ).
endmethod.
-
-
+
+
method CREATE.
-
* Office 2007 file format is a cab of several xml files with extension .xlsx
DATA: lo_zip TYPE REF TO cl_abap_zip,
@@ -178,6 +173,11 @@ endmethod.
lv_value TYPE string,
lv_drawing_index TYPE i.
+**********************************************************************
+* Start of insertion # issue 139 - Dateretention of cellstyles
+ me->excel->add_static_styles( ).
+* End of insertion # issue 139 - Dateretention of cellstyles
+
**********************************************************************
* STEP 1: Create archive object file (ZIP)
CREATE OBJECT lo_zip.
@@ -321,84 +321,8 @@ endmethod.
endmethod.
-
-
-
-
- method CREATE_AUTOFILTER_NODE.
-** Constant node name
- CONSTANTS: c_xml_node_autofilter TYPE string VALUE 'autoFilter',
- c_xml_node_sheetpr TYPE string VALUE 'sheetPr',
- c_xml_node_filtercolumn TYPE string VALUE 'filterColumn',
- c_xml_node_filters TYPE string VALUE 'filters',
- c_xml_node_filter TYPE string VALUE 'filter'.
-
-** Constant node atributes.
- CONSTANTS: c_xml_attr_ref TYPE string VALUE 'ref',
- c_xml_attr_val TYPE string VALUE 'val',
- c_xml_attr_colid TYPE string VALUE 'colId',
- c_xml_attr_filtermode TYPE string VALUE 'filterMode'.
-
- DATA: lo_element TYPE REF TO if_ixml_element,
- lo_element_2 TYPE REF TO if_ixml_element,
- lo_element_3 TYPE REF TO if_ixml_element,
- lo_element_4 TYPE REF TO if_ixml_element.
-
- DATA: l_ref TYPE string,
- lt_values TYPE zexcel_t_autofilter_values,
- ls_values TYPE zexcel_s_autofilter_values,
- l_col TYPE zexcel_cell_column,
- l_value TYPE zexcel_cell_value.
-
-
- IF io_autofilter IS BOUND.
-* Create node autofilter
- lo_element = io_document->create_simple_element( name = c_xml_node_autofilter
- parent = io_document ).
- l_ref = io_autofilter->get_filter_range( ) .
- CONDENSE l_ref NO-GAPS.
- lo_element->set_attribute_ns( name = c_xml_attr_ref
- value = l_ref ).
- lt_values = io_autofilter->get_values( ) .
- IF lt_values IS NOT INITIAL.
-* If we filter we need to set the filter mode to 1.
- lo_element_2 = io_document->find_from_name( name = c_xml_node_sheetpr ).
- lo_element_2->set_attribute_ns( name = c_xml_attr_filtermode
- value = '1' ).
-* Create node filtercolumn
- CLEAR l_col.
- LOOP AT lt_values INTO ls_values.
- IF ls_values-column <> l_col.
- IF l_col IS NOT INITIAL.
- lo_element_2->append_child( new_child = lo_element_3 ).
- lo_element->append_child( new_child = lo_element_2 ).
- ENDIF.
- lo_element_2 = io_document->create_simple_element( name = c_xml_node_filtercolumn
- parent = lo_element ).
- l_col = ls_values-column - io_autofilter->filter_area-col_start.
- l_value = l_col.
- CONDENSE l_value NO-GAPS.
- lo_element_2->set_attribute_ns( name = c_xml_attr_colid
- value = l_value ).
- lo_element_3 = io_document->create_simple_element( name = c_xml_node_filters
- parent = lo_element_2 ).
- l_col = ls_values-column.
- ENDIF.
- lo_element_4 = io_document->create_simple_element( name = c_xml_node_filter
- parent = lo_element_3 ).
- lo_element_4->set_attribute_ns( name = c_xml_attr_val
- value = ls_values-value ).
- lo_element_3->append_child( new_child = lo_element_4 ). " value node
- ENDLOOP.
- lo_element_2->append_child( new_child = lo_element_3 ).
- lo_element->append_child( new_child = lo_element_2 ).
- ENDIF.
- io_root->append_child( new_child = lo_element ).
- ENDIF.
-endmethod.
-
-
-
+
+
method CREATE_CONTENT_TYPES.
@@ -652,8 +576,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_DOCPROPS_APP.
@@ -875,8 +799,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_DOCPROPS_CORE.
@@ -1000,8 +924,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_RELATIONSHIPS.
@@ -1099,9 +1023,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method CREATE_XL_DRAWINGS.
@@ -1329,9 +1253,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method CREATE_XL_DRAWINGS_RELS.
** Constant node name
@@ -1415,8 +1339,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_XL_RELATIONSHIPS.
@@ -1563,8 +1487,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_XL_SHAREDSTRINGS.
@@ -1680,11 +1604,11 @@ endmethod.
endmethod.
-
-
-
-
- METHOD create_xl_sheet.
+
+
+
+
+ method CREATE_XL_SHEET.
TYPES: BEGIN OF cfvo,
value TYPE zexcel_conditional_value,
@@ -1729,7 +1653,10 @@ endmethod.
lc_xml_node_oddfooter TYPE string VALUE 'oddFooter',
lc_xml_node_evenheader TYPE string VALUE 'evenHeader',
lc_xml_node_evenfooter TYPE string VALUE 'evenFooter',
-
+ lc_xml_node_autofilter TYPE string VALUE 'autoFilter',
+ lc_xml_node_filtercolumn TYPE string VALUE 'filterColumn',
+ lc_xml_node_filters TYPE string VALUE 'filters',
+ lc_xml_node_filter TYPE string VALUE 'filter',
" Node attributes
lc_xml_attr_ref TYPE string VALUE 'ref',
lc_xml_attr_summarybelow TYPE string VALUE 'summaryBelow',
@@ -1824,7 +1751,8 @@ endmethod.
lc_xml_attr_useprinterdefaults TYPE string VALUE 'usePrinterDefaults',
lc_xml_attr_verticaldpi TYPE string VALUE 'verticalDpi',
lc_xml_attr_differentoddeven TYPE string VALUE 'differentOddEven',
-
+ lc_xml_attr_colid TYPE string VALUE 'colId',
+ lc_xml_attr_filtermode TYPE string VALUE 'filterMode',
" Node namespace
lc_xml_node_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
lc_xml_node_r_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
@@ -1852,10 +1780,11 @@ endmethod.
default_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi.
DATA: lv_value TYPE string,
- t_range_merge TYPE string_table,
+ lt_range_merge TYPE string_table,
lv_merge TYPE string,
lv_column_p TYPE zexcel_cell_column_alpha,
lv_column TYPE zexcel_cell_column,
+ lv_cell_value TYPE zexcel_cell_value,
lv_style_guid TYPE zexcel_cell_style,
lv_flag TYPE c,
ls_iconset TYPE zexcel_conditional_iconset,
@@ -1880,15 +1809,16 @@ endmethod.
write_current_row TYPE boolean,
lt_values TYPE zexcel_t_autofilter_values,
ls_values TYPE zexcel_s_autofilter_values,
- l_guid TYPE oltpguid16,
+ lv_guid TYPE oltpguid16,
lo_autofilters TYPE REF TO zcl_excel_autofilters,
lo_autofilter TYPE REF TO zcl_excel_autofilter,
l_autofilter_hidden TYPE flag,
- ls_area TYPE zexcel_s_autofilter_area.
+ ls_area TYPE zexcel_s_autofilter_area,
+ lv_ref TYPE string.
FIELD-SYMBOLS: <ls_sheet_content> TYPE zexcel_s_cell_data,
- <fs_range_merge> LIKE LINE OF t_range_merge,
+ <fs_range_merge> LIKE LINE OF lt_range_merge,
<column_dimension> TYPE zexcel_s_worksheet_columndime,
<row_dimension> TYPE zexcel_s_worksheet_rowdimensio.
@@ -2266,9 +2196,9 @@ endmethod.
" Get column count
col_count = io_worksheet->get_highest_column( ).
" Get autofilter
- l_guid = io_worksheet->get_guid( ) .
+ lv_guid = io_worksheet->get_guid( ) .
lo_autofilters = excel->get_autofilters_reference( ).
- lo_autofilter = lo_autofilters->get( i_sheet_guid = l_guid ) .
+ lo_autofilter = lo_autofilters->get( i_sheet_guid = lv_guid ) .
IF lo_autofilter IS BOUND.
lt_values = lo_autofilter->get_values( ) .
ls_area = lo_autofilter->get_filter_area( ) .
@@ -2421,9 +2351,50 @@ endmethod.
lo_element_root->append_child( new_child = lo_element ). " sheetData node
- create_autofilter_node( io_root = lo_element_root " autofilter node
- io_document = lo_document
- io_autofilter = lo_autofilter ) .
+ IF lo_autofilter IS BOUND.
+* Create node autofilter
+ lo_element = lo_document->create_simple_element( name = lc_xml_node_autofilter
+ parent = lo_document ).
+ lv_ref = lo_autofilter->get_filter_range( ) .
+ CONDENSE lv_ref NO-GAPS.
+ lo_element->set_attribute_ns( name = lc_xml_attr_ref
+ value = lv_ref ).
+ lt_values = lo_autofilter->get_values( ) .
+ IF lt_values IS NOT INITIAL.
+* If we filter we need to set the filter mode to 1.
+ lo_element_2 = lo_document->find_from_name( name = lc_xml_node_sheetpr ).
+ lo_element_2->set_attribute_ns( name = lc_xml_attr_filtermode
+ value = '1' ).
+* Create node filtercolumn
+ CLEAR lv_column.
+ LOOP AT lt_values INTO ls_values.
+ IF ls_values-column <> lv_column.
+ IF lv_column IS NOT INITIAL.
+ lo_element_2->append_child( new_child = lo_element_3 ).
+ lo_element->append_child( new_child = lo_element_2 ).
+ ENDIF.
+ lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_filtercolumn
+ parent = lo_element ).
+ lv_column = ls_values-column - lo_autofilter->filter_area-col_start.
+ lv_value = lv_column.
+ CONDENSE lv_value NO-GAPS.
+ lo_element_2->set_attribute_ns( name = lc_xml_attr_colid
+ value = lv_value ).
+ lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_filters
+ parent = lo_element_2 ).
+ lv_column = ls_values-column.
+ ENDIF.
+ lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_filter
+ parent = lo_element_3 ).
+ lo_element_4->set_attribute_ns( name = lc_xml_attr_val
+ value = ls_values-value ).
+ lo_element_3->append_child( new_child = lo_element_4 ). " value node
+ ENDLOOP.
+ lo_element_2->append_child( new_child = lo_element_3 ).
+ lo_element->append_child( new_child = lo_element_2 ).
+ ENDIF.
+ lo_element_root->append_child( new_child = lo_element ).
+ ENDIF.
IF io_worksheet->zif_excel_sheet_protection~protected EQ abap_true.
" sheetProtection node
@@ -2503,16 +2474,16 @@ endmethod.
ENDIF.
" Merged cells
- t_range_merge = io_worksheet->get_merge( ).
- IF t_range_merge IS NOT INITIAL.
+ lt_range_merge = io_worksheet->get_merge( ).
+ IF lt_range_merge IS NOT INITIAL.
lo_element = lo_document->create_simple_element( name = lc_xml_node_mergecells
parent = lo_document ).
- DESCRIBE TABLE t_range_merge LINES merge_count.
+ DESCRIBE TABLE lt_range_merge LINES merge_count.
lv_value = merge_count.
CONDENSE lv_value.
lo_element->set_attribute_ns( name = lc_xml_attr_count
value = lv_value ).
- LOOP AT t_range_merge ASSIGNING <fs_range_merge>.
+ LOOP AT lt_range_merge ASSIGNING <fs_range_merge>.
lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_mergecell
parent = lo_document ).
@@ -3103,12 +3074,12 @@ endmethod.
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).
-ENDMETHOD.
+endmethod.
-
-
-
-
+
+
+
+
method CREATE_XL_SHEET_RELS.
@@ -3250,8 +3221,8 @@ ENDMETHOD.
endmethod.
-
-
+
+
method CREATE_XL_STYLES.
@@ -4155,11 +4126,11 @@ endmethod.
endmethod.
-
-
-
-
-
+
+
+
+
+
method CREATE_XL_STYLES_COLOR_NODE.
DATA: lo_sub_element TYPE REF TO if_ixml_element,
lv_value TYPE string.
@@ -4206,9 +4177,9 @@ endmethod.
io_parent->append_child( new_child = lo_sub_element ).
endmethod.
-
-
-
+
+
+
method CREATE_XL_TABLE.
DATA: lc_xml_node_table TYPE string VALUE 'table',
@@ -4377,8 +4348,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_XL_THEME.
@@ -4466,8 +4437,8 @@ endmethod.
endmethod.
-
-
+
+
method CREATE_XL_WORKBOOK.
** Constant node name
@@ -4725,9 +4696,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method FLAG2BOOL.
@@ -4738,9 +4709,9 @@ endmethod.
ENDIF.
endmethod.
-
-
-
+
+
+
method GET_SHARED_STRING_INDEX.
diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk
index d5bfd67..e5b5d9d 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk
@@ -1,5 +1,5 @@
-
+
class ZCL_EXCEL_WRITER_XLSM definition
public
inheriting from ZCL_EXCEL_WRITER_2007
@@ -8,17 +8,14 @@
public section.
*"* public components of class ZCL_EXCEL_WRITER_XLSM
-*"* do not include other source files here!!!
-
- methods ZIF_EXCEL_WRITER~WRITE_FILE
- redefinition .
+*"* do not include other source files here!!!
protected section.
*"* protected components of class ZCL_EXCEL_WRITER_XLSM
*"* do not include other source files here!!!
constants C_XL_VBAPROJECT type STRING value 'xl/vbaProject.bin'. "#EC NOTEXT
- methods CREATE
+ methods CREATE_CONTENT_TYPES
redefinition .
methods CREATE_XL_RELATIONSHIPS
redefinition .
@@ -26,7 +23,7 @@ public section.
redefinition .
methods CREATE_XL_WORKBOOK
redefinition .
- methods CREATE_CONTENT_TYPES
+ methods CREATE
redefinition .
private section.
*"* private components of class ZCL_EXCEL_WRITER_XLSM
@@ -39,23 +36,16 @@ public section.
*"* components in the private section
*"* use this source file for any macro definitions you need
*"* in the implementation part of the class
-
-
+
+
-
-
- METHOD zif_excel_writer~write_file.
- me->excel = io_excel.
- ep_file = me->create( ).
-ENDMETHOD.
-
- METHOD create.
+ method CREATE.
* Office 2007 file format is a cab of several xml files with extension .xlsx
@@ -79,6 +69,10 @@ ENDMETHOD.
lv_value TYPE string,
lv_drawing_index TYPE i.
+**********************************************************************
+* Start of insertion # issue 139 - Dateretention of cellstyles
+ me->excel->add_static_styles( ).
+* End of insertion # issue 139 - Dateretention of cellstyles
**********************************************************************
* STEP 1: Create archive object file (ZIP)
@@ -227,10 +221,10 @@ ENDMETHOD.
* STEP 12: Create the final zip
ep_excel = lo_zip->save( ).
-ENDMETHOD.
+endmethod.
- METHOD create_content_types.
+ method CREATE_CONTENT_TYPES.
** Constant node name
DATA: lc_xml_node_workb_ct TYPE string VALUE 'application/vnd.ms-excel.sheet.macroEnabled.main+xml',
lc_xml_node_default TYPE string VALUE 'Default',
@@ -309,10 +303,10 @@ ENDMETHOD.
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).
-ENDMETHOD.
+endmethod.
- METHOD create_xl_relationships.
+ method CREATE_XL_RELATIONSHIPS.
** Constant node name
DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships',
@@ -387,10 +381,10 @@ ENDMETHOD.
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).
-ENDMETHOD.
+endmethod.
- METHOD create_xl_sheet.
+ method CREATE_XL_SHEET.
** Constant node name
DATA: lc_xml_attr_codename TYPE string VALUE 'codeName'.
@@ -451,10 +445,10 @@ ENDMETHOD.
lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ).
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).
-ENDMETHOD.
+endmethod.
- METHOD create_xl_workbook.
+ method CREATE_XL_WORKBOOK.
** Constant node name
DATA: lc_xml_attr_codename TYPE string VALUE 'codeName'.
@@ -514,6 +508,6 @@ ENDMETHOD.
lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ).
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ).
lo_renderer->render( ).
-ENDMETHOD.
+endmethod.
diff --git a/ZA2X/PROG/ZDEMO_EXCEL.slnk b/ZA2X/PROG/ZDEMO_EXCEL.slnk
index feb6ace..1764d80 100644
--- a/ZA2X/PROG/ZDEMO_EXCEL.slnk
+++ b/ZA2X/PROG/ZDEMO_EXCEL.slnk
@@ -1,5 +1,5 @@
-
+
@@ -69,6 +69,8 @@ START-OF-SELECTION.
SUBMIT zdemo_excel31 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Autosize Column with different Font sizes
" zdemo_excel32 is not added because it uses ALV and cannot be processed (Native)
SUBMIT zdemo_excel33 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Table autofilter
+ SUBMIT zdemo_excel34 WITH p_path = p_path AND RETURN. " Static Styles
+ SUBMIT zdemo_excel35 WITH p_path = p_path AND RETURN. " Static Styles
"
" Reader/Writer Demo must always run at the end
" to make sure all documents where created
diff --git a/ZA2X/PROG/ZDEMO_EXCEL28.slnk b/ZA2X/PROG/ZDEMO_EXCEL28.slnk
index 0dc262b..cf4ffa2 100644
--- a/ZA2X/PROG/ZDEMO_EXCEL28.slnk
+++ b/ZA2X/PROG/ZDEMO_EXCEL28.slnk
@@ -1,8 +1,8 @@
-
+
-
+
*&---------------------------------------------------------------------*
diff --git a/ZA2X/PROG/ZDEMO_EXCEL34.slnk b/ZA2X/PROG/ZDEMO_EXCEL34.slnk
new file mode 100644
index 0000000..e5841ad
--- /dev/null
+++ b/ZA2X/PROG/ZDEMO_EXCEL34.slnk
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+ *&---------------------------------------------------------------------*
+*& Report ZDEMO_EXCEL2
+*& Test Styles for ABAP2XLSX
+*&---------------------------------------------------------------------*
+*&
+*&
+*&---------------------------------------------------------------------*
+
+REPORT zdemo_excel34.
+
+DATA: lo_excel TYPE REF TO zcl_excel,
+ lo_excel_writer TYPE REF TO zif_excel_writer,
+ lo_worksheet TYPE REF TO zcl_excel_worksheet.
+
+DATA: lv_file TYPE xstring,
+ lv_bytecount TYPE i,
+ lt_file_tab TYPE solix_tab.
+
+DATA: lv_full_path TYPE string,
+ lv_workdir TYPE string,
+ lv_file_separator TYPE c.
+
+CONSTANTS: lv_default_file_name TYPE string VALUE '34_Static_Styles.xlsx'.
+
+PARAMETERS: p_path TYPE zexcel_export_dir.
+
+AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
+ lv_workdir = p_path.
+ cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
+ CHANGING selected_folder = lv_workdir ).
+ p_path = lv_workdir.
+
+INITIALIZATION.
+ cl_gui_frontend_services=>get_desktop_directory( CHANGING desktop_directory = lv_workdir ).
+ cl_gui_cfw=>flush( ).
+ p_path = lv_workdir.
+
+ sy-title = 'ZDEMO_EXCEL2;Issue 139: Static styles instead of dynamic styles'.
+
+START-OF-SELECTION.
+
+ IF p_path IS INITIAL.
+ p_path = lv_workdir.
+ ENDIF.
+ cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
+ CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
+
+ " Creates active sheet
+ CREATE OBJECT lo_excel.
+
+
+ " Get active sheet
+ lo_worksheet = lo_excel->get_active_worksheet( ).
+ lo_worksheet->set_title( ip_title = 'Styles' ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
+ lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ).
+ lo_worksheet->change_cell_style( ip_column = 'C'
+ ip_row = 3
+ ip_font_bold = abap_true
+ ip_font_italic = abap_true
+ ip_font_name = zcl_excel_style_font=>c_name_arial
+ ip_font_scheme = zcl_excel_style_font=>c_scheme_none
+ ip_font_color_rgb = zcl_excel_style_color=>c_red
+ ).
+ lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ).
+ lo_worksheet->change_cell_style( ip_column = 'D'
+ ip_row = 4
+ ip_font_underline = abap_true
+ ip_font_underline_mode = zcl_excel_style_font=>c_underline_double
+ ip_font_name = zcl_excel_style_font=>c_name_roman
+ ip_font_scheme = zcl_excel_style_font=>c_scheme_none
+ ip_font_family = zcl_excel_style_font=>c_family_roman
+ ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ).
+ lo_worksheet->change_cell_style( ip_column = 'B'
+ ip_row = 5
+ ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid
+ ip_fill_fgcolor_theme = zcl_excel_style_color=>c_theme_accent6
+ ).
+ lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ).
+ lo_worksheet->change_cell_style( ip_column = 'C'
+ ip_row = 6
+ ip_borders_allbo_color_rgb = zcl_excel_style_color=>c_black
+ ip_borders_allborders_style = zcl_excel_style_border=>c_border_thin
+ ip_borders_diagonal_color_rgb = zcl_excel_style_color=>c_black
+ ip_borders_diagonal_style = zcl_excel_style_border=>c_border_thin
+ ip_borders_diagonal_mode = zcl_excel_style_borders=>c_diagonal_both
+ ).
+ lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ).
+ lo_worksheet->change_cell_style( ip_column = 'D'
+ ip_row = 7
+ ip_borders_down_color_rgb = zcl_excel_style_color=>c_black
+ ip_borders_down_style = zcl_excel_style_border=>c_border_thin
+ ip_borders_right_color_rgb = zcl_excel_style_color=>c_black
+ ip_borders_right_style = zcl_excel_style_border=>c_border_thin
+ ip_borders_top_color_rgb = zcl_excel_style_color=>c_gray
+ ip_borders_top_style = zcl_excel_style_border=>c_border_thin
+ ip_borders_left_color_rgb = zcl_excel_style_color=>c_gray
+ ip_borders_left_style = zcl_excel_style_border=>c_border_thin
+ ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ).
+ lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise
+ ip_index = 16
+ ip_color = '0040E0D0' ).
+ lo_worksheet->change_cell_style( ip_column = 'B'
+ ip_row = 9
+ ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid
+ ip_fill_fgcolor_indexed = 16
+ ).
+ " Fill the cell and apply one style
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ).
+ lo_worksheet->change_cell_style( ip_column = 'B'
+ ip_row = 6
+ ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid
+ ip_fill_fgcolor_rgb = zcl_excel_style_color=>c_green
+ ip_font_name = zcl_excel_style_font=>c_name_cambria
+ ip_font_scheme = zcl_excel_style_font=>c_scheme_major
+ ).
+ " Change the style
+* lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ).
+ " Add Style to an empty cell to test Fix for Issue
+ "#44 Exception ZCX_EXCEL thrown when style is set for an empty cell
+ " https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell
+* lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ).
+ lo_worksheet->change_cell_style( ip_column = 'E'
+ ip_row = 6
+ ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid
+ ip_fill_fgcolor_rgb = zcl_excel_style_color=>c_green
+ ip_font_name = zcl_excel_style_font=>c_name_cambria
+ ip_font_scheme = zcl_excel_style_font=>c_scheme_major
+ ).
+
+
+ CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
+ lv_file = lo_excel_writer->write_file( lo_excel ).
+
+ " Convert to binary
+ CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
+ EXPORTING
+ buffer = lv_file
+ IMPORTING
+ output_length = lv_bytecount
+ TABLES
+ binary_tab = lt_file_tab.
+* " This method is only available on AS ABAP > 6.40
+* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
+* lv_bytecount = xstrlen( lv_file ).
+
+ " Save the file
+ cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
+ filename = lv_full_path
+ filetype = 'BIN'
+ CHANGING data_tab = lt_file_tab ).
+
diff --git a/ZA2X/PROG/ZDEMO_EXCEL35.slnk b/ZA2X/PROG/ZDEMO_EXCEL35.slnk
new file mode 100644
index 0000000..dac3c4d
--- /dev/null
+++ b/ZA2X/PROG/ZDEMO_EXCEL35.slnk
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+
+
+ *&---------------------------------------------------------------------*
+*& Report ZDEMO_EXCEL2
+*& Test Styles for ABAP2XLSX
+*&---------------------------------------------------------------------*
+*&
+*&
+*&---------------------------------------------------------------------*
+
+REPORT zdemo_excel35.
+
+DATA: lo_excel TYPE REF TO zcl_excel,
+ lo_excel_writer TYPE REF TO zif_excel_writer,
+ lo_worksheet TYPE REF TO zcl_excel_worksheet,
+ lo_style_bold TYPE REF TO zcl_excel_style,
+ lo_style_underline TYPE REF TO zcl_excel_style,
+ lo_style_filled TYPE REF TO zcl_excel_style,
+ lo_style_border TYPE REF TO zcl_excel_style,
+ lo_style_button TYPE REF TO zcl_excel_style,
+ lo_border_dark TYPE REF TO zcl_excel_style_border,
+ lo_border_light TYPE REF TO zcl_excel_style_border.
+
+DATA: lv_style_bold_guid TYPE zexcel_cell_style,
+ lv_style_underline_guid TYPE zexcel_cell_style,
+ lv_style_filled_guid TYPE zexcel_cell_style,
+ lv_style_filled_green_guid TYPE zexcel_cell_style,
+ lv_style_border_guid TYPE zexcel_cell_style,
+ lv_style_button_guid TYPE zexcel_cell_style,
+ lv_style_filled_turquoise_guid TYPE zexcel_cell_style.
+
+DATA: lv_file TYPE xstring,
+ lv_bytecount TYPE i,
+ lt_file_tab TYPE solix_tab.
+
+DATA: lv_full_path TYPE string,
+ lv_workdir TYPE string,
+ lv_file_separator TYPE c.
+
+CONSTANTS: lv_default_file_name TYPE string VALUE '35_Static_Styles.xlsx'.
+
+PARAMETERS: p_path TYPE zexcel_export_dir.
+
+AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
+ lv_workdir = p_path.
+ cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
+ CHANGING selected_folder = lv_workdir ).
+ p_path = lv_workdir.
+
+INITIALIZATION.
+ cl_gui_frontend_services=>GET_DESKTOP_DIRECTORY( CHANGING DESKTOP_DIRECTORY = lv_workdir ).
+ cl_gui_cfw=>flush( ).
+ p_path = lv_workdir.
+
+ sy-title = 'ZDEMO_EXCEL2;Issue 139: Change cellstyle retroactivly'.
+
+START-OF-SELECTION.
+
+ IF p_path IS INITIAL.
+ p_path = lv_workdir.
+ ENDIF.
+ cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
+ CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
+
+ " Creates active sheet
+ CREATE OBJECT lo_excel.
+
+ " Create border object
+ CREATE OBJECT lo_border_dark.
+ lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
+ lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
+ CREATE OBJECT lo_border_light.
+ lo_border_light->border_color-rgb = zcl_excel_style_color=>c_gray.
+ lo_border_light->border_style = zcl_excel_style_border=>c_border_thin.
+ " Create a bold / italic style
+ lo_style_bold = lo_excel->add_new_style( ).
+ lo_style_bold->font->bold = abap_true.
+ lo_style_bold->font->italic = abap_true.
+ lo_style_bold->font->name = zcl_excel_style_font=>c_name_arial.
+ lo_style_bold->font->scheme = zcl_excel_style_font=>c_scheme_none.
+ lo_style_bold->font->color-rgb = zcl_excel_style_color=>c_red.
+ lv_style_bold_guid = lo_style_bold->get_guid( ).
+ " Create an underline double style
+ lo_style_underline = lo_excel->add_new_style( ).
+ lo_style_underline->font->underline = abap_true.
+ lo_style_underline->font->underline_mode = zcl_excel_style_font=>c_underline_double.
+ lo_style_underline->font->name = zcl_excel_style_font=>c_name_roman.
+ lo_style_underline->font->scheme = zcl_excel_style_font=>c_scheme_none.
+ lo_style_underline->font->family = zcl_excel_style_font=>c_family_roman.
+ lv_style_underline_guid = lo_style_underline->get_guid( ).
+ " Create filled style yellow
+ lo_style_filled = lo_excel->add_new_style( ).
+ lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
+ lo_style_filled->fill->fgcolor-theme = zcl_excel_style_color=>c_theme_accent6.
+ lv_style_filled_guid = lo_style_filled->get_guid( ).
+ " Create border with button effects
+ lo_style_button = lo_excel->add_new_style( ).
+ lo_style_button->borders->right = lo_border_dark.
+ lo_style_button->borders->down = lo_border_dark.
+ lo_style_button->borders->left = lo_border_light.
+ lo_style_button->borders->top = lo_border_light.
+ lv_style_button_guid = lo_style_button->get_guid( ).
+ "Create style with border
+ lo_style_border = lo_excel->add_new_style( ).
+ lo_style_border->borders->allborders = lo_border_dark.
+ lo_style_border->borders->diagonal = lo_border_dark.
+ lo_style_border->borders->diagonal_mode = zcl_excel_style_borders=>c_diagonal_both.
+ lv_style_border_guid = lo_style_border->get_guid( ).
+ " Create filled style green
+ lo_style_filled = lo_excel->add_new_style( ).
+ lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
+ lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_green.
+ lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
+ lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
+ lv_style_filled_green_guid = lo_style_filled->get_guid( ).
+
+ " Create filled style turquoise using legacy excel ver <= 2003 palette. (https://code.sdn.sap.com/spaces/abap2xlsx/tickets/92)
+ lo_style_filled = lo_excel->add_new_style( ).
+ lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise
+ ip_index = 16
+ ip_color = '0040E0D0' ).
+
+ lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
+ lo_style_filled->fill->fgcolor-indexed = 16.
+ lv_style_filled_turquoise_guid = lo_style_filled->get_guid( ).
+
+ " Get active sheet
+ lo_worksheet = lo_excel->get_active_worksheet( ).
+ lo_worksheet->set_title( ip_title = 'Styles' ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
+ lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_bold_guid ).
+ lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ip_style = lv_style_underline_guid ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
+ lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ip_style = lv_style_border_guid ).
+ lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ip_style = lv_style_button_guid ).
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ip_style = lv_style_filled_turquoise_guid ).
+ " Fill the cell and apply one style
+ lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
+ " Change the style
+ lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ip_style = lv_style_filled_green_guid ).
+ " Add Style to an empty cell to test Fix for Issue
+ "#44 Exception ZCX_EXCEL thrown when style is set for an empty cell
+ " https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell
+ lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ip_style = lv_style_filled_green_guid ).
+
+
+* Demonstrate how to retroactivly change the cellstyle
+*Filled text and underlinded text
+ lo_worksheet->change_cell_style( ip_column = 'B'
+ ip_row = 5
+ ip_font_bold = abap_true
+ ip_font_italic = abap_true ).
+
+ lo_worksheet->change_cell_style( ip_column = 'D'
+ ip_row = 4
+ ip_font_bold = abap_true
+ ip_font_italic = abap_true ).
+
+ CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
+ lv_file = lo_excel_writer->write_file( lo_excel ).
+
+ " Convert to binary
+ CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
+ EXPORTING
+ buffer = lv_file
+ IMPORTING
+ output_length = lv_bytecount
+ TABLES
+ binary_tab = lt_file_tab.
+* " This method is only available on AS ABAP > 6.40
+* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
+* lv_bytecount = xstrlen( lv_file ).
+
+ " Save the file
+ cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
+ filename = lv_full_path
+ filetype = 'BIN'
+ CHANGING data_tab = lt_file_tab ).
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk
new file mode 100644
index 0000000..7ac72db
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk
new file mode 100644
index 0000000..9601fcd
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk
new file mode 100644
index 0000000..108f351
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk
new file mode 100644
index 0000000..627de69
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk
new file mode 100644
index 0000000..0fdb482
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk
new file mode 100644
index 0000000..3c62a01
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk
new file mode 100644
index 0000000..85729f5
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk
new file mode 100644
index 0000000..92e735a
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk
new file mode 100644
index 0000000..c104a1a
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk
new file mode 100644
index 0000000..a4c1e96
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk
new file mode 100644
index 0000000..ed69323
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk
new file mode 100644
index 0000000..68e365d
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk
new file mode 100644
index 0000000..8a15f21
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk
new file mode 100644
index 0000000..0c2e588
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk
new file mode 100644
index 0000000..5550d1a
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk
new file mode 100644
index 0000000..fb15bbf
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk
new file mode 100644
index 0000000..1314a3a
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk b/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk
new file mode 100644
index 0000000..9fe1a3a
--- /dev/null
+++ b/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk
new file mode 100644
index 0000000..ca00b4b
--- /dev/null
+++ b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk
new file mode 100644
index 0000000..167323e
--- /dev/null
+++ b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk
@@ -0,0 +1,4 @@
+
+
+
+