From 524c8f5e124740177a0812a893f339a8246ad965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schm=C3=B6cker?= Date: Fri, 23 Oct 2015 08:52:33 +0200 Subject: [PATCH 1/4] Add formula as export parameter to ZCL_EXCEL_WORKSHEET->GET_CELL Autofilters got lost at last attempt to modularize the very long method ZCL_EXCEL_WRITER_2007->CREATE_XL_SHEET --- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 14 ++++++++------ ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index f60a4db..7afd5cb 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -40,10 +40,10 @@ "/> - - - + + + *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -3874,6 +3874,7 @@ ENDMETHOD. + method GET_CELL. @@ -3888,10 +3889,11 @@ ENDMETHOD. cell_column = lv_column. 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 + ep_value = ls_sheet_content-cell_value. + ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation + ep_formula = ls_sheet_content-cell_formula. - " 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. diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk index 1eb3077..7e765e0 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk @@ -3533,8 +3533,8 @@ ENDMETHOD. * col_count = io_worksheet->get_highest_column( ). * " Get autofilter ** lv_guid = io_worksheet->get_guid( ) . -* lo_autofilters = excel->get_autofilters_reference( ). -* lo_autofilter = lo_autofilters->get( io_worksheet = io_worksheet ) . + lo_autofilters = excel->get_autofilters_reference( ). + lo_autofilter = lo_autofilters->get( io_worksheet = io_worksheet ) . * IF lo_autofilter IS BOUND. * lt_values = lo_autofilter->get_values( ) . * ls_area = lo_autofilter->get_filter_area( ) . From 96d945145e027045f9b74cb6a7b73487aaacd843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schm=C3=B6cker?= Date: Sun, 22 Nov 2015 12:15:18 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Contribution=20by=20Stefan=20Schnell:=20=20?= =?UTF-8?q?Added=20all=20built-in=20styles=20into=20class=20ZCL=5FEXCEL=5F?= =?UTF-8?q?TABLE=20Hint=20by=20Stefan=20Schnell:=20=20Sometimes=20my=20nam?= =?UTF-8?q?e=20(=20or=20better=20the=20umlaut=20in=20my=20name=20)=20seems?= =?UTF-8?q?=20to=20cause=20problems.=20=20I=20changed=20it=20from=20=C3=B6?= =?UTF-8?q?=20to=20oe=20wherever=20still=20wrong?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk | 18 ++-- ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk | 29 ++--- ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk | 156 +++++++++++++-------------- ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk | 67 +++++++++--- ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk | 6 +- 5 files changed, 160 insertions(+), 116 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk index 1f29798..ec06b8c 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk @@ -1400,7 +1400,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-12-29 +* - Stefan Schmoecker, (done) 2012-12-29 * - ... * changes: renaming variables to naming conventions * removing unused variables @@ -1409,7 +1409,7 @@ ENDMETHOD. * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#246 - error converting lower case column names -* - Stefan Schmöcker, 2012-12-29 +* - Stefan Schmoecker, 2012-12-29 * changes: translating the correct variable to upper dase * adding missing exception if input is a number * that is out of bounds @@ -1559,7 +1559,7 @@ ENDMETHOD. *--------------------------------------------------------------------* "issue #256 - replacing char processing with regex *--------------------------------------------------------------------* -* Stefan Schmöcker, 2013-08-11 +* Stefan Schmoecker, 2013-08-11 * Allow input to be CLIKE instead of STRING *--------------------------------------------------------------------* @@ -1585,7 +1585,7 @@ endmethod. method CONVERT_RANGE2COLUMN_A_ROW. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-12-07 +* - Stefan Schmoecker, (done) 2012-12-07 * - ... * changes: renaming variables to naming conventions * aligning code @@ -1595,12 +1595,12 @@ endmethod. *--------------------------------------------------------------------* * issue#241 - error when sheetname contains "!" * - sheetname should be returned unescaped -* - Stefan Schmöcker, 2012-12-07 +* - Stefan Schmoecker, 2012-12-07 * changes: changed coding to support sheetnames with "!" * unescaping sheetname *--------------------------------------------------------------------* * issue#155 - lessening restrictions of input parameters -* - Stefan Schmöcker, 2012-12-07 +* - Stefan Schmoecker, 2012-12-07 * changes: i_range changed to clike * e_sheet changed to clike *--------------------------------------------------------------------* @@ -1814,19 +1814,19 @@ endmethod. method ESCAPE_STRING. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-12-08 +* - Stefan Schmoecker, (done) 2012-12-08 * - ... * changes: aligning code * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#242 - Support escaping for white-spaces * - Escaping also necessary when ' encountered in input -* - Stefan Schmöcker, 2012-12-08 +* - Stefan Schmoecker, 2012-12-08 * changes: switched check if escaping is necessary to regular expression * and moved the "REPLACE" *--------------------------------------------------------------------* * issue#155 - lessening restrictions of input parameters -* - Stefan Schmöcker, 2012-12-08 +* - Stefan Schmoecker, 2012-12-08 * changes: ip_value changed to clike *--------------------------------------------------------------------* DATA: lv_value TYPE string. diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index ddaea23..6c8d786 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -498,7 +498,7 @@ ENDMETHOD. method fill_struct_from_attributes. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmoecker, (done) 2012-11-07 * - ... * changes: renaming variables to naming conventions * aligning code @@ -933,7 +933,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-11 +* - Stefan Schmoecker, (done) 2012-11-11 * - ... * changes: renaming variables to naming conventions * renaming variables to indicate what they are used for @@ -1049,7 +1049,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (wip ) 2012-11-25 +* - Stefan Schmoecker, (wip ) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1287,7 +1287,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1421,7 +1421,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1589,7 +1589,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1721,7 +1721,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * adding comments to explain what we are trying to achieve @@ -1781,7 +1781,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-10 +* - Stefan Schmoecker, (done) 2012-11-10 * - ... * changes: renaming variables to naming conventions * aligning code @@ -1793,15 +1793,15 @@ ENDMETHOD. * ip_excel renamed while being at it --> rename to io_excel *--------------------------------------------------------------------* * issue #232 - Read worksheetstate hidden/veryHidden -* - Stefan Schmöcker, 2012-11-11 +* - Stefan Schmoecker, 2012-11-11 *--------------------------------------------------------------------* * issue#235 - repeat rows/columns -* - Stefan Schmöcker, 2012-12-02 +* - Stefan Schmoecker, 2012-12-02 * changes: correction in named ranges to correctly attach * sheetlocal names/ranges to the correct sheet *--------------------------------------------------------------------* * issue#284 - Copied formulae ignored when reading excelfile -* - Stefan Schmöcker, 2013-08-02 +* - Stefan Schmoecker, 2013-08-02 * changes: initialize area to hold referenced formulaedata * after all worksheets have been read resolve formuae *--------------------------------------------------------------------* @@ -2102,7 +2102,8 @@ ENDMETHOD. zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value IMPORTING e_column_start = lv_col_start_alpha e_column_end = lv_col_end_alpha - e_row_start = ls_area-row_start ). + e_row_start = ls_area-row_start + e_row_end = ls_area-row_end ). ls_area-col_start = zcl_excel_common=>convert_column2int( lv_col_start_alpha ). ls_area-col_end = zcl_excel_common=>convert_column2int( lv_col_end_alpha ). lo_autofilter->set_filter_area( is_area = ls_area ). @@ -2203,7 +2204,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, +* - Stefan Schmoecker, * - ... * changes: renaming variables to naming conventions * aligning code (started) @@ -3840,7 +3841,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-11 +* - Stefan Schmoecker, (done) 2012-11-11 * - ... * changes: replaced previous coding by regular expression * adding comments to explain what we are trying to achieve diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk index 61a530f..e01cbcd 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk @@ -1,78 +1,78 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CALCULATE_TEXT_WIDTH. - " Addition to solve issue #120, contribution by Stefan Schmöcker - r_width = strlen( i_text ). - " use scale factor based on default 11 - " ( don't know where defaultsetting is stored currently ) - r_width = r_width * me->size / 11. - endmethod. - - - method CONSTRUCTOR. - me->color-rgb = zcl_excel_style_color=>c_black. - me->color-theme = zcl_excel_style_color=>c_theme_not_set. - me->color-indexed = zcl_excel_style_color=>c_indexed_not_set. - me->scheme = zcl_excel_style_font=>c_scheme_minor. - me->underline_mode = zcl_excel_style_font=>c_underline_single. - endmethod. - - - - method GET_STRUCTURE. - - es_font-bold = me->bold. - es_font-italic = me->italic. - es_font-underline = me->underline. - es_font-underline_mode = me->underline_mode. - es_font-strikethrough = me->strikethrough. - es_font-size = me->size. - es_font-color = me->color. - es_font-name = me->name. - es_font-family = me->family. - es_font-scheme = me->scheme. - - endmethod. - - + + + *"* local class implementation for public class +*"* use this source file for the implementation part of +*"* local helper classes + *"* use this source file for any type declarations (class +*"* definitions, interfaces or data types) you need for method +*"* implementation or private method's signature + *"* use this source file for any macro definitions you need +*"* in the implementation part of the class + + ABAP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + method CALCULATE_TEXT_WIDTH. + " Addition to solve issue #120, contribution by Stefan Schmoecker + r_width = strlen( i_text ). + " use scale factor based on default 11 + " ( don't know where defaultsetting is stored currently ) + r_width = r_width * me->size / 11. + endmethod. + + + method CONSTRUCTOR. + me->color-rgb = zcl_excel_style_color=>c_black. + me->color-theme = zcl_excel_style_color=>c_theme_not_set. + me->color-indexed = zcl_excel_style_color=>c_indexed_not_set. + me->scheme = zcl_excel_style_font=>c_scheme_minor. + me->underline_mode = zcl_excel_style_font=>c_underline_single. + endmethod. + + + + method GET_STRUCTURE. + + es_font-bold = me->bold. + es_font-italic = me->italic. + es_font-underline = me->underline. + es_font-underline_mode = me->underline_mode. + es_font-strikethrough = me->strikethrough. + es_font-size = me->size. + es_font-color = me->color. + es_font-name = me->name. + es_font-family = me->family. + es_font-scheme = me->scheme. + + endmethod. + + diff --git a/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk index 4a6bb67..be94381 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk @@ -1,5 +1,5 @@ - + *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -11,21 +11,64 @@ ABAP + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk index 7e765e0..bb0c9ba 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk @@ -2810,7 +2810,7 @@ ENDMETHOD. *--------------------------------------------------------------------* * issue #237 - Error writing column-style -* - Stefan Schmöcker, 2012-11-01 +* - Stefan Schmoecker, 2012-11-01 *--------------------------------------------------------------------* TYPES: BEGIN OF cfvo, @@ -6716,13 +6716,13 @@ ENDMETHOD. METHOD create_xl_workbook. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmoecker, (done) 2012-11-07 * - ... * changes: aligning code * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#235 - repeat rows/columns -* - Stefan Schmöcker, 2012-12-01 +* - Stefan Schmoecker, 2012-12-01 * changes: correction of pointer to localSheetId *--------------------------------------------------------------------* From 94ac8cfbd24c0ef4f482bd108914c7797b31b7bf Mon Sep 17 00:00:00 2001 From: Stefan Schnell Date: Wed, 9 Dec 2015 14:49:10 +0100 Subject: [PATCH 3/4] Update ZCL_EXCEL_WORKSHEET.slnk Code correction for HANA functional correctness. --- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index 7afd5cb..94aebe5 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -3093,7 +3093,8 @@ METHOD calculate_cell_width. FROM tfo01 INTO TABLE lt_font_families UP TO 1 ROWS - WHERE tdtext = ld_font_name. + WHERE tdtext = ld_font_name + ORDER BY PRIMARY KEY. " Check if a matching font family was found " Fonts can be uploaded from TTF files using transaction SE73 From e3d34b87681e0312998ef37174b75e7cb8c7d430 Mon Sep 17 00:00:00 2001 From: GARCIA Guillaume Date: Mon, 28 Dec 2015 13:36:01 +0100 Subject: [PATCH 4/4] Description correction Corrected a copy/paste error for Drawings attribute --- ZA2X/CLAS/ZCL_EXCEL.slnk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL.slnk b/ZA2X/CLAS/ZCL_EXCEL.slnk index db60250..7d5613d 100644 --- a/ZA2X/CLAS/ZCL_EXCEL.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL.slnk @@ -120,7 +120,7 @@ ENDCLASS. "zcl_Tc_Excel - +