mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 19:26:10 +08:00
Merge branch 'main' into hvam/font2907
This commit is contained in:
commit
fb88304150
|
@ -9,12 +9,21 @@ CLASS zcl_excel_comment DEFINITION
|
||||||
CONSTANTS default_bottom_row TYPE i VALUE 15. "#EC NOTEXT
|
CONSTANTS default_bottom_row TYPE i VALUE 15. "#EC NOTEXT
|
||||||
|
|
||||||
METHODS constructor .
|
METHODS constructor .
|
||||||
|
METHODS get_bottom_offset
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
METHODS get_bottom_row
|
METHODS get_bottom_row
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rp_result) TYPE i .
|
VALUE(rp_result) TYPE i .
|
||||||
METHODS get_index
|
METHODS get_index
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rp_index) TYPE string .
|
VALUE(rp_index) TYPE string .
|
||||||
|
METHODS get_left_column
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
|
METHODS get_left_offset
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
METHODS get_name
|
METHODS get_name
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(r_name) TYPE string .
|
VALUE(r_name) TYPE string .
|
||||||
|
@ -24,24 +33,45 @@ CLASS zcl_excel_comment DEFINITION
|
||||||
METHODS get_right_column
|
METHODS get_right_column
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rp_result) TYPE i .
|
VALUE(rp_result) TYPE i .
|
||||||
|
METHODS get_right_offset
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
METHODS get_text
|
METHODS get_text
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rp_text) TYPE string .
|
VALUE(rp_text) TYPE string .
|
||||||
|
METHODS get_top_offset
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
|
METHODS get_top_row
|
||||||
|
RETURNING
|
||||||
|
VALUE(rp_result) TYPE i .
|
||||||
METHODS set_text
|
METHODS set_text
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!ip_text TYPE string
|
!ip_text TYPE string
|
||||||
!ip_ref TYPE string OPTIONAL
|
!ip_ref TYPE string OPTIONAL
|
||||||
!ip_right_column TYPE i OPTIONAL
|
!ip_left_column TYPE i DEFAULT 2
|
||||||
!ip_bottom_row TYPE i OPTIONAL .
|
!ip_left_offset TYPE i DEFAULT 15
|
||||||
|
!ip_top_row TYPE i DEFAULT 11
|
||||||
|
!ip_top_offset TYPE i DEFAULT 10
|
||||||
|
!ip_right_column TYPE i DEFAULT default_right_column
|
||||||
|
!ip_right_offset TYPE i DEFAULT 31
|
||||||
|
!ip_bottom_row TYPE i DEFAULT default_bottom_row
|
||||||
|
!ip_bottom_offset TYPE i DEFAULT 9.
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA bottom_offset TYPE i .
|
||||||
DATA bottom_row TYPE i .
|
DATA bottom_row TYPE i .
|
||||||
DATA index TYPE string .
|
DATA index TYPE string .
|
||||||
DATA ref TYPE string .
|
DATA ref TYPE string .
|
||||||
|
DATA left_column TYPE i .
|
||||||
|
DATA left_offset TYPE i .
|
||||||
DATA right_column TYPE i .
|
DATA right_column TYPE i .
|
||||||
|
DATA right_offset TYPE i .
|
||||||
DATA text TYPE string .
|
DATA text TYPE string .
|
||||||
|
DATA top_offset TYPE i .
|
||||||
|
DATA top_row TYPE i .
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +84,11 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_bottom_offset.
|
||||||
|
rp_result = bottom_offset.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_bottom_row.
|
METHOD get_bottom_row.
|
||||||
rp_result = bottom_row.
|
rp_result = bottom_row.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -64,6 +99,16 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_left_column.
|
||||||
|
rp_result = left_column.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_left_offset.
|
||||||
|
rp_result = left_offset.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_name.
|
METHOD get_name.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -79,11 +124,26 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_right_offset.
|
||||||
|
rp_result = right_offset.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_text.
|
METHOD get_text.
|
||||||
rp_text = me->text.
|
rp_text = me->text.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_top_offset.
|
||||||
|
rp_result = top_offset.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_top_row.
|
||||||
|
rp_result = top_row.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD set_text.
|
METHOD set_text.
|
||||||
me->text = ip_text.
|
me->text = ip_text.
|
||||||
|
|
||||||
|
@ -91,17 +151,25 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
me->ref = ip_ref.
|
me->ref = ip_ref.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
me->left_column = ip_left_column.
|
||||||
|
me->left_offset = ip_left_offset.
|
||||||
|
|
||||||
|
me->top_row = ip_top_row.
|
||||||
|
me->top_offset = ip_top_offset.
|
||||||
|
|
||||||
IF ip_right_column IS NOT INITIAL.
|
IF ip_right_column IS NOT INITIAL.
|
||||||
me->right_column = ip_right_column.
|
me->right_column = ip_right_column.
|
||||||
ELSE.
|
ELSE.
|
||||||
me->right_column = default_right_column.
|
me->right_column = default_right_column.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
me->right_offset = ip_right_offset.
|
||||||
|
|
||||||
IF ip_bottom_row IS NOT INITIAL.
|
IF ip_bottom_row IS NOT INITIAL.
|
||||||
me->bottom_row = ip_bottom_row.
|
me->bottom_row = ip_bottom_row.
|
||||||
ELSE.
|
ELSE.
|
||||||
me->bottom_row = default_bottom_row.
|
me->bottom_row = default_bottom_row.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
me->bottom_offset = ip_bottom_offset.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
|
@ -2190,6 +2190,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
|
lo_range = <worksheet>-worksheet->add_new_range( ).
|
||||||
|
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
@ -2558,6 +2559,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
lv_max_col = lv_index.
|
lv_max_col = lv_index.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
lv_cell_row = ls_row-r.
|
lv_cell_row = ls_row-r.
|
||||||
|
lv_cell_column = ''.
|
||||||
lo_row = io_worksheet->get_row( lv_cell_row ).
|
lo_row = io_worksheet->get_row( lv_cell_row ).
|
||||||
IF ls_row-customheight = '1'.
|
IF ls_row-customheight = '1'.
|
||||||
lo_row->set_row_height( ip_row_height = ls_row-ht ip_custom_height = abap_true ).
|
lo_row->set_row_height( ip_row_height = ls_row-ht ip_custom_height = abap_true ).
|
||||||
|
@ -2594,6 +2596,26 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_cell_elem CHANGING cp_structure = ls_cell ).
|
fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_cell_elem CHANGING cp_structure = ls_cell ).
|
||||||
|
|
||||||
|
" Determine the column number
|
||||||
|
IF ls_cell-r IS NOT INITIAL.
|
||||||
|
" Note that the row should remain unchanged = the one defined by <row>
|
||||||
|
" i.e. in <row r="1"...><c r="A1" s="2"><v>..., ls_cell-r would be "A1",
|
||||||
|
" the "1" of A1 should always be equal to the "1" of <row r="1"...
|
||||||
|
zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING
|
||||||
|
i_columnrow = ls_cell-r
|
||||||
|
IMPORTING
|
||||||
|
e_column = lv_cell_column
|
||||||
|
e_row = lv_cell_row ).
|
||||||
|
ELSE.
|
||||||
|
" The column is the column after the last cell previously initialized in the same row.
|
||||||
|
" NB: the row is unchanged = the one defined by <row> e.g. "1" in <row r="1"...><c r="" s="2"><v>...
|
||||||
|
IF lv_cell_column IS INITIAL.
|
||||||
|
lv_cell_column = 'A'.
|
||||||
|
ELSE.
|
||||||
|
lv_cell_column = zcl_excel_common=>convert_column2alpha( zcl_excel_common=>convert_column2int( lv_cell_column ) + 1 ).
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name_ns( name = 'v' uri = namespace-main ).
|
lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name_ns( name = 'v' uri = namespace-main ).
|
||||||
|
|
||||||
CASE ls_cell-t.
|
CASE ls_cell-t.
|
||||||
|
@ -2642,11 +2664,6 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_formula_elem CHANGING cp_structure = ls_formula_attributes ).
|
fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_formula_elem CHANGING cp_structure = ls_formula_attributes ).
|
||||||
IF ls_formula_attributes-t = 'shared'.
|
IF ls_formula_attributes-t = 'shared'.
|
||||||
zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING
|
|
||||||
i_columnrow = ls_cell-r
|
|
||||||
IMPORTING
|
|
||||||
e_column = lv_cell_column
|
|
||||||
e_row = lv_cell_row ).
|
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
CLEAR ls_ref_formula.
|
CLEAR ls_ref_formula.
|
||||||
|
@ -2671,11 +2688,6 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
IF lv_cell_value IS NOT INITIAL
|
IF lv_cell_value IS NOT INITIAL
|
||||||
OR lv_cell_formula IS NOT INITIAL
|
OR lv_cell_formula IS NOT INITIAL
|
||||||
OR lv_style_guid IS NOT INITIAL.
|
OR lv_style_guid IS NOT INITIAL.
|
||||||
zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING
|
|
||||||
i_columnrow = ls_cell-r
|
|
||||||
IMPORTING
|
|
||||||
e_column = lv_cell_column
|
|
||||||
e_row = lv_cell_row ).
|
|
||||||
io_worksheet->set_cell( ip_column = lv_cell_column " cell_elem Column
|
io_worksheet->set_cell( ip_column = lv_cell_column " cell_elem Column
|
||||||
ip_row = lv_cell_row " cell_elem row_elem
|
ip_row = lv_cell_row " cell_elem row_elem
|
||||||
ip_value = lv_cell_value " cell_elem Value
|
ip_value = lv_cell_value " cell_elem Value
|
||||||
|
|
|
@ -1083,6 +1083,10 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
||||||
|
|
||||||
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
|
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
|
||||||
|
|
||||||
|
IF <ls_field_catalog>-width IS NOT INITIAL.
|
||||||
|
set_column_width( ip_column = lv_column_alpha ip_width_fix = <ls_field_catalog>-width ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
" First of all write column header
|
" First of all write column header
|
||||||
IF <ls_field_catalog>-style_header IS NOT INITIAL.
|
IF <ls_field_catalog>-style_header IS NOT INITIAL.
|
||||||
me->set_cell( ip_column = lv_column_alpha
|
me->set_cell( ip_column = lv_column_alpha
|
||||||
|
|
|
@ -269,6 +269,11 @@ CLASS zcl_excel_writer_2007 DEFINITION
|
||||||
!ip_flag TYPE flag
|
!ip_flag TYPE flag
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(ep_boolean) TYPE tv_charbool .
|
VALUE(ep_boolean) TYPE tv_charbool .
|
||||||
|
METHODS number2string
|
||||||
|
IMPORTING
|
||||||
|
!ip_number TYPE numeric
|
||||||
|
RETURNING
|
||||||
|
VALUE(ep_string) TYPE string.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -3139,7 +3144,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
lc_xml_attr_val_none TYPE string VALUE 'none',
|
lc_xml_attr_val_none TYPE string VALUE 'none',
|
||||||
lc_xml_attr_val_msodir TYPE string VALUE 'mso-direction-alt:auto',
|
lc_xml_attr_val_msodir TYPE string VALUE 'mso-direction-alt:auto',
|
||||||
lc_xml_attr_val_note TYPE string VALUE 'Note'.
|
lc_xml_attr_val_note TYPE string VALUE 'Note'.
|
||||||
CONSTANTS lc_anchor_init TYPE string VALUE '2, 15, 11, 10, &right_column&, 31, &bottom_row&, 9'.
|
|
||||||
|
|
||||||
|
|
||||||
DATA: lo_document TYPE REF TO if_ixml_document,
|
DATA: lo_document TYPE REF TO if_ixml_document,
|
||||||
|
@ -3181,6 +3185,10 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
DATA lv_right_column TYPE i.
|
DATA lv_right_column TYPE i.
|
||||||
DATA lv_bottom_row_str TYPE string.
|
DATA lv_bottom_row_str TYPE string.
|
||||||
DATA lv_right_column_str TYPE string.
|
DATA lv_right_column_str TYPE string.
|
||||||
|
DATA lv_top_row TYPE i.
|
||||||
|
DATA lv_left_column TYPE i.
|
||||||
|
DATA lv_top_row_str TYPE string.
|
||||||
|
DATA lv_left_column_str TYPE string.
|
||||||
|
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
@ -3310,17 +3318,14 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
" Offsets are a number of pixels.
|
" Offsets are a number of pixels.
|
||||||
" Reference: Anchor Class at
|
" Reference: Anchor Class at
|
||||||
" https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.vml.spreadsheet.anchor?view=openxml-3.0.1
|
" https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.vml.spreadsheet.anchor?view=openxml-3.0.1
|
||||||
lv_right_column = lo_comment->get_right_column( ).
|
lv_anchor = number2string( lo_comment->get_left_column( ) )
|
||||||
lv_bottom_row = lo_comment->get_bottom_row( ).
|
&& `, ` && number2string( lo_comment->get_left_offset( ) )
|
||||||
|
&& `, ` && number2string( lo_comment->get_top_row( ) )
|
||||||
lv_right_column_str = lv_right_column.
|
&& `, ` && number2string( lo_comment->get_top_offset( ) )
|
||||||
CONDENSE lv_right_column_str.
|
&& `, ` && number2string( lo_comment->get_right_column( ) )
|
||||||
lv_bottom_row_str = lv_bottom_row.
|
&& `, ` && number2string( lo_comment->get_right_offset( ) )
|
||||||
CONDENSE lv_bottom_row_str.
|
&& `, ` && number2string( lo_comment->get_bottom_row( ) )
|
||||||
|
&& `, ` && number2string( lo_comment->get_bottom_offset( ) ).
|
||||||
lv_anchor = lc_anchor_init.
|
|
||||||
REPLACE '&right_column&' WITH lv_right_column_str INTO lv_anchor.
|
|
||||||
REPLACE '&bottom_row&' WITH lv_bottom_row_str INTO lv_anchor.
|
|
||||||
lo_element_anchor->set_value( lv_anchor ).
|
lo_element_anchor->set_value( lv_anchor ).
|
||||||
|
|
||||||
lo_element_clientdata->append_child( new_child = lo_element_anchor ).
|
lo_element_clientdata->append_child( new_child = lo_element_anchor ).
|
||||||
|
@ -6224,6 +6229,12 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD number2string.
|
||||||
|
ep_string = ip_number.
|
||||||
|
CONDENSE ep_string.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD render_xml_document.
|
METHOD render_xml_document.
|
||||||
DATA lo_streamfactory TYPE REF TO if_ixml_stream_factory.
|
DATA lo_streamfactory TYPE REF TO if_ixml_stream_factory.
|
||||||
DATA lo_ostream TYPE REF TO if_ixml_ostream.
|
DATA lo_ostream TYPE REF TO if_ixml_ostream.
|
||||||
|
|
|
@ -123,6 +123,12 @@
|
||||||
<ADMINFIELD>0</ADMINFIELD>
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
<COMPTYPE>E</COMPTYPE>
|
<COMPTYPE>E</COMPTYPE>
|
||||||
</DD03P>
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>WIDTH</FIELDNAME>
|
||||||
|
<ROLLNAME>INT4</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
</DD03P_TABLE>
|
</DD03P_TABLE>
|
||||||
<I18N_LANGS>
|
<I18N_LANGS>
|
||||||
<LANGU>1</LANGU>
|
<LANGU>1</LANGU>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user