diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index 3ac3ac9..02df0d8 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -1,5 +1,5 @@ - + @@ -4063,12 +4063,12 @@ endmethod. - method SET_CELL. + METHOD set_cell. DATA: lv_column TYPE zexcel_cell_column, ls_sheet_content TYPE zexcel_s_cell_data, lv_row_alpha TYPE string, - lv_col_alpha TYPE ZEXCEL_CELL_COLUMN_ALPHA, + lv_col_alpha TYPE zexcel_cell_column_alpha, lv_value TYPE zexcel_cell_value, lv_data_type TYPE zexcel_cell_data_type, lv_value_type TYPE abap_typekind, @@ -4150,7 +4150,7 @@ endmethod. lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ). ENDIF. - WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num or + WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num OR cl_abap_typedescr=>typekind_hex. lv_value = <fs_value>. lv_data_type = 's'. @@ -4229,7 +4229,7 @@ endmethod. * SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster * SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster - lv_col_alpha = zcl_excel_common=>CONVERT_COLUMN2ALPHA( ip_column ). " issue #155 - less restrictive typing for ip_column + lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data * APPEND ls_sheet_content TO sheet_content. @@ -4278,7 +4278,15 @@ endmethod. ENDCASE. * End of change issue #152 - don't touch exisiting style if only value is passed -endmethod. +* Fix issue #162 + IF ip_value CS cl_abap_char_utilities=>cr_lf. + me->change_cell_style( ip_column = ip_column + ip_row = ip_row + ip_alignment_wraptext = abap_true ). + ENDIF. +* End of Fix issue #162 + +ENDMETHOD. diff --git a/ZA2X/PROG/ZDEMO_EXCEL14.slnk b/ZA2X/PROG/ZDEMO_EXCEL14.slnk index 5b001a9..c2a974b 100644 --- a/ZA2X/PROG/ZDEMO_EXCEL14.slnk +++ b/ZA2X/PROG/ZDEMO_EXCEL14.slnk @@ -1,5 +1,5 @@ - - + + @@ -27,6 +27,7 @@ DATA: lo_excel TYPE REF TO zcl_excel, lo_style_top TYPE REF TO zcl_excel_style, lo_style_justify TYPE REF TO zcl_excel_style, lo_style_mixed TYPE REF TO zcl_excel_style, + lo_style_mixed_wrap TYPE REF TO zcl_excel_style, lo_style_rotated TYPE REF TO zcl_excel_style, lo_style_shrink TYPE REF TO zcl_excel_style, lo_style_indent TYPE REF TO zcl_excel_style, @@ -39,6 +40,7 @@ DATA: lo_excel TYPE REF TO zcl_excel, lv_style_top_guid TYPE zexcel_cell_style, lv_style_justify_guid TYPE zexcel_cell_style, lv_style_mixed_guid TYPE zexcel_cell_style, + lv_style_mixed_wrap_guid TYPE zexcel_cell_style, lv_style_rotated_guid TYPE zexcel_cell_style, lv_style_shrink_guid TYPE zexcel_cell_style, lv_style_indent_guid TYPE zexcel_cell_style. @@ -100,18 +102,24 @@ START-OF-SELECTION. lo_style_indent->alignment->indent = 5. lv_style_indent_guid = lo_style_indent->get_guid( ). + "Middle / Centered / Wrap + lo_style_mixed_wrap = lo_excel->add_new_style( ). + lo_style_mixed_wrap->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_mixed_wrap->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lo_style_mixed_wrap->alignment->wraptext = abap_true. + lv_style_mixed_wrap_guid = lo_style_mixed_wrap->get_guid( ). + "Middle / Centered / Wrap lo_style_mixed = lo_excel->add_new_style( ). lo_style_mixed->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. lo_style_mixed->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. - lo_style_mixed->alignment->wraptext = abap_true. lv_style_mixed_guid = lo_style_mixed->get_guid( ). "Center lo_style_rotated = lo_excel->add_new_style( ). lo_style_rotated->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. lo_style_rotated->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. - lo_style_rotated->alignment->textrotation = 165. " -75° == 90° + 75° + lo_style_rotated->alignment->textrotation = 165. " -75° == 90° + 75° lv_style_rotated_guid = lo_style_rotated->get_guid( ). @@ -141,14 +149,20 @@ START-OF-SELECTION. " Wrapped lo_worksheet->set_cell( ip_row = 10 ip_column = 'B' ip_value = 'This is a wrapped text centered in the middle' - ip_style = lv_style_mixed_guid ). + ip_style = lv_style_mixed_wrap_guid ). " Rotated lo_worksheet->set_cell( ip_row = 10 ip_column = 'D' - ip_value = 'This is a centered text rotated by -75°' + ip_value = 'This is a centered text rotated by -75°' ip_style = lv_style_rotated_guid ). - + " forced line break + DATA: lv_value TYPE string. + CONCATENATE 'This is a wrapped text centered in the middle' cl_abap_char_utilities=>cr_lf + 'and a manuall line break.' INTO lv_value. + lo_worksheet->set_cell( ip_row = 11 ip_column = 'B' + ip_value = lv_value + ip_style = lv_style_mixed_guid ). *** Create output lcl_output=>output( lo_excel ).