diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index 2947410..eb2398f 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -1115,7 +1115,7 @@ endmethod. - method LOAD_WORKBOOK. + METHOD load_workbook. CONSTANTS: lc_shared_strings TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', lc_worksheet TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', @@ -1142,6 +1142,15 @@ endmethod. range TYPE t_range, range_value TYPE zexcel_range_value. +*--------------------------------------------------------------------* +* #229: Set active worksheet - begin data declarations +*--------------------------------------------------------------------* + DATA: lv_active_sheet_string TYPE string, + lv_zexcel_active_worksheet TYPE zexcel_active_worksheet. +*--------------------------------------------------------------------* +* #229: Set active worksheet - end data declarations +*--------------------------------------------------------------------* + FIELD-SYMBOLS: <worksheet> TYPE t_relationship. @@ -1216,6 +1225,7 @@ endmethod. ADD 1 TO workbook_index. ENDWHILE. + "Can I reuse the workbook variable? "workbook = me->get_ixml_from_zip_archive( ip_path ). node ?= workbook->find_from_name( 'definedName' ). @@ -1236,7 +1246,24 @@ endmethod. node ?= node->get_next( ). ENDWHILE. -endmethod. +*--------------------------------------------------------------------* +* #229: Set active worksheet - begin coding +*--------------------------------------------------------------------* + lv_zexcel_active_worksheet = 1. " First sheet = active sheet if nothing else specified. + node ?= workbook->find_from_name( 'workbookView' ). + IF node IS BOUND. + lv_active_sheet_string = node->get_attribute( 'activeTab' ). + TRY. + lv_zexcel_active_worksheet = lv_active_sheet_string + 1. " EXCEL numbers the sheets from 0 onwards --> index into worksheettable needs to be one more + CATCH cx_sy_conversion_error. + ENDTRY. + ENDIF. + ip_excel->set_active_sheet_index( lv_zexcel_active_worksheet ). +*--------------------------------------------------------------------* +* #229: Set active worksheet - end coding +*--------------------------------------------------------------------* + +ENDMETHOD.