diff --git a/src/zcl_excel_comment.clas.abap b/src/zcl_excel_comment.clas.abap index a285701..f9ad9e0 100644 --- a/src/zcl_excel_comment.clas.abap +++ b/src/zcl_excel_comment.clas.abap @@ -9,12 +9,21 @@ CLASS zcl_excel_comment DEFINITION CONSTANTS default_bottom_row TYPE i VALUE 15. "#EC NOTEXT METHODS constructor . + METHODS get_bottom_offset + RETURNING + VALUE(rp_result) TYPE i . METHODS get_bottom_row RETURNING VALUE(rp_result) TYPE i . METHODS get_index RETURNING 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 RETURNING VALUE(r_name) TYPE string . @@ -24,24 +33,45 @@ CLASS zcl_excel_comment DEFINITION METHODS get_right_column RETURNING VALUE(rp_result) TYPE i . + METHODS get_right_offset + RETURNING + VALUE(rp_result) TYPE i . METHODS get_text RETURNING 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 IMPORTING - !ip_text TYPE string - !ip_ref TYPE string OPTIONAL - !ip_right_column TYPE i OPTIONAL - !ip_bottom_row TYPE i OPTIONAL . + !ip_text TYPE string + !ip_ref TYPE string OPTIONAL + !ip_left_column TYPE i DEFAULT 2 + !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. PRIVATE SECTION. + DATA bottom_offset TYPE i . DATA bottom_row TYPE i . DATA index TYPE string . DATA ref TYPE string . + DATA left_column TYPE i . + DATA left_offset TYPE i . DATA right_column TYPE i . + DATA right_offset TYPE i . DATA text TYPE string . + DATA top_offset TYPE i . + DATA top_row TYPE i . ENDCLASS. @@ -54,6 +84,11 @@ CLASS zcl_excel_comment IMPLEMENTATION. ENDMETHOD. + METHOD get_bottom_offset. + rp_result = bottom_offset. + ENDMETHOD. + + METHOD get_bottom_row. rp_result = bottom_row. ENDMETHOD. @@ -64,6 +99,16 @@ CLASS zcl_excel_comment IMPLEMENTATION. ENDMETHOD. + METHOD get_left_column. + rp_result = left_column. + ENDMETHOD. + + + METHOD get_left_offset. + rp_result = left_offset. + ENDMETHOD. + + METHOD get_name. ENDMETHOD. @@ -79,11 +124,26 @@ CLASS zcl_excel_comment IMPLEMENTATION. ENDMETHOD. + METHOD get_right_offset. + rp_result = right_offset. + ENDMETHOD. + + METHOD get_text. rp_text = me->text. ENDMETHOD. + METHOD get_top_offset. + rp_result = top_offset. + ENDMETHOD. + + + METHOD get_top_row. + rp_result = top_row. + ENDMETHOD. + + METHOD set_text. me->text = ip_text. @@ -91,17 +151,25 @@ CLASS zcl_excel_comment IMPLEMENTATION. me->ref = ip_ref. 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. me->right_column = ip_right_column. ELSE. me->right_column = default_right_column. ENDIF. + me->right_offset = ip_right_offset. IF ip_bottom_row IS NOT INITIAL. me->bottom_row = ip_bottom_row. ELSE. me->bottom_row = default_bottom_row. ENDIF. + me->bottom_offset = ip_bottom_offset. ENDMETHOD. ENDCLASS. diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index 958e639..38578c4 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -269,6 +269,11 @@ CLASS zcl_excel_writer_2007 DEFINITION !ip_flag TYPE flag RETURNING VALUE(ep_boolean) TYPE tv_charbool . + METHODS number2string + IMPORTING + !ip_number TYPE numeric + RETURNING + VALUE(ep_string) TYPE string. ENDCLASS. @@ -3139,7 +3144,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. 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_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, @@ -3181,6 +3185,10 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. DATA lv_right_column TYPE i. DATA lv_bottom_row_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. " 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. - CONDENSE lv_right_column_str. - lv_bottom_row_str = lv_bottom_row. - CONDENSE lv_bottom_row_str. - - 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. + lv_anchor = number2string( lo_comment->get_left_column( ) ) + && `, ` && number2string( lo_comment->get_left_offset( ) ) + && `, ` && number2string( lo_comment->get_top_row( ) ) + && `, ` && number2string( lo_comment->get_top_offset( ) ) + && `, ` && number2string( lo_comment->get_right_column( ) ) + && `, ` && number2string( lo_comment->get_right_offset( ) ) + && `, ` && number2string( lo_comment->get_bottom_row( ) ) + && `, ` && number2string( lo_comment->get_bottom_offset( ) ). lo_element_anchor->set_value( lv_anchor ). lo_element_clientdata->append_child( new_child = lo_element_anchor ). @@ -6224,6 +6229,12 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. ENDMETHOD. + METHOD number2string. + ep_string = ip_number. + CONDENSE ep_string. + ENDMETHOD. + + METHOD render_xml_document. DATA lo_streamfactory TYPE REF TO if_ixml_stream_factory. DATA lo_ostream TYPE REF TO if_ixml_ostream.