Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for_abap_711/ZCL_DOCX_CLASS_711.abap | 96 +++++++++++++-----------------------
- 1 file changed, 34 insertions(+), 62 deletions(-)
- diff --git a/for_abap_711/ZCL_DOCX_CLASS_711.abap b/for_abap_711/ZCL_DOCX_CLASS_711.abap
- index 8fa5edc..0dd240a 100644
- --- a/for_abap_711/ZCL_DOCX_CLASS_711.abap
- +++ b/for_abap_711/ZCL_DOCX_CLASS_711.abap
- @@ -179,19 +179,20 @@ CLASS lcl_docx DEFINITION.
- IMPORTING
- !iv_path TYPE string
- !iv_data TYPE xstring.
- +
- + METHODS get_raw
- + RETURNING
- + value(rv_content) TYPE xstring.
- +
- METHODS save
- IMPORTING
- !on_desktop TYPE xfeld DEFAULT 'X'
- !iv_folder TYPE string DEFAULT 'report'
- !iv_path TYPE string DEFAULT ''
- !iv_file_name TYPE string DEFAULT 'report.docx'
- - !no_execute TYPE xfeld DEFAULT ''
- - RETURNING
- - value(iv_path_out) TYPE string .
- -
- -
- -
- -
- + !no_execute TYPE xfeld DEFAULT ''
- + RETURNING
- + value(rv_path_out) TYPE string.
- METHODS map_data
- IMPORTING
- @@ -866,19 +867,10 @@ CLASS lcl_docx IMPLEMENTATION.
- content = iv_data ).
- ENDMETHOD. "add_file
- - METHOD save.
- -
- - DATA
- - : lv_content TYPE xstring
- - , lv_content2 TYPE xstring
- - .
- -
- -* dump_data( node = document
- -* fname = 'before save' ).
- -
- - lv_content = me->create_document( ).
- -
- + METHOD get_raw.
- + CLEAR rv_content.
- + rv_content = me->create_document( ).
- DATA
- : lv_string TYPE string
- @@ -887,32 +879,23 @@ CLASS lcl_docx IMPLEMENTATION.
- , lt_string TYPE TABLE OF string
- , lt_data TYPE TABLE OF text255
- .
- -
- -* CALL FUNCTION 'Z_CNV_XSTRING_TO_STRING'
- -* EXPORTING
- -* iv_xstring = lv_content
- -* IMPORTING
- -* ev_string = lv_string.
- -
- -
- DATA
- : converter TYPE REF TO cl_abap_conv_in_ce
- .
- CALL METHOD cl_abap_conv_in_ce=>create
- EXPORTING
- - input = lv_content
- + input = rv_content
- encoding = 'UTF-8'
- replacement = '?'
- ignore_cerr = abap_true
- RECEIVING
- conv = converter.
- -
- TRY.
- - CALL METHOD converter->read
- - IMPORTING
- - data = lv_string.
- + CALL METHOD converter->read
- + IMPORTING
- + data = lv_string.
- CATCH cx_sy_conversion_codepage.
- *-- Should ignore errors in code conversions
- CATCH cx_sy_codepage_converter_init.
- @@ -921,9 +904,6 @@ CLASS lcl_docx IMPLEMENTATION.
- CATCH cx_parameter_invalid_range.
- ENDTRY.
- -
- -
- -
- SPLIT lv_string AT '[SPACE]' INTO TABLE lt_string.
- DATA
- @@ -936,8 +916,8 @@ CLASS lcl_docx IMPLEMENTATION.
- lv_rem = 255.
- FIELD-SYMBOLS
- - : <fs_str> TYPE string
- - .
- + : <fs_str> TYPE string
- + .
- LOOP AT lt_string ASSIGNING <fs_str>.
- @@ -957,12 +937,9 @@ CLASS lcl_docx IMPLEMENTATION.
- lv_pos = lv_pos + lv_len.
- lv_rem = lv_rem - lv_len.
- CLEAR <fs_str>.
- -
- ENDIF.
- lv_len = strlen( <fs_str> ).
- -
- -
- ENDWHILE.
- IF lv_pos < 254.
- @@ -978,16 +955,12 @@ CLASS lcl_docx IMPLEMENTATION.
- lv_pos = 1.
- lv_rem = 254.
- CLEAR lv_buf.
- -
- -
- ENDIF.
- -
- ENDLOOP.
- APPEND lv_buf TO lt_data.
- -
- FIELD-SYMBOLS
- : <xstr> TYPE x
- .
- @@ -999,39 +972,38 @@ CLASS lcl_docx IMPLEMENTATION.
- , lv_str TYPE string
- .
- - CLEAR lv_content.
- -* loop at lt_data assigning <xstr> casting .
- -* concatenate lv_content <xstr> into lv_content in byte mode.
- -* endloop.
- -
- FIELD-SYMBOLS
- : <fs_data> TYPE text255
- .
- LOOP AT lt_data ASSIGNING <fs_data>.
- -
- CONCATENATE lv_str <fs_data> INTO lv_str RESPECTING BLANKS.
- -
- ENDLOOP.
- DATA
- - : lr_conv_out TYPE REF TO cl_abap_conv_out_ce
- - , lv_echo_xstring TYPE xstring
- - .
- + : lr_conv_out TYPE REF TO cl_abap_conv_out_ce
- + , lv_echo_xstring TYPE xstring
- + .
- lr_conv_out = cl_abap_conv_out_ce=>create(
- - encoding = 'UTF-8' " Êîäèðîâêà â êîòîðóþ áóäåì ïðåîáðàçîâûâàòü
- + encoding = 'UTF-8'
- ).
- -
- - lr_conv_out->convert( EXPORTING data = lv_str IMPORTING buffer = lv_content ).
- -
- + lr_conv_out->convert( EXPORTING data = lv_str IMPORTING buffer = rv_content ).
- zip->delete( name = me->c_document ).
- zip->add( name = me->c_document
- - content = lv_content ).
- + content = rv_content ).
- - lv_content = zip->save( ).
- + rv_content = zip->save( ).
- + ENDMETHOD. "get_raw
- +
- + METHOD save.
- +
- + DATA
- + : lv_content TYPE xstring.
- +
- + lv_content = me->get_raw( ).
- DATA
- : lt_file_tab TYPE solix_tab
- @@ -1055,8 +1027,8 @@ CLASS lcl_docx IMPLEMENTATION.
- ENDIF.
- CONCATENATE lv_path '\' iv_folder '\' iv_file_name INTO lv_path.
- -
- - iv_path_out = lv_path.
- +
- + rv_path_out = lv_path.
- cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
- filename = lv_path
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement