From 21a63fd96eea372cd862a8ad547aeeb2d74eabc5 Mon Sep 17 00:00:00 2001 From: oliver-huetkoeper Date: Thu, 2 Oct 2014 08:10:42 +0200 Subject: [PATCH] Ignore merged cells when calculating column width When calculating column width cells that are merged should be ignored. This is MS Excel behavior and should be handled similar in ABAP2XLSX. --- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index 33dca93..eabbefc 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -3174,6 +3174,10 @@ ENDMETHOD. * col_alpha = zcl_excel_common=>convert_column2alpha( <auto_size>-col_index )." issue #155 - less restrictive typing for ip_column count = 1. WHILE count <= highest_row. +* Do not check merged cells + IF is_cell_merged( + ip_column = <auto_size>-col_index + ip_row = count ) = abap_false. * Start of change # issue 139 - Dateretention of cellstyles * IF cell_style IS BOUND. * CREATE OBJECT cell_style. @@ -3195,11 +3199,12 @@ ENDMETHOD. * width = cell_style->font->calculate_text_width( cell_value ). * ENDIF. * width = calculate_cell_width( ip_column = col_alpha " issue #155 - less restrictive typing for ip_column - width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column - ip_row = count ). + width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column + ip_row = count ). * End of change # issue 139 - Dateretention of cellstyles - IF width > <auto_size>-width. - <auto_size>-width = width. + IF width > <auto_size>-width. + <auto_size>-width = width. + ENDIF. ENDIF. count = count + 1. ENDWHILE.