From 98a508cb110c3ba551dbd7ae4938a936ea47885a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20P=C4=99giel?= Date: Thu, 31 Mar 2016 20:09:30 +0200 Subject: [PATCH] Worksheet, number --- ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk | 14 +- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 245 +++++++++++-------- 2 files changed, 146 insertions(+), 113 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk index 3b485c2..db0ffa4 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk @@ -1,11 +1,11 @@ - - + - *"* local class implementation for public class *"* use this source file for the implementation part of @@ -16,6 +16,8 @@ *"* use this source file for any macro definitions you need *"* in the implementation part of the class + + diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index f60a4db..5fb310a 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -1,15 +1,15 @@ - - - - - - - - - - - - + + + *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -199,6 +199,9 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION *"* use this source file for any macro definitions you need *"* in the implementation part of the class + + + @@ -222,6 +225,9 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION + + + @@ -232,7 +238,6 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION ABAP SLIS SOI - @@ -246,7 +251,7 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION - + @@ -256,19 +261,19 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION - + - - - - - - + + + + + + @@ -520,6 +525,7 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION + method BIND_ALV. data: lo_converter type ref to zcl_excel_converter. @@ -533,7 +539,7 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION it_table = it_table i_row_int = i_top i_column_int = i_left - i_table = abap_true + i_table = i_table i_style_table = table_style io_worksheet = me changing @@ -2636,7 +2642,8 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION - + + method BIND_TABLE. *--------------------------------------------------------------------* @@ -2652,8 +2659,8 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION *--------------------------------------------------------------------* CONSTANTS: - lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'B', - lc_top_left_row TYPE zexcel_cell_row VALUE 3. + lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'A', + lc_top_left_row TYPE zexcel_cell_row VALUE 1. DATA: lv_row_int TYPE zexcel_cell_row, @@ -2773,18 +2780,43 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION " Check if a column with the same name exists, if exists add a counter " If no medium description is provided we try to use small or long * lv_value = <ls_field_catalog>-scrtext_m. - IF <ls_field_catalog>-scrtext_m IS NOT INITIAL. - lv_value = <ls_field_catalog>-scrtext_m. - <ls_field_catalog>-scrtext_l = lv_value. - ELSEIF <ls_field_catalog>-scrtext_s IS NOT INITIAL. - lv_value = <ls_field_catalog>-scrtext_s. - <ls_field_catalog>-scrtext_l = lv_value. - ELSEIF <ls_field_catalog>-scrtext_l IS NOT INITIAL. - lv_value = <ls_field_catalog>-scrtext_l. - ELSE. - lv_value = 'Column'. " default value as Excel does - <ls_field_catalog>-scrtext_l = lv_value. - ENDIF. + field-symbols: <scrtxt1> type any, + <scrtxt2> type any, + <scrtxt3> type any. + + case iv_default_descr. + when 'M'. + assign <ls_field_catalog>-scrtext_m to <scrtxt1>. + assign <ls_field_catalog>-scrtext_s to <scrtxt2>. + assign <ls_field_catalog>-scrtext_l to <scrtxt3>. + when 'S'. + assign <ls_field_catalog>-scrtext_s to <scrtxt1>. + assign <ls_field_catalog>-scrtext_m to <scrtxt2>. + assign <ls_field_catalog>-scrtext_l to <scrtxt3>. + when 'L'. + assign <ls_field_catalog>-scrtext_l to <scrtxt1>. + assign <ls_field_catalog>-scrtext_m to <scrtxt2>. + assign <ls_field_catalog>-scrtext_s to <scrtxt3>. + when others. + assign <ls_field_catalog>-scrtext_m to <scrtxt1>. + assign <ls_field_catalog>-scrtext_s to <scrtxt2>. + assign <ls_field_catalog>-scrtext_l to <scrtxt3>. + endcase. + + + if <scrtxt1> is not initial. + lv_value = <scrtxt1>. + <ls_field_catalog>-scrtext_l = lv_value. + elseif <scrtxt2> is not initial. + lv_value = <scrtxt2>. + <ls_field_catalog>-scrtext_l = lv_value. + elseif <scrtxt3> is not initial. + lv_value = <scrtxt3>. + <ls_field_catalog>-scrtext_l = lv_value. + else. + lv_value = 'Column'. " default value as Excel does + <ls_field_catalog>-scrtext_l = lv_value. + endif. WHILE 1 = 1. lv_value_lowercase = lv_value. TRANSLATE lv_value_lowercase TO LOWER CASE. @@ -2795,10 +2827,9 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION EXIT. ELSE. lv_syindex = sy-index. - DO lv_syindex TIMES. - CONCATENATE lv_value ' ' INTO lv_value RESPECTING BLANKS. - ENDDO. + CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value. ENDIF. + ENDWHILE. " First of all write column header IF <ls_field_catalog>-style_header IS NOT INITIAL. @@ -2819,7 +2850,7 @@ ENDCLASS. "lcl_gui_alv_grid DEFINITION " issue #290 Add formula support in table IF <ls_field_catalog>-formula EQ abap_true. IF <ls_field_catalog>-style IS NOT INITIAL. - IF <ls_field_catalog>-abap_type IS NOT INITIAL. + IF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = <fs_fldval> @@ -3313,72 +3344,72 @@ ENDMETHOD. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + METHOD change_cell_style. " issue # 139