From d999f095fa5d5249840de9fe2254d7991bc6a950 Mon Sep 17 00:00:00 2001 From: Gregor Wolf Date: Sat, 6 Nov 2010 09:39:43 +0000 Subject: [PATCH] Added CALCULATE_COLUMN_WIDTHS to ZCL_EXCEL_WORKSHEET with a simple calculation of the width for auto sized columns. Modified CREATE_XL_SHEET of ZCL_EXCEL_WRITER_2007 to call CALCULATE_COLUMN_WIDTHS before columns are defined. Adjusted Demo programs ZDEMO_EXCEL11 and ZDEMO_EXCEL12 to show the auto size column functionality. git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@40 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049 --- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 328 ++++++++++++++++----------- ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk | 135 +++++------ ZA2X/PROG/ZDEMO_EXCEL11.slnk | 138 ++++++----- ZA2X/PROG/ZDEMO_EXCEL12.slnk | 13 +- 4 files changed, 358 insertions(+), 256 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index d9693d1..55d1d43 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -1,6 +1,6 @@ - - - + + + class ZCL_EXCEL_WORKSHEET definition public final @@ -116,6 +116,9 @@ public section. methods GET_ROW_DIMENSIONS returning value(R_ROW_DIMENSION) type ZEXCEL_T_WORKSHEET_ROWDIMENSIO . + methods GET_HYPERLINKS_SIZE + returning + value(EP_SIZE) type I . methods GET_TABLES_ITERATOR returning value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . @@ -130,6 +133,9 @@ public section. !IP_FORMULA type ZEXCEL_CELL_FORMULA optional !IP_STYLE type ZEXCEL_CELL_STYLE optional !IP_HYPERLINK type ref to ZCL_EXCEL_HYPERLINK optional . + methods GET_HYPERLINKS_ITERATOR + returning + value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . methods SET_CELL_STYLE importing !IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA @@ -150,12 +156,7 @@ public section. !IP_TABLE_TITLE type STRING !IP_TOP_LEFT_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA default 'B' !IP_TOP_LEFT_ROW type ZEXCEL_CELL_ROW default 3 . - methods GET_HYPERLINKS_SIZE - returning - value(EP_SIZE) type I . - methods GET_HYPERLINKS_ITERATOR - returning - value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . + methods CALCULATE_COLUMN_WIDTHS . *"* protected components of class ZCL_EXCEL_WORKSHEET *"* do not include other source files here!!! protected section. @@ -189,37 +190,38 @@ 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 + ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - METHOD zif_excel_sheet_protection~initialize. + method ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE. me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected. CLEAR me->zif_excel_sheet_protection~password. @@ -242,34 +244,34 @@ private section. me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive. -ENDMETHOD. +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_TABLE. DATA: @@ -392,9 +394,71 @@ endmethod. endmethod. - - - + + METHOD calculate_column_widths. + TYPES: + BEGIN OF t_auto_size, + col_index TYPE int4, + width TYPE float, + END OF t_auto_size. + TYPES: tt_auto_size TYPE TABLE OF t_auto_size. + + DATA: column_dimensions TYPE zexcel_t_worksheet_columndime. + DATA: column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + + DATA: auto_size TYPE flag. + DATA: auto_sizes TYPE tt_auto_size. + DATA: col_alpha TYPE zexcel_cell_column_alpha. + DATA: cell_value TYPE zexcel_cell_value. + DATA: count TYPE int4. + DATA: highest_row TYPE int4. + DATA: width TYPE i. + + FIELD-SYMBOLS: <column_dimension> LIKE LINE OF column_dimensions. + FIELD-SYMBOLS: <auto_size> LIKE LINE OF auto_sizes. + + column_dimensions[] = me->get_column_dimensions( ). + LOOP AT column_dimensions ASSIGNING <column_dimension>. + auto_size = <column_dimension>-column_dimension->get_auto_size( ). + IF auto_size = abap_true. + APPEND INITIAL LINE TO auto_sizes ASSIGNING <auto_size>. + <auto_size>-col_index = <column_dimension>-column_dimension->get_column_index( ). + <auto_size>-width = -1. + ENDIF. + ENDLOOP. + + " There is only something to do if there are some auto-size columns + IF NOT auto_sizes IS INITIAL. + highest_row = me->get_highest_row( ). + LOOP AT auto_sizes ASSIGNING <auto_size>. + col_alpha = zcl_excel_common=>convert_column2alpha( <auto_size>-col_index ). + count = 1. + WHILE count <= highest_row. + me->get_cell( + EXPORTING + ip_column = col_alpha " Cell Column + ip_row = count " Cell Row + IMPORTING + ep_value = cell_value " Cell Value + ). + " For an easy start we just take the number of characters as the width + " TODO: Calculate width using Font Size and Font Type + width = STRLEN( cell_value ). + IF width > <auto_size>-width. + <auto_size>-width = width. + ENDIF. + count = count + 1. + ENDWHILE. + column_dimension = me->get_column_dimension( col_alpha ). + column_dimension->set_width( <auto_size>-width ). + ENDLOOP. + ENDIF. + +ENDMETHOD. + + + + method CONSTRUCTOR. me->excel = ip_excel. @@ -430,7 +494,7 @@ endmethod. upper_cell-cell_column = 1. endmethod. - + method DELETE_MERGE. DELETE sheet_content_merge INDEX 1. @@ -438,10 +502,10 @@ endmethod. endmethod. - - - - + + + + method FREEZE_PANES. data: lv_xsplit type i, lv_ysplit type i. @@ -468,8 +532,8 @@ endmethod. freeze_pane_cell_row = ip_num_rows + 1. endmethod. - - + + method GET_ACTIVE_CELL. DATA: lv_active_column TYPE zexcel_cell_column_alpha, @@ -483,11 +547,11 @@ endmethod. endmethod. - - - - - + + + + + method GET_CELL. DATA: lv_column TYPE zexcel_cell_column, @@ -504,9 +568,9 @@ endmethod. ep_value = ls_sheet_content-cell_value. endmethod. - - - + + + method GET_COLUMN_DIMENSION. FIELD-SYMBOLS: <fs_column_dimension> LIKE LINE OF column_dimensions. @@ -526,46 +590,46 @@ 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_ROW_DIMENSION. r_row_dimension = me->default_row_dimension. endmethod. - - + + method GET_DIMENSION_RANGE. me->update_dimension_range( ). @@ -577,62 +641,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, @@ -703,9 +767,9 @@ endmethod. endmethod. - - - + + + method GET_ROW_DIMENSION. FIELD-SYMBOLS: <fs_row_dimension> LIKE LINE OF row_dimensions. @@ -725,31 +789,31 @@ 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 SET_CELL. DATA: lv_column TYPE zexcel_cell_column, @@ -842,11 +906,11 @@ endmethod. endmethod. - - - - - + + + + + method SET_CELL_STYLE. DATA: lv_column TYPE zexcel_cell_column, @@ -874,10 +938,10 @@ endmethod. endmethod. - - - - + + + + method SET_MERGE. DATA: lv_column_start TYPE zexcel_cell_column, @@ -908,13 +972,13 @@ endmethod. endmethod. - - - - - - - + + + + + + + method SET_TABLE. DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr, @@ -971,7 +1035,7 @@ endmethod. 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 0b6b983..cb3c0b7 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 final @@ -113,32 +113,32 @@ 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. @@ -308,8 +308,8 @@ endmethod. endmethod. - - + + method CREATE_CONTENT_TYPES. @@ -562,8 +562,8 @@ endmethod. endmethod. - - + + method CREATE_DOCPROPS_APP. @@ -783,8 +783,8 @@ endmethod. endmethod. - - + + method CREATE_DOCPROPS_CORE. @@ -899,8 +899,8 @@ endmethod. endmethod. - - + + method CREATE_RELATIONSHIPS. @@ -998,9 +998,9 @@ endmethod. endmethod. - - - + + + method CREATE_XL_DRAWINGS. @@ -1228,9 +1228,9 @@ endmethod. endmethod. - - - + + + method CREATE_XL_DRAWINGS_RELS. ** Constant node name @@ -1314,8 +1314,8 @@ endmethod. endmethod. - - + + method CREATE_XL_RELATIONSHIPS. @@ -1462,8 +1462,8 @@ endmethod. endmethod. - - + + method CREATE_XL_SHAREDSTRINGS. @@ -1579,11 +1579,11 @@ endmethod. endmethod. - - - - - method CREATE_XL_SHEET. + + + + + METHOD create_xl_sheet. ** Constant node name DATA: lc_xml_node_worksheet TYPE string VALUE 'worksheet', @@ -1894,6 +1894,11 @@ endmethod. column_dimensions[] = io_worksheet->get_column_dimensions( ). + " Calculate col + IF NOT column_dimensions IS INITIAL. + io_worksheet->calculate_column_widths( ). + column_dimensions[] = io_worksheet->get_column_dimensions( ). + ENDIF. row_dimensions[] = io_worksheet->get_row_dimensions( ). " sheetFormatPr node lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetformatpr @@ -2625,12 +2630,12 @@ endmethod. lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). lo_renderer->render( ). -endmethod. +ENDMETHOD. - - - - + + + + method CREATE_XL_SHEET_RELS. @@ -2772,8 +2777,8 @@ endmethod. endmethod. - - + + method CREATE_XL_STYLES. @@ -3546,9 +3551,9 @@ endmethod. endmethod. - - - + + + method CREATE_XL_TABLE. DATA: lc_xml_node_table TYPE string VALUE 'table', @@ -3717,8 +3722,8 @@ endmethod. endmethod. - - + + method CREATE_XL_THEME. @@ -3806,8 +3811,8 @@ endmethod. endmethod. - - + + method CREATE_XL_WORKBOOK. @@ -4029,9 +4034,9 @@ endmethod. endmethod. - - - + + + method FLAG2BOOL. @@ -4042,9 +4047,9 @@ endmethod. ENDIF. endmethod. - - - + + + method GET_SHARED_STRING_INDEX. diff --git a/ZA2X/PROG/ZDEMO_EXCEL11.slnk b/ZA2X/PROG/ZDEMO_EXCEL11.slnk index 065f4d1..4357ef0 100644 --- a/ZA2X/PROG/ZDEMO_EXCEL11.slnk +++ b/ZA2X/PROG/ZDEMO_EXCEL11.slnk @@ -1,16 +1,17 @@ - - + + - + + - + *&---------------------------------------------------------------------* @@ -45,6 +46,16 @@ FIELD-SYMBOLS: <relationship_address> LIKE LINE OF relationship_addresses. DATA: lt_download TYPE TABLE OF zexcel_s_org_rel. FIELD-SYMBOLS: <download> LIKE LINE OF lt_download. +DATA: lv_file_name TYPE string, + lv_file_path TYPE string, + lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE '11_Export_Org_and_Contact.xlsx'. + +PARAMETERS: p_path TYPE string. + PARAMETERS: md TYPE flag RADIOBUTTON GROUP act. SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE a. @@ -61,11 +72,24 @@ PARAMETERS: reltyp TYPE bu_reltyp DEFAULT 'BUR011', partner TYPE bu_partner DEFAULT '191'. SELECTION-SCREEN END OF BLOCK b. +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = p_path + CHANGING selected_folder = p_path ). + INITIALIZATION. a = 'Select by master data'. b = 'Select by relationship'. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + p_path = lv_workdir. 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 p_path. + IF md = abap_true. " Read all Companies by Master Data central_search-partnercategory = partnerc. @@ -221,7 +245,7 @@ START-OF-SELECTION. DATA: lv_file TYPE xstring, lv_bytecount TYPE i, - lt_file_tab TYPE STANDARD TABLE OF solisti1. + lt_file_tab TYPE solix_tab. DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog, ls_table_settings TYPE zexcel_s_table_settings. @@ -399,60 +423,64 @@ START-OF-SELECTION. row_dimension = lo_worksheet->get_row_dimension( 1 ). row_dimension->set_visible( abap_false ). - " Set Column width - column_dimension = lo_worksheet->get_column_dimension( 'A' ). - column_dimension->set_width( ip_width = 11 ). - column_dimension = lo_worksheet->get_column_dimension( 'B' ). - column_dimension->set_width( ip_width = 11 ). - column_dimension = lo_worksheet->get_column_dimension( 'C' ). - column_dimension->set_width( ip_width = 35 ). - column_dimension = lo_worksheet->get_column_dimension( 'E' ). - column_dimension->set_width( ip_width = 18 ). - column_dimension = lo_worksheet->get_column_dimension( 'F' ). - column_dimension->set_width( ip_width = 5 ). - column_dimension = lo_worksheet->get_column_dimension( 'G' ). - column_dimension->set_width( ip_width = 6 ). - column_dimension = lo_worksheet->get_column_dimension( 'H' ). - column_dimension->set_width( ip_width = 12 ). - column_dimension = lo_worksheet->get_column_dimension( 'I' ). - column_dimension->set_width( ip_width = 3 ). - column_dimension = lo_worksheet->get_column_dimension( 'J' ). - column_dimension->set_width( ip_width = 13 ). - column_dimension = lo_worksheet->get_column_dimension( 'K' ). - column_dimension->set_width( ip_width = 13 ). - column_dimension = lo_worksheet->get_column_dimension( 'L' ). - column_dimension->set_width( ip_width = 13 ). - column_dimension = lo_worksheet->get_column_dimension( 'M' ). - column_dimension->set_width( ip_width = 13 ). - column_dimension = lo_worksheet->get_column_dimension( 'N' ). - column_dimension->set_width( ip_width = 12 ). - column_dimension = lo_worksheet->get_column_dimension( 'O' ). - column_dimension->set_width( ip_width = 9 ). - column_dimension = lo_worksheet->get_column_dimension( 'P' ). - column_dimension->set_width( ip_width = 12 ). - column_dimension = lo_worksheet->get_column_dimension( 'Q' ). - column_dimension->set_width( ip_width = 9 ). - column_dimension = lo_worksheet->get_column_dimension( 'R' ). - column_dimension->set_width( ip_width = 40 ). + DATA: highest_column TYPE zexcel_cell_column, + count TYPE int4, + col_alpha TYPE zexcel_cell_column_alpha. + + highest_column = lo_worksheet->get_highest_column( ). + count = 1. + WHILE count <= highest_column. + col_alpha = zcl_excel_common=>convert_column2alpha( count ). + column_dimension = lo_worksheet->get_column_dimension( col_alpha ). + column_dimension->set_auto_size( abap_true ). + count = count + 1. + ENDWHILE. +* " Set Column width manuall +* column_dimension = lo_worksheet->get_column_dimension( 'A' ). +* column_dimension->set_width( ip_width = 11 ). +* column_dimension = lo_worksheet->get_column_dimension( 'B' ). +* column_dimension->set_width( ip_width = 11 ). +* column_dimension = lo_worksheet->get_column_dimension( 'C' ). +* column_dimension->set_width( ip_width = 35 ). +* column_dimension = lo_worksheet->get_column_dimension( 'E' ). +* column_dimension->set_width( ip_width = 18 ). +* column_dimension = lo_worksheet->get_column_dimension( 'F' ). +* column_dimension->set_width( ip_width = 5 ). +* column_dimension = lo_worksheet->get_column_dimension( 'G' ). +* column_dimension->set_width( ip_width = 6 ). +* column_dimension = lo_worksheet->get_column_dimension( 'H' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( 'I' ). +* column_dimension->set_width( ip_width = 3 ). +* column_dimension = lo_worksheet->get_column_dimension( 'J' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( 'K' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( 'L' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( 'M' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( 'N' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( 'O' ). +* column_dimension->set_width( ip_width = 9 ). +* column_dimension = lo_worksheet->get_column_dimension( 'P' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( 'Q' ). +* column_dimension->set_width( ip_width = 9 ). +* column_dimension = lo_worksheet->get_column_dimension( 'R' ). +* column_dimension->set_width( ip_width = 40 ). 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. +* Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = XSTRLEN( lv_file ). " Save the file - CALL FUNCTION 'GUI_DOWNLOAD' - EXPORTING - bin_filesize = lv_bytecount - filename = 'C:\ZDEMO_EXCEL11.xlsx' - filetype = 'BIN' - TABLES - data_tab = lt_file_tab. + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = p_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/ZA2X/PROG/ZDEMO_EXCEL12.slnk b/ZA2X/PROG/ZDEMO_EXCEL12.slnk index a62faed..519a13c 100644 --- a/ZA2X/PROG/ZDEMO_EXCEL12.slnk +++ b/ZA2X/PROG/ZDEMO_EXCEL12.slnk @@ -1,5 +1,5 @@ - - + + @@ -65,6 +65,7 @@ lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = &apos lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'Outline column level 0' ). lo_worksheet->set_cell( ip_column = 'G' ip_row = 2 ip_value = 'Outline column level 1' ). lo_worksheet->set_cell( ip_column = 'H' ip_row = 2 ip_value = 'Outline column level 2' ). +lo_worksheet->set_cell( ip_column = 'I' ip_row = 2 ip_value = 'Small' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Hello world (hidden row)' ). @@ -74,10 +75,14 @@ lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = &apos lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Outline row level 2' ). " Column Settings +" Auto size column_dimension = lo_worksheet->get_column_dimension( 'B' ). -column_dimension->set_auto_size( ip_auto_size = abap_true ). +column_dimension->set_auto_size( abap_true ). +column_dimension = lo_worksheet->get_column_dimension( 'I' ). +column_dimension->set_auto_size( abap_true ). +" Manual Width column_dimension = lo_worksheet->get_column_dimension( 'C' ). -column_dimension->set_width( ip_width = 50 ). +column_dimension->set_width( 50 ). column_dimension = lo_worksheet->get_column_dimension( 'D' ). column_dimension->set_visible( ip_visible = abap_false ). " Implementation in the Writer is not working yet ===== TODO =====