mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 19:16:10 +08:00
2 get methods instead of 1 + minor changes
This commit is contained in:
parent
dd2f957007
commit
8a4add3486
|
@ -5,41 +5,43 @@ CLASS zcl_excel_comment DEFINITION
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
|
|
||||||
CONSTANTS default_right_column TYPE i VALUE 4. "#EC NOTEXT
|
CONSTANTS default_right_column TYPE i VALUE 4. "#EC NOTEXT
|
||||||
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_name
|
METHODS get_bottom_row
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(r_name) TYPE string .
|
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_name
|
||||||
|
RETURNING
|
||||||
|
VALUE(r_name) TYPE string .
|
||||||
METHODS get_ref
|
METHODS get_ref
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rp_ref) TYPE string .
|
VALUE(rp_ref) TYPE string .
|
||||||
|
METHODS get_right_column
|
||||||
|
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 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_right_column TYPE i OPTIONAL
|
||||||
!ip_bottom_row TYPE i OPTIONAL .
|
!ip_bottom_row TYPE i OPTIONAL .
|
||||||
METHODS get_position
|
|
||||||
EXPORTING
|
|
||||||
!ep_right_column TYPE i
|
|
||||||
!ep_bottom_row TYPE i .
|
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA bottom_row TYPE i .
|
||||||
DATA index TYPE string .
|
DATA index TYPE string .
|
||||||
DATA ref TYPE string .
|
DATA ref TYPE string .
|
||||||
DATA text TYPE string .
|
|
||||||
DATA right_column TYPE i .
|
DATA right_column TYPE i .
|
||||||
DATA bottom_row TYPE i .
|
DATA text TYPE string .
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +54,11 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_bottom_row.
|
||||||
|
rp_result = bottom_row.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_index.
|
METHOD get_index.
|
||||||
rp_index = me->index.
|
rp_index = me->index.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -67,6 +74,11 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_right_column.
|
||||||
|
rp_result = right_column.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_text.
|
METHOD get_text.
|
||||||
rp_text = me->text.
|
rp_text = me->text.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -79,30 +91,17 @@ CLASS zcl_excel_comment IMPLEMENTATION.
|
||||||
me->ref = ip_ref.
|
me->ref = ip_ref.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF ip_right_column IS SUPPLIED.
|
IF ip_right_column IS NOT INITIAL.
|
||||||
me->right_column = ip_right_column.
|
me->right_column = ip_right_column.
|
||||||
ENDIF.
|
ELSE.
|
||||||
|
me->right_column = default_right_column.
|
||||||
IF ip_bottom_row IS SUPPLIED.
|
ENDIF.
|
||||||
me->bottom_row = ip_bottom_row.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
|
IF ip_bottom_row IS NOT INITIAL.
|
||||||
|
me->bottom_row = ip_bottom_row.
|
||||||
|
ELSE.
|
||||||
|
me->bottom_row = default_bottom_row.
|
||||||
|
ENDIF.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD get_position.
|
|
||||||
|
|
||||||
IF right_column IS NOT INITIAL.
|
|
||||||
ep_right_column = right_column.
|
|
||||||
ELSE.
|
|
||||||
ep_right_column = default_right_column. "Default right_column
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
IF bottom_row IS NOT INITIAL.
|
|
||||||
ep_bottom_row = bottom_row.
|
|
||||||
ELSE.
|
|
||||||
ep_bottom_row = default_bottom_row. "Default bottom_row
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
|
@ -3139,6 +3139,7 @@ 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,
|
||||||
|
@ -3175,6 +3176,11 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
lv_int_value TYPE i,
|
lv_int_value TYPE i,
|
||||||
lv_int_value_string TYPE string.
|
lv_int_value_string TYPE string.
|
||||||
DATA: lv_rel_id TYPE i.
|
DATA: lv_rel_id TYPE i.
|
||||||
|
DATA lv_anchor TYPE string.
|
||||||
|
DATA lv_bottom_row TYPE i.
|
||||||
|
DATA lv_right_column TYPE i.
|
||||||
|
DATA lv_bottom_row_str TYPE string.
|
||||||
|
DATA lv_right_column_str TYPE string.
|
||||||
|
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
@ -3298,41 +3304,24 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
lo_element_anchor = lo_document->create_simple_element( name = lc_xml_node_anchor
|
lo_element_anchor = lo_document->create_simple_element( name = lc_xml_node_anchor
|
||||||
parent = lo_document ).
|
parent = lo_document ).
|
||||||
|
|
||||||
|
" Anchor represents 4 pairs of numbers:
|
||||||
|
" ( left column, left offset ), ( top row, top offset ),
|
||||||
|
" ( right column, right offset ), ( bottom row, botton offset )
|
||||||
|
" Offsets are a number of pixels.
|
||||||
|
" Reference: Anchor Class at
|
||||||
|
" 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_bottom_row = lo_comment->get_bottom_row( ).
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
lv_right_column_str = lv_right_column.
|
||||||
* Ricardo R. - 2024.05.02
|
CONDENSE lv_right_column_str.
|
||||||
* https://github.com/abap2xlsx/abap2xlsx/pull/1219
|
lv_bottom_row_str = lv_bottom_row.
|
||||||
*--------------------------------------------------------------------*
|
CONDENSE lv_bottom_row_str.
|
||||||
* Anchor represents 4 pairs of numbers:
|
|
||||||
* ( left column, left offset ), ( top row, top offset ),
|
|
||||||
* ( right column, right offset ), ( bottom row, botton offset )
|
|
||||||
*--------------------------------------------------------------------*
|
|
||||||
DATA:
|
|
||||||
lv_anchor TYPE string,
|
|
||||||
lv_bottom_row TYPE i,
|
|
||||||
lv_right_col TYPE i,
|
|
||||||
lv_bottom_row_str TYPE string,
|
|
||||||
lv_right_col_str TYPE string.
|
|
||||||
|
|
||||||
CONSTANTS:
|
lv_anchor = lc_anchor_init.
|
||||||
lc_anchor_init TYPE string VALUE '2, 15, 11, 10, &right_col&, 31, &bottom_row&, 9'.
|
REPLACE '&right_column&' WITH lv_right_column_str INTO lv_anchor.
|
||||||
|
REPLACE '&bottom_row&' WITH lv_bottom_row_str INTO lv_anchor.
|
||||||
CALL METHOD lo_comment->get_position
|
lo_element_anchor->set_value( lv_anchor ).
|
||||||
IMPORTING
|
|
||||||
ep_right_column = lv_right_col
|
|
||||||
ep_bottom_row = lv_bottom_row.
|
|
||||||
|
|
||||||
lv_right_col_str = lv_right_col.
|
|
||||||
lv_bottom_row_str = lv_bottom_row.
|
|
||||||
|
|
||||||
lv_anchor = lc_anchor_init.
|
|
||||||
REPLACE '&right_col&' WITH lv_right_col_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( '2, 15, 11, 10, 4, 31, 15, 9' ). "Original line
|
|
||||||
*--------------------------------------------------------------------*
|
|
||||||
|
|
||||||
lo_element_clientdata->append_child( new_child = lo_element_anchor ).
|
lo_element_clientdata->append_child( new_child = lo_element_anchor ).
|
||||||
lo_element_autofill = lo_document->create_simple_element( name = lc_xml_node_autofill
|
lo_element_autofill = lo_document->create_simple_element( name = lc_xml_node_autofill
|
||||||
|
|
Loading…
Reference in New Issue
Block a user