mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 08:06:15 +08:00
* Fix #722 worksheet dimension (last empty rows) * Fix #722 reduce DIFF quantity (indentations) Co-authored-by: Jane Doe <Jane.Doe@World.com> Co-authored-by: Abo <andrea@borgia.bo.it>
This commit is contained in:
parent
0a3beaf7f8
commit
e029864bbb
|
@ -2410,15 +2410,11 @@ METHOD load_worksheet.
|
|||
lv_max_col = lv_index.
|
||||
ENDIF.
|
||||
lv_cell_row = ls_row-r.
|
||||
IF ls_row-customheight = '1'
|
||||
OR ls_row-collapsed = lc_xml_attr_true
|
||||
OR ls_row-collapsed = lc_xml_attr_true_int
|
||||
OR ls_row-hidden = lc_xml_attr_true
|
||||
OR ls_row-hidden = lc_xml_attr_true_int
|
||||
OR ls_row-outlinelevel > '0'.
|
||||
lo_row = io_worksheet->get_row( lv_cell_row ).
|
||||
IF ls_row-customheight = '1'.
|
||||
lo_row->set_row_height( ls_row-ht ).
|
||||
lo_row->set_row_height( ip_row_height = ls_row-ht ip_custom_height = abap_true ).
|
||||
ELSE.
|
||||
lo_row->set_row_height( ip_row_height = ls_row-ht ip_custom_height = abap_false ).
|
||||
ENDIF.
|
||||
|
||||
IF ls_row-collapsed = lc_xml_attr_true
|
||||
|
@ -2439,7 +2435,6 @@ METHOD load_worksheet.
|
|||
lo_row->set_outline_level( lv_outline_level ).
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
lo_ixml_cells = lo_ixml_row_elem->get_elements_by_tag_name( name = 'c' ).
|
||||
lo_ixml_iterator2 = lo_ixml_cells->create_iterator( ).
|
||||
|
|
|
@ -24,6 +24,9 @@ public section.
|
|||
methods GET_ROW_HEIGHT
|
||||
returning
|
||||
value(R_ROW_HEIGHT) type FLOAT .
|
||||
methods GET_CUSTOM_HEIGHT
|
||||
returning
|
||||
value(R_CUSTOM_HEIGHT) type ABAP_BOOL .
|
||||
methods GET_ROW_INDEX
|
||||
returning
|
||||
value(R_ROW_INDEX) type INT4 .
|
||||
|
@ -46,6 +49,7 @@ public section.
|
|||
methods SET_ROW_HEIGHT
|
||||
importing
|
||||
!IP_ROW_HEIGHT type SIMPLE
|
||||
!IP_CUSTOM_HEIGHT type abap_bool default abap_true
|
||||
raising
|
||||
ZCX_EXCEL .
|
||||
methods SET_ROW_INDEX
|
||||
|
@ -70,6 +74,7 @@ private section.
|
|||
data OUTLINE_LEVEL type INT4 value 0. "#EC NOTEXT . . . . . . . . . " .
|
||||
data COLLAPSED type abap_bool .
|
||||
data XF_INDEX type INT4 .
|
||||
data CUSTOM_HEIGHT type abap_bool .
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -87,6 +92,7 @@ method CONSTRUCTOR.
|
|||
|
||||
" set row dimension as unformatted by default
|
||||
me->xf_index = 0.
|
||||
me->custom_height = abap_false.
|
||||
endmethod.
|
||||
|
||||
|
||||
|
@ -150,6 +156,11 @@ method GET_ROW_HEIGHT.
|
|||
endmethod.
|
||||
|
||||
|
||||
METHOD GET_CUSTOM_HEIGHT.
|
||||
r_custom_height = me->custom_height.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
method GET_ROW_INDEX.
|
||||
r_row_index = me->row_index.
|
||||
endmethod.
|
||||
|
@ -203,6 +214,7 @@ method SET_ROW_HEIGHT.
|
|||
CATCH cx_sy_conversion_no_number.
|
||||
zcx_excel=>raise_text( 'Unable to interpret ip_row_height as number' ).
|
||||
ENDTRY.
|
||||
me->custom_height = ip_custom_height.
|
||||
endmethod.
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ class ZCL_EXCEL_ROWS definition
|
|||
methods SIZE
|
||||
returning
|
||||
value(EP_SIZE) type I .
|
||||
methods GET_MIN_INDEX
|
||||
returning
|
||||
value(EP_INDEX) type I .
|
||||
methods GET_MAX_INDEX
|
||||
returning
|
||||
value(EP_INDEX) type I .
|
||||
protected section.
|
||||
*"* private components of class ZABAP_EXCEL_RANGES
|
||||
*"* do not include other source files here!!!
|
||||
|
@ -111,4 +117,25 @@ CLASS ZCL_EXCEL_ROWS IMPLEMENTATION.
|
|||
method SIZE.
|
||||
EP_SIZE = ROWS->SIZE( ).
|
||||
endmethod. "SIZE
|
||||
|
||||
METHOD get_min_index.
|
||||
FIELD-SYMBOLS: <ls_hashed_row> TYPE mty_s_hashed_row.
|
||||
|
||||
LOOP AT rows_hasehd ASSIGNING <ls_hashed_row>.
|
||||
IF ep_index = 0 OR <ls_hashed_row>-row_index < ep_index.
|
||||
ep_index = <ls_hashed_row>-row_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_max_index.
|
||||
FIELD-SYMBOLS: <ls_hashed_row> TYPE mty_s_hashed_row.
|
||||
|
||||
LOOP AT rows_hasehd ASSIGNING <ls_hashed_row>.
|
||||
IF <ls_hashed_row>-row_index > ep_index.
|
||||
ep_index = <ls_hashed_row>-row_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -5562,10 +5562,16 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
|
||||
CHECK sheet_content IS NOT INITIAL.
|
||||
|
||||
upper_cell-cell_row = zcl_excel_common=>c_excel_sheet_max_row.
|
||||
upper_cell-cell_row = rows->get_min_index( ).
|
||||
IF upper_cell-cell_row = 0.
|
||||
upper_cell-cell_row = zcl_excel_common=>c_excel_sheet_max_row.
|
||||
ENDIF.
|
||||
upper_cell-cell_column = zcl_excel_common=>c_excel_sheet_max_col.
|
||||
|
||||
lower_cell-cell_row = zcl_excel_common=>c_excel_sheet_min_row.
|
||||
lower_cell-cell_row = rows->get_max_index( ).
|
||||
IF lower_cell-cell_row = 0.
|
||||
lower_cell-cell_row = zcl_excel_common=>c_excel_sheet_min_row.
|
||||
ENDIF.
|
||||
lower_cell-cell_column = zcl_excel_common=>c_excel_sheet_min_col.
|
||||
|
||||
LOOP AT sheet_content INTO ls_sheet_content.
|
||||
|
|
|
@ -5846,15 +5846,11 @@ METHOD create_xl_sheet_sheet_data.
|
|||
lo_element_2->set_attribute_ns( name = lc_xml_attr_spans
|
||||
value = lv_value ).
|
||||
lo_row = io_worksheet->get_row( <ls_sheet_content>-cell_row ).
|
||||
" Do we need the row dimension attributes?
|
||||
IF lo_row->get_row_height( ) >= 0 OR
|
||||
lo_row->get_collapsed( io_worksheet ) = abap_true OR
|
||||
lo_row->get_outline_level( io_worksheet ) > 0 OR
|
||||
lo_row->get_xf_index( ) <> 0 OR
|
||||
l_autofilter_hidden = abap_true.
|
||||
" Row dimensions
|
||||
IF lo_row->get_row_height( ) >= 0.
|
||||
" Row dimensions
|
||||
IF lo_row->get_custom_height( ) = abap_true.
|
||||
lo_element_2->set_attribute_ns( name = 'customHeight' value = '1' ).
|
||||
ENDIF.
|
||||
IF lo_row->get_row_height( ) >= 0.
|
||||
lv_value = lo_row->get_row_height( ).
|
||||
lo_element_2->set_attribute_ns( name = 'ht' value = lv_value ).
|
||||
ENDIF.
|
||||
|
@ -5875,7 +5871,6 @@ METHOD create_xl_sheet_sheet_data.
|
|||
lo_element_2->set_attribute_ns( name = 's' value = lv_value ).
|
||||
lo_element_2->set_attribute_ns( name = 'customFormat' value = '1' ).
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
IF lt_values IS INITIAL. " no values attached to autofilter " issue #368 autofilter filtering too much
|
||||
CLEAR l_autofilter_hidden.
|
||||
ELSE.
|
||||
|
|
Loading…
Reference in New Issue
Block a user