2 weeks ago
Hi, all.
I'm using ABAP2XLSX, i've created this simple test program.
The file is downloaded but when I open the file MS Excel is showing a message:
"We have encountered a problem with the content of "my_file.xlsx" . Do you want us to try to recover as much content as possible? If you trust the origin of this book, click Yes."
And then a message:
"Removed part: /xl/tables/table1.xml, part with error of XML. Line 1 column 202.
This is my code:
*&---------------------------------------------------------------------*
*& Report ZTEST_ABAP2XLSX
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest_abap2xlsx.
TYPES:
BEGIN OF tys_table,
field1 TYPE string,
field2 TYPE string,
field3 TYPE string,
field4 TYPE string,
END OF tys_table .
TYPES:
tyt_table TYPE STANDARD TABLE OF tys_table.
DATA:
ls_table TYPE tys_table,
lt_table TYPE tyt_table,
ls_table_settings TYPE zexcel_s_table_settings,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_excel TYPE REF TO zcl_excel.
ls_table-field1 = 'Expedient'.
ls_table-field2 = '123123123'.
APPEND ls_table TO lt_table. CLEAR: ls_table.
ls_table-field1 = 'Description'.
ls_table-field2 = 'My description'.
APPEND ls_table TO lt_table. CLEAR: ls_table.
APPEND ls_table TO lt_table. CLEAR: ls_table. "Empty line
ls_table-field1 = 'VENDOR'.
APPEND ls_table TO lt_table. CLEAR: ls_table.
ls_table-field1 = 'ID'.
APPEND ls_table TO lt_table. CLEAR: ls_table.
ls_table-field1 = 'Type'.
ls_table-field2 = 'V'.
APPEND ls_table TO lt_table. CLEAR: ls_table.
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Vendor' ).
TRY.
ls_table_settings-top_left_column = 2.
ls_table_settings-top_left_row = 2.
CALL METHOD lo_worksheet->bind_table
EXPORTING
ip_table = lt_table
is_table_settings = ls_table_settings.
* iv_no_header = abap_true.
CATCH zcx_excel.
ENDTRY.
DATA:
lv_filename TYPE string,
lv_folder TYPE string,
lv_xdata TYPE xstring,
lv_bytecount TYPE i,
lt_raw_data TYPE solix_tab,
lo_writer TYPE REF TO zif_excel_writer.
CALL METHOD cl_gui_frontend_services=>directory_browse
* EXPORTING
* window_title =
* initial_folder =
CHANGING
selected_folder = lv_folder
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0 OR lv_folder IS INITIAL.
RAISE cancelar.
ENDIF.
CONCATENATE 'EXPEDIENT' 'Test' INTO lv_filename SEPARATED BY '_'.
CONCATENATE lv_folder '\' lv_filename '.xlsx' INTO lv_filename.
CREATE OBJECT lo_writer TYPE zcl_excel_writer_2007.
lv_xdata = lo_writer->write_file( lo_excel ).
lt_raw_data = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_xdata ).
lv_bytecount = xstrlen( lv_xdata ).
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = lv_filename
filetype = 'BIN'
CHANGING data_tab = lt_raw_data ).
------------
Any tip?
Thanks
You should file a bugreport on Github:
One of the devs might then generate a similar output on a supported system and then compare the results; be aware that the issue might not be solvable at all, if it comes down to the system being too old.
Oh... and please format the code with the "source code" tag 😄
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bug reproduced in the latest version. BIND_TABLE doesn't handle a numeric column in TOP_LEFT_COLUMN. The right way to call is shown here: https://github.com/abap2xlsx/demos/blob/07d9663e39b68c834a212090ba857e5f6891d788/src/zdemo_excel11.p....
Issue and PR welcome.
@oliver_am I created the issue 1213 for you. https://github.com/abap2xlsx/abap2xlsx/issues/1215
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.