Bugfix range conversion (#628)

When reading xlsx and autofilters are being applied a dump occured when autofilter range was defined like "Sheet1!#REF1"
Such ranges are now ignored so that the xlsx can be read.
This commit is contained in:
Dennis Schaaf 2019-09-24 22:35:12 +02:00 committed by Gregor Wolf
parent 1da0be9fb9
commit 84aa650b8e
2 changed files with 21 additions and 10 deletions

View File

@ -553,7 +553,12 @@ method CONVERT_RANGE2COLUMN_A_ROW.
ELSEIF i_range CS '!'. " c) sheetname existing - does not start with ' ELSEIF i_range CS '!'. " c) sheetname existing - does not start with '
SPLIT i_range AT '!' INTO lv_sheet lv_range. SPLIT i_range AT '!' INTO lv_sheet lv_range.
" begin Dennis Schaaf
IF lv_range CP '*#REF*'.
lv_errormessage = 'Invalid range'(001).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
" end Dennis Schaaf
ELSE. " d) no sheetname - just area ELSE. " d) no sheetname - just area
lv_range = i_range. lv_range = i_range.
ENDIF. ENDIF.

View File

@ -2005,15 +2005,21 @@ method LOAD_WORKBOOK.
* insert autofilters * insert autofilters
*--------------------------------------------------------------------* *--------------------------------------------------------------------*
WHEN zcl_excel_autofilters=>c_autofilter. WHEN zcl_excel_autofilters=>c_autofilter.
lo_autofilter = io_excel->add_new_autofilter( io_sheet = <worksheet>-worksheet ) . " begin Dennis Schaaf
zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value TRY.
IMPORTING e_column_start = lv_col_start_alpha zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value
e_column_end = lv_col_end_alpha IMPORTING e_column_start = lv_col_start_alpha
e_row_start = ls_area-row_start e_column_end = lv_col_end_alpha
e_row_end = ls_area-row_end ). e_row_start = ls_area-row_start
ls_area-col_start = zcl_excel_common=>convert_column2int( lv_col_start_alpha ). e_row_end = ls_area-row_end ).
ls_area-col_end = zcl_excel_common=>convert_column2int( lv_col_end_alpha ). ls_area-col_start = zcl_excel_common=>convert_column2int( lv_col_start_alpha ).
lo_autofilter->set_filter_area( is_area = ls_area ). ls_area-col_end = zcl_excel_common=>convert_column2int( lv_col_end_alpha ).
lo_autofilter = io_excel->add_new_autofilter( io_sheet = <worksheet>-worksheet ) .
lo_autofilter->set_filter_area( is_area = ls_area ).
CATCH zcx_excel.
" we expected a range but it was not usable, so just ignore it
ENDTRY.
" end Dennis Schaaf
*--------------------------------------------------------------------* *--------------------------------------------------------------------*
* repeat print rows/columns * repeat print rows/columns