diff --git a/src/demos/zdemo_excel.prog.abap b/src/demos/zdemo_excel.prog.abap index 95ca527..ba60d41 100644 --- a/src/demos/zdemo_excel.prog.abap +++ b/src/demos/zdemo_excel.prog.abap @@ -14,6 +14,7 @@ DATA: lv_workdir TYPE string, PARAMETERS: p_path TYPE zexcel_export_dir. +PARAMETERS: p_checkr NO-DISPLAY TYPE abap_bool. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. lv_workdir = p_path. @@ -37,7 +38,7 @@ START-OF-SELECTION. SUBMIT zdemo_excel1 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Hello world SUBMIT zdemo_excel2 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Styles - SUBMIT zdemo_excel3 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: iTab binding + SUBMIT zdemo_excel3 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path WITH p_checkr = p_checkr AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: iTab binding SUBMIT zdemo_excel4 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multi sheets, page setup and sheet properties SUBMIT zdemo_excel5 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Conditional formatting SUBMIT zdemo_excel6 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Formulas diff --git a/src/demos/zdemo_excel1.prog.abap b/src/demos/zdemo_excel1.prog.abap index babc0e4..4806939 100644 --- a/src/demos/zdemo_excel1.prog.abap +++ b/src/demos/zdemo_excel1.prog.abap @@ -12,7 +12,9 @@ REPORT zdemo_excel1. DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_hyperlink TYPE REF TO zcl_excel_hyperlink, - lo_column TYPE REF TO zcl_excel_column. + lo_column TYPE REF TO zcl_excel_column, + lv_date TYPE d, + lv_time TYPE t. CONSTANTS: gc_save_file_name TYPE string VALUE '01_HelloWorld.xlsx'. INCLUDE zdemo_excel_outputopt_incl. @@ -25,8 +27,10 @@ START-OF-SELECTION. " Get active sheet lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). - lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = sy-datum ). - lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = sy-uzeit ). + lv_date = '20211231'. + lv_time = '055817'. + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = lv_date ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = lv_time ). lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = 'https://abap2xlsx.github.io/abap2xlsx' ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 4 ip_value = 'Click here to visit abap2xlsx homepage' ip_hyperlink = lo_hyperlink ). diff --git a/src/demos/zdemo_excel1.w3mi.data.xlsx b/src/demos/zdemo_excel1.w3mi.data.xlsx new file mode 100644 index 0000000..b145e75 Binary files /dev/null and b/src/demos/zdemo_excel1.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel1.w3mi.xml b/src/demos/zdemo_excel1.w3mi.xml new file mode 100644 index 0000000..33c60b8 --- /dev/null +++ b/src/demos/zdemo_excel1.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL1 + 01_HelloWorld.xlsx (ZDEMO_EXCEL1) + + + MI + ZDEMO_EXCEL1 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL1 + filename + + + MI + ZDEMO_EXCEL1 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel10.prog.abap b/src/demos/zdemo_excel10.prog.abap index fd26907..6393f2b 100644 --- a/src/demos/zdemo_excel10.prog.abap +++ b/src/demos/zdemo_excel10.prog.abap @@ -8,6 +8,8 @@ REPORT zdemo_excel10. +TYPES: ty_sflight_lines TYPE TABLE OF sflight. + DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_style_cond TYPE REF TO zcl_excel_style_cond, @@ -51,8 +53,8 @@ START-OF-SELECTION. lo_style_cond->mode_iconset = ls_iconset. lo_style_cond->priority = 1. - DATA lt_test TYPE TABLE OF sflight. - SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + DATA lt_test TYPE ty_sflight_lines. + PERFORM load_fixed_data CHANGING lt_test. lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_test ). @@ -93,3 +95,50 @@ START-OF-SELECTION. *** Create output lcl_output=>output( lo_excel ). + + +FORM load_fixed_data CHANGING ct_test TYPE ty_sflight_lines. + DATA: lt_lines TYPE TABLE OF string, + lv_line TYPE string, + lt_fields TYPE TABLE OF string, + lv_comp TYPE i, + lv_field TYPE string, + ls_test TYPE sflight. + FIELD-SYMBOLS: TYPE simple. + + APPEND 'AA 0017 20171219 422 USD 747-400 385 371 191334 31 28 21 21' TO lt_lines. + APPEND 'AA 0017 20180309 422 USD 747-400 385 365 189984 31 29 21 20' TO lt_lines. + APPEND 'AA 0017 20180528 422 USD 747-400 385 374 193482 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20180816 422 USD 747-400 385 372 193127 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20181104 422 USD 747-400 385 44 23908 31 4 21 3' TO lt_lines. + APPEND 'AA 0017 20190123 422 USD 747-400 385 40 20347 31 3 21 2' TO lt_lines. + APPEND 'AZ 0555 20171219 185 EUR 737-800 140 133 32143 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180309 185 EUR 737-800 140 137 32595 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180528 185 EUR 737-800 140 134 31899 12 11 10 10' TO lt_lines. + APPEND 'AZ 0555 20180816 185 EUR 737-800 140 128 29775 12 10 10 9' TO lt_lines. + APPEND 'AZ 0555 20181104 185 EUR 737-800 140 0 0 12 0 10 0' TO lt_lines. + APPEND 'AZ 0555 20190123 185 EUR 737-800 140 23 5392 12 1 10 2' TO lt_lines. + APPEND 'AZ 0789 20171219 1030 EUR 767-200 260 250 307176 21 20 11 11' TO lt_lines. + APPEND 'AZ 0789 20180309 1030 EUR 767-200 260 252 306054 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180528 1030 EUR 767-200 260 252 307063 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180816 1030 EUR 767-200 260 249 300739 21 19 11 10' TO lt_lines. + APPEND 'AZ 0789 20181104 1030 EUR 767-200 260 104 127647 21 8 11 5' TO lt_lines. + APPEND 'AZ 0789 20190123 1030 EUR 767-200 260 18 22268 21 1 11 1' TO lt_lines. + APPEND 'DL 0106 20171217 611 USD A380-800 475 458 324379 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180307 611 USD A380-800 475 458 324330 30 30 20 20' TO lt_lines. + APPEND 'DL 0106 20180526 611 USD A380-800 475 459 328149 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180814 611 USD A380-800 475 462 326805 30 30 20 18' TO lt_lines. + APPEND 'DL 0106 20181102 611 USD A380-800 475 167 115554 30 10 20 6' TO lt_lines. + APPEND 'DL 0106 20190121 611 USD A380-800 475 11 9073 30 1 20 1' TO lt_lines. + LOOP AT lt_lines INTO lv_line. + CONDENSE lv_line. + SPLIT lv_line AT space INTO TABLE lt_fields. + lv_comp = 2. + LOOP AT lt_fields INTO lv_field. + ASSIGN COMPONENT lv_comp OF STRUCTURE ls_test TO . + = lv_field. + lv_comp = lv_comp + 1. + ENDLOOP. + APPEND ls_test TO ct_test. + ENDLOOP. +ENDFORM. diff --git a/src/demos/zdemo_excel10.w3mi.data.xlsx b/src/demos/zdemo_excel10.w3mi.data.xlsx new file mode 100644 index 0000000..028cc34 Binary files /dev/null and b/src/demos/zdemo_excel10.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel10.w3mi.xml b/src/demos/zdemo_excel10.w3mi.xml new file mode 100644 index 0000000..5fd38b7 --- /dev/null +++ b/src/demos/zdemo_excel10.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL10 + 10_iTabFieldCatalog.xlsx (ZDEMO_EXCEL10) + + + MI + ZDEMO_EXCEL10 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL10 + filename + 10_iTabFieldCatalog.xlsx + + + MI + ZDEMO_EXCEL10 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel12.w3mi.data.xlsx b/src/demos/zdemo_excel12.w3mi.data.xlsx new file mode 100644 index 0000000..a2c26fc Binary files /dev/null and b/src/demos/zdemo_excel12.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel12.w3mi.xml b/src/demos/zdemo_excel12.w3mi.xml new file mode 100644 index 0000000..a33c067 --- /dev/null +++ b/src/demos/zdemo_excel12.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL12 + 12_HideSizeOutlineRowsAndColumns.xlsx (ZDEMO_EXCEL12) + + + MI + ZDEMO_EXCEL12 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL12 + filename + + + MI + ZDEMO_EXCEL12 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel13.w3mi.data.xlsx b/src/demos/zdemo_excel13.w3mi.data.xlsx new file mode 100644 index 0000000..064db29 Binary files /dev/null and b/src/demos/zdemo_excel13.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel13.w3mi.xml b/src/demos/zdemo_excel13.w3mi.xml new file mode 100644 index 0000000..f7f3eb9 --- /dev/null +++ b/src/demos/zdemo_excel13.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL13 + 13_MergedCells.xlsx (ZDEMO_EXCEL13) + + + MI + ZDEMO_EXCEL13 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL13 + filename + + + MI + ZDEMO_EXCEL13 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel14.w3mi.data.xlsx b/src/demos/zdemo_excel14.w3mi.data.xlsx new file mode 100644 index 0000000..fff2f73 Binary files /dev/null and b/src/demos/zdemo_excel14.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel14.w3mi.xml b/src/demos/zdemo_excel14.w3mi.xml new file mode 100644 index 0000000..227d8ac --- /dev/null +++ b/src/demos/zdemo_excel14.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL14 + 14_Alignment.xlsx (ZDEMO_EXCEL14) + + + MI + ZDEMO_EXCEL14 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL14 + filename + + + MI + ZDEMO_EXCEL14 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_01.w3mi.data.xlsx b/src/demos/zdemo_excel15_01.w3mi.data.xlsx new file mode 100644 index 0000000..2332ea9 Binary files /dev/null and b/src/demos/zdemo_excel15_01.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_01.w3mi.xml b/src/demos/zdemo_excel15_01.w3mi.xml new file mode 100644 index 0000000..40e8248 --- /dev/null +++ b/src/demos/zdemo_excel15_01.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_01 + 15_01_HelloWorldFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_01 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_01 + filename + + + MI + ZDEMO_EXCEL15_01 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_02.w3mi.data.xlsx b/src/demos/zdemo_excel15_02.w3mi.data.xlsx new file mode 100644 index 0000000..dae1e6b Binary files /dev/null and b/src/demos/zdemo_excel15_02.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_02.w3mi.xml b/src/demos/zdemo_excel15_02.w3mi.xml new file mode 100644 index 0000000..42a5866 --- /dev/null +++ b/src/demos/zdemo_excel15_02.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_02 + 15_02_StylesFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_02 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_02 + filename + + + MI + ZDEMO_EXCEL15_02 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_03.w3mi.data.xlsx b/src/demos/zdemo_excel15_03.w3mi.data.xlsx new file mode 100644 index 0000000..2d8f791 Binary files /dev/null and b/src/demos/zdemo_excel15_03.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_03.w3mi.xml b/src/demos/zdemo_excel15_03.w3mi.xml new file mode 100644 index 0000000..9129913 --- /dev/null +++ b/src/demos/zdemo_excel15_03.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_03 + 15_03_iTabFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_03 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_03 + filename + + + MI + ZDEMO_EXCEL15_03 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_04.w3mi.data.xlsx b/src/demos/zdemo_excel15_04.w3mi.data.xlsx new file mode 100644 index 0000000..c589a7f Binary files /dev/null and b/src/demos/zdemo_excel15_04.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_04.w3mi.xml b/src/demos/zdemo_excel15_04.w3mi.xml new file mode 100644 index 0000000..95e46c1 --- /dev/null +++ b/src/demos/zdemo_excel15_04.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_04 + 15_04_SheetsFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_04 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_04 + filename + + + MI + ZDEMO_EXCEL15_04 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_05.w3mi.data.xlsx b/src/demos/zdemo_excel15_05.w3mi.data.xlsx new file mode 100644 index 0000000..befd4f7 Binary files /dev/null and b/src/demos/zdemo_excel15_05.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_05.w3mi.xml b/src/demos/zdemo_excel15_05.w3mi.xml new file mode 100644 index 0000000..6d97620 --- /dev/null +++ b/src/demos/zdemo_excel15_05.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_05 + 15_05_ConditionalFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_05 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_05 + filename + + + MI + ZDEMO_EXCEL15_05 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_07.w3mi.data.xlsx b/src/demos/zdemo_excel15_07.w3mi.data.xlsx new file mode 100644 index 0000000..ede2a73 Binary files /dev/null and b/src/demos/zdemo_excel15_07.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_07.w3mi.xml b/src/demos/zdemo_excel15_07.w3mi.xml new file mode 100644 index 0000000..a8491e5 --- /dev/null +++ b/src/demos/zdemo_excel15_07.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_07 + 15_07_ConditionalAllFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_07 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_07 + filename + + + MI + ZDEMO_EXCEL15_07 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_08.w3mi.data.xlsx b/src/demos/zdemo_excel15_08.w3mi.data.xlsx new file mode 100644 index 0000000..23f4e07 Binary files /dev/null and b/src/demos/zdemo_excel15_08.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_08.w3mi.xml b/src/demos/zdemo_excel15_08.w3mi.xml new file mode 100644 index 0000000..a3bdd6a --- /dev/null +++ b/src/demos/zdemo_excel15_08.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_08 + 15_08_RangeFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_08 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_08 + filename + + + MI + ZDEMO_EXCEL15_08 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_13.w3mi.data.xlsx b/src/demos/zdemo_excel15_13.w3mi.data.xlsx new file mode 100644 index 0000000..3c38c25 Binary files /dev/null and b/src/demos/zdemo_excel15_13.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_13.w3mi.xml b/src/demos/zdemo_excel15_13.w3mi.xml new file mode 100644 index 0000000..4044b96 --- /dev/null +++ b/src/demos/zdemo_excel15_13.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_13 + 15_13_MergedCellsFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_13 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_13 + filename + + + MI + ZDEMO_EXCEL15_13 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_24.w3mi.data.xlsx b/src/demos/zdemo_excel15_24.w3mi.data.xlsx new file mode 100644 index 0000000..9f5361a Binary files /dev/null and b/src/demos/zdemo_excel15_24.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_24.w3mi.xml b/src/demos/zdemo_excel15_24.w3mi.xml new file mode 100644 index 0000000..876e98d --- /dev/null +++ b/src/demos/zdemo_excel15_24.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_24 + 15_24_Sheets_with_different_default_date_formatsFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_24 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_24 + filename + + + MI + ZDEMO_EXCEL15_24 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel15_31.w3mi.data.xlsx b/src/demos/zdemo_excel15_31.w3mi.data.xlsx new file mode 100644 index 0000000..689e3b9 Binary files /dev/null and b/src/demos/zdemo_excel15_31.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel15_31.w3mi.xml b/src/demos/zdemo_excel15_31.w3mi.xml new file mode 100644 index 0000000..eed800e --- /dev/null +++ b/src/demos/zdemo_excel15_31.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL15_31 + 15_31_AutosizeWithDifferentFontSizesFromReader.xlsx (ZDEMO_EXCEL15) + + + MI + ZDEMO_EXCEL15_31 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL15_31 + filename + + + MI + ZDEMO_EXCEL15_31 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel16.w3mi.data.xlsx b/src/demos/zdemo_excel16.w3mi.data.xlsx new file mode 100644 index 0000000..8abb024 Binary files /dev/null and b/src/demos/zdemo_excel16.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel16.w3mi.xml b/src/demos/zdemo_excel16.w3mi.xml new file mode 100644 index 0000000..2d90ce6 --- /dev/null +++ b/src/demos/zdemo_excel16.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL16 + 16_Drawings.xlsx (ZDEMO_EXCEL16) + + + MI + ZDEMO_EXCEL16 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL16 + filename + + + MI + ZDEMO_EXCEL16 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel17.w3mi.data.xlsx b/src/demos/zdemo_excel17.w3mi.data.xlsx new file mode 100644 index 0000000..78ac3e2 Binary files /dev/null and b/src/demos/zdemo_excel17.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel17.w3mi.xml b/src/demos/zdemo_excel17.w3mi.xml new file mode 100644 index 0000000..b36fd03 --- /dev/null +++ b/src/demos/zdemo_excel17.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL17 + 17_SheetProtection.xlsx (ZDEMO_EXCEL17) + + + MI + ZDEMO_EXCEL17 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL17 + filename + + + MI + ZDEMO_EXCEL17 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel18.w3mi.data.xlsx b/src/demos/zdemo_excel18.w3mi.data.xlsx new file mode 100644 index 0000000..0cc5574 Binary files /dev/null and b/src/demos/zdemo_excel18.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel18.w3mi.xml b/src/demos/zdemo_excel18.w3mi.xml new file mode 100644 index 0000000..c53eb71 --- /dev/null +++ b/src/demos/zdemo_excel18.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL18 + 18_BookProtection.xlsx (ZDEMO_EXCEL18) + + + MI + ZDEMO_EXCEL18 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL18 + filename + + + MI + ZDEMO_EXCEL18 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel19.w3mi.data.xlsx b/src/demos/zdemo_excel19.w3mi.data.xlsx new file mode 100644 index 0000000..3321fdc Binary files /dev/null and b/src/demos/zdemo_excel19.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel19.w3mi.xml b/src/demos/zdemo_excel19.w3mi.xml new file mode 100644 index 0000000..deeb9e4 --- /dev/null +++ b/src/demos/zdemo_excel19.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL19 + 19_SetActiveSheet.xlsx (ZDEMO_EXCEL19) + + + MI + ZDEMO_EXCEL19 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL19 + filename + + + MI + ZDEMO_EXCEL19 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel2.w3mi.data.xlsx b/src/demos/zdemo_excel2.w3mi.data.xlsx new file mode 100644 index 0000000..6195be7 Binary files /dev/null and b/src/demos/zdemo_excel2.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel2.w3mi.xml b/src/demos/zdemo_excel2.w3mi.xml new file mode 100644 index 0000000..3f6f154 --- /dev/null +++ b/src/demos/zdemo_excel2.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL2 + 02_Styles.xlsx (ZDEMO_EXCEL2) + + + MI + ZDEMO_EXCEL2 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL2 + filename + + + MI + ZDEMO_EXCEL2 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel21.w3mi.data.xlsx b/src/demos/zdemo_excel21.w3mi.data.xlsx new file mode 100644 index 0000000..d1efe5e Binary files /dev/null and b/src/demos/zdemo_excel21.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel21.w3mi.xml b/src/demos/zdemo_excel21.w3mi.xml new file mode 100644 index 0000000..563ed7e --- /dev/null +++ b/src/demos/zdemo_excel21.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL21 + 21_BackgroundColorPicker.xlsx (ZDEMO_EXCEL21) + + + MI + ZDEMO_EXCEL21 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL21 + filename + + + MI + ZDEMO_EXCEL21 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel22.prog.abap b/src/demos/zdemo_excel22.prog.abap index ba2e14a..d54fbf1 100644 --- a/src/demos/zdemo_excel22.prog.abap +++ b/src/demos/zdemo_excel22.prog.abap @@ -8,6 +8,8 @@ REPORT zdemo_excel22. +TYPES: ty_sflight_lines TYPE TABLE OF sflight. + DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_style TYPE REF TO zcl_excel_style, @@ -38,8 +40,8 @@ START-OF-SELECTION. lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'PN_MASSIVE' ). - DATA lt_test TYPE TABLE OF sflight. - SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + DATA lt_test TYPE ty_sflight_lines. + PERFORM load_fixed_data CHANGING lt_test. " sheet style (white background) lo_style = lo_excel->add_new_style( ). @@ -125,3 +127,50 @@ START-OF-SELECTION. *** Create output lcl_output=>output( lo_excel ). + + +FORM load_fixed_data CHANGING ct_test TYPE ty_sflight_lines. + DATA: lt_lines TYPE TABLE OF string, + lv_line TYPE string, + lt_fields TYPE TABLE OF string, + lv_comp TYPE i, + lv_field TYPE string, + ls_test TYPE sflight. + FIELD-SYMBOLS: TYPE simple. + + APPEND 'AA 0017 20171219 422 USD 747-400 385 371 191334 31 28 21 21' TO lt_lines. + APPEND 'AA 0017 20180309 422 USD 747-400 385 365 189984 31 29 21 20' TO lt_lines. + APPEND 'AA 0017 20180528 422 USD 747-400 385 374 193482 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20180816 422 USD 747-400 385 372 193127 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20181104 422 USD 747-400 385 44 23908 31 4 21 3' TO lt_lines. + APPEND 'AA 0017 20190123 422 USD 747-400 385 40 20347 31 3 21 2' TO lt_lines. + APPEND 'AZ 0555 20171219 185 EUR 737-800 140 133 32143 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180309 185 EUR 737-800 140 137 32595 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180528 185 EUR 737-800 140 134 31899 12 11 10 10' TO lt_lines. + APPEND 'AZ 0555 20180816 185 EUR 737-800 140 128 29775 12 10 10 9' TO lt_lines. + APPEND 'AZ 0555 20181104 185 EUR 737-800 140 0 0 12 0 10 0' TO lt_lines. + APPEND 'AZ 0555 20190123 185 EUR 737-800 140 23 5392 12 1 10 2' TO lt_lines. + APPEND 'AZ 0789 20171219 1030 EUR 767-200 260 250 307176 21 20 11 11' TO lt_lines. + APPEND 'AZ 0789 20180309 1030 EUR 767-200 260 252 306054 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180528 1030 EUR 767-200 260 252 307063 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180816 1030 EUR 767-200 260 249 300739 21 19 11 10' TO lt_lines. + APPEND 'AZ 0789 20181104 1030 EUR 767-200 260 104 127647 21 8 11 5' TO lt_lines. + APPEND 'AZ 0789 20190123 1030 EUR 767-200 260 18 22268 21 1 11 1' TO lt_lines. + APPEND 'DL 0106 20171217 611 USD A380-800 475 458 324379 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180307 611 USD A380-800 475 458 324330 30 30 20 20' TO lt_lines. + APPEND 'DL 0106 20180526 611 USD A380-800 475 459 328149 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180814 611 USD A380-800 475 462 326805 30 30 20 18' TO lt_lines. + APPEND 'DL 0106 20181102 611 USD A380-800 475 167 115554 30 10 20 6' TO lt_lines. + APPEND 'DL 0106 20190121 611 USD A380-800 475 11 9073 30 1 20 1' TO lt_lines. + LOOP AT lt_lines INTO lv_line. + CONDENSE lv_line. + SPLIT lv_line AT space INTO TABLE lt_fields. + lv_comp = 2. + LOOP AT lt_fields INTO lv_field. + ASSIGN COMPONENT lv_comp OF STRUCTURE ls_test TO . + = lv_field. + lv_comp = lv_comp + 1. + ENDLOOP. + APPEND ls_test TO ct_test. + ENDLOOP. +ENDFORM. diff --git a/src/demos/zdemo_excel22.w3mi.data.xlsx b/src/demos/zdemo_excel22.w3mi.data.xlsx new file mode 100644 index 0000000..7563222 Binary files /dev/null and b/src/demos/zdemo_excel22.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel22.w3mi.xml b/src/demos/zdemo_excel22.w3mi.xml new file mode 100644 index 0000000..0581427 --- /dev/null +++ b/src/demos/zdemo_excel22.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL22 + 22_itab_fieldcatalog.xlsx (ZDEMO_EXCEL22) + + + MI + ZDEMO_EXCEL22 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL22 + filename + 22_itab_fieldcatalog.xlsx + + + MI + ZDEMO_EXCEL22 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel23.w3mi.data.xlsx b/src/demos/zdemo_excel23.w3mi.data.xlsx new file mode 100644 index 0000000..b40052e Binary files /dev/null and b/src/demos/zdemo_excel23.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel23.w3mi.xml b/src/demos/zdemo_excel23.w3mi.xml new file mode 100644 index 0000000..ee1376d --- /dev/null +++ b/src/demos/zdemo_excel23.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL23 + 23_Sheets_with_and_without_grid_lines.xlsx (ZDEMO_EXCEL23) + + + MI + ZDEMO_EXCEL23 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL23 + filename + + + MI + ZDEMO_EXCEL23 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel24.prog.abap b/src/demos/zdemo_excel24.prog.abap index c82e2a0..2bdee7f 100644 --- a/src/demos/zdemo_excel24.prog.abap +++ b/src/demos/zdemo_excel24.prog.abap @@ -22,6 +22,8 @@ DATA: lv_full_path TYPE string, lv_file_separator TYPE c. DATA: lv_value TYPE string. +DATA: lv_date TYPE d VALUE '19000226', + lv_row TYPE i. CONSTANTS: gc_save_file_name TYPE string VALUE '24_Sheets_with_different_default_date_formats.xlsx'. INCLUDE zdemo_excel_outputopt_incl. @@ -36,9 +38,9 @@ START-OF-SELECTION. lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'Sheet1' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Default Date Format' ). - " Insert current date - lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Current Date:' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = sy-datum ). + " Insert date + lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Date:' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = lv_date ). lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet2!A1' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 6 ip_value = 'This is a link to the second sheet' ip_hyperlink = lo_hyperlink ). @@ -52,8 +54,8 @@ START-OF-SELECTION. lo_worksheet->set_title( ip_title = 'Sheet2' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Date Format set to YYYYMMDD' ). " Insert current date - lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Current Date:' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = sy-datum ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Date:' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = lv_date ). lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet3!B2' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 6 ip_value = 'This is link to the third sheet' ip_hyperlink = lo_hyperlink ). @@ -66,8 +68,8 @@ START-OF-SELECTION. lo_worksheet->set_title( ip_title = 'Sheet3' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Date Format set to YYYY/MM/DD' ). " Insert current date - lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Current Date:' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = sy-datum ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Date:' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = lv_date ). lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet4!B2' ). lo_worksheet->set_cell( ip_column = 'A' ip_row = 6 ip_value = 'This is link to the 4th sheet' ip_hyperlink = lo_hyperlink ). @@ -81,8 +83,6 @@ START-OF-SELECTION. " Loop from Start Date to the Max Date current data in daily steps CONSTANTS: lv_max TYPE d VALUE '19000302'. - DATA: lv_date TYPE d VALUE '19000226', - lv_row TYPE i. lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'Formated date' ). lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Integer value for this date' ). lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = 'Date as string' ). diff --git a/src/demos/zdemo_excel24.w3mi.data.xlsx b/src/demos/zdemo_excel24.w3mi.data.xlsx new file mode 100644 index 0000000..7b632a8 Binary files /dev/null and b/src/demos/zdemo_excel24.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel24.w3mi.xml b/src/demos/zdemo_excel24.w3mi.xml new file mode 100644 index 0000000..62abb7e --- /dev/null +++ b/src/demos/zdemo_excel24.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL24 + 24_Sheets_with_different_default_date_formats.xlsx (ZDEMO_EXCEL24) + + + MI + ZDEMO_EXCEL24 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL24 + filename + + + MI + ZDEMO_EXCEL24 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel27.w3mi.data.xlsx b/src/demos/zdemo_excel27.w3mi.data.xlsx new file mode 100644 index 0000000..aa3953d Binary files /dev/null and b/src/demos/zdemo_excel27.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel27.w3mi.xml b/src/demos/zdemo_excel27.w3mi.xml new file mode 100644 index 0000000..07fbac9 --- /dev/null +++ b/src/demos/zdemo_excel27.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL27 + 27_ConditionalFormatting.xlsx (ZDEMO_EXCEL27) + + + MI + ZDEMO_EXCEL27 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL27 + filename + + + MI + ZDEMO_EXCEL27 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel3.prog.abap b/src/demos/zdemo_excel3.prog.abap index 0cf5560..c51bb05 100644 --- a/src/demos/zdemo_excel3.prog.abap +++ b/src/demos/zdemo_excel3.prog.abap @@ -8,6 +8,8 @@ REPORT zdemo_excel3. +TYPES: ty_sflight_lines TYPE TABLE OF sflight. + DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_column TYPE REF TO zcl_excel_column. @@ -31,6 +33,7 @@ CONSTANTS: gc_save_file_name TYPE string VALUE '03_iTab.xlsx'. INCLUDE zdemo_excel_outputopt_incl. PARAMETERS: p_empty TYPE flag. +PARAMETERS: p_checkr NO-DISPLAY TYPE abap_bool. START-OF-SELECTION. " Creates active sheet @@ -40,10 +43,14 @@ START-OF-SELECTION. lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'Internal table' ). - DATA lt_test TYPE TABLE OF sflight. + DATA lt_test TYPE ty_sflight_lines. IF p_empty <> abap_true. - SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + IF p_checkr = abap_true. + PERFORM load_fixed_data_for_checker CHANGING lt_test. + ELSE. + SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + ENDIF. ENDIF. ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2. @@ -93,3 +100,51 @@ START-OF-SELECTION. *** Create output lcl_output=>output( lo_excel ). + + + +FORM load_fixed_data_for_checker CHANGING ct_test TYPE ty_sflight_lines. + DATA: lt_lines TYPE TABLE OF string, + lv_line TYPE string, + lt_fields TYPE TABLE OF string, + lv_comp TYPE i, + lv_field TYPE string, + ls_test TYPE sflight. + FIELD-SYMBOLS: TYPE simple. + + APPEND 'AA 0017 20171219 422 USD 747-400 385 371 191334 31 28 21 21' TO lt_lines. + APPEND 'AA 0017 20180309 422 USD 747-400 385 365 189984 31 29 21 20' TO lt_lines. + APPEND 'AA 0017 20180528 422 USD 747-400 385 374 193482 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20180816 422 USD 747-400 385 372 193127 31 30 21 20' TO lt_lines. + APPEND 'AA 0017 20181104 422 USD 747-400 385 44 23908 31 4 21 3' TO lt_lines. + APPEND 'AA 0017 20190123 422 USD 747-400 385 40 20347 31 3 21 2' TO lt_lines. + APPEND 'AZ 0555 20171219 185 EUR 737-800 140 133 32143 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180309 185 EUR 737-800 140 137 32595 12 12 10 10' TO lt_lines. + APPEND 'AZ 0555 20180528 185 EUR 737-800 140 134 31899 12 11 10 10' TO lt_lines. + APPEND 'AZ 0555 20180816 185 EUR 737-800 140 128 29775 12 10 10 9' TO lt_lines. + APPEND 'AZ 0555 20181104 185 EUR 737-800 140 0 0 12 0 10 0' TO lt_lines. + APPEND 'AZ 0555 20190123 185 EUR 737-800 140 23 5392 12 1 10 2' TO lt_lines. + APPEND 'AZ 0789 20171219 1030 EUR 767-200 260 250 307176 21 20 11 11' TO lt_lines. + APPEND 'AZ 0789 20180309 1030 EUR 767-200 260 252 306054 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180528 1030 EUR 767-200 260 252 307063 21 20 11 10' TO lt_lines. + APPEND 'AZ 0789 20180816 1030 EUR 767-200 260 249 300739 21 19 11 10' TO lt_lines. + APPEND 'AZ 0789 20181104 1030 EUR 767-200 260 104 127647 21 8 11 5' TO lt_lines. + APPEND 'AZ 0789 20190123 1030 EUR 767-200 260 18 22268 21 1 11 1' TO lt_lines. + APPEND 'DL 0106 20171217 611 USD A380-800 475 458 324379 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180307 611 USD A380-800 475 458 324330 30 30 20 20' TO lt_lines. + APPEND 'DL 0106 20180526 611 USD A380-800 475 459 328149 30 29 20 20' TO lt_lines. + APPEND 'DL 0106 20180814 611 USD A380-800 475 462 326805 30 30 20 18' TO lt_lines. + APPEND 'DL 0106 20181102 611 USD A380-800 475 167 115554 30 10 20 6' TO lt_lines. + APPEND 'DL 0106 20190121 611 USD A380-800 475 11 9073 30 1 20 1' TO lt_lines. + LOOP AT lt_lines INTO lv_line. + CONDENSE lv_line. + SPLIT lv_line AT space INTO TABLE lt_fields. + lv_comp = 2. + LOOP AT lt_fields INTO lv_field. + ASSIGN COMPONENT lv_comp OF STRUCTURE ls_test TO . + = lv_field. + lv_comp = lv_comp + 1. + ENDLOOP. + APPEND ls_test TO ct_test. + ENDLOOP. +ENDFORM. diff --git a/src/demos/zdemo_excel3.w3mi.data.xlsx b/src/demos/zdemo_excel3.w3mi.data.xlsx new file mode 100644 index 0000000..26e3c8a Binary files /dev/null and b/src/demos/zdemo_excel3.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel3.w3mi.xml b/src/demos/zdemo_excel3.w3mi.xml new file mode 100644 index 0000000..051eff5 --- /dev/null +++ b/src/demos/zdemo_excel3.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL3 + 03_iTab.xlsx (ZDEMO_EXCEL3) + + + MI + ZDEMO_EXCEL3 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL3 + filename + + + MI + ZDEMO_EXCEL3 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel30.w3mi.data.xlsx b/src/demos/zdemo_excel30.w3mi.data.xlsx new file mode 100644 index 0000000..6b72db7 Binary files /dev/null and b/src/demos/zdemo_excel30.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel30.w3mi.xml b/src/demos/zdemo_excel30.w3mi.xml new file mode 100644 index 0000000..23cc940 --- /dev/null +++ b/src/demos/zdemo_excel30.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL30 + 30_CellDataTypes.xlsx (ZDEMO_EXCEL30) + + + MI + ZDEMO_EXCEL30 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL30 + filename + 30_CellDataTypes.xlsx + + + MI + ZDEMO_EXCEL30 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel31.w3mi.data.xlsx b/src/demos/zdemo_excel31.w3mi.data.xlsx new file mode 100644 index 0000000..f1abee1 Binary files /dev/null and b/src/demos/zdemo_excel31.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel31.w3mi.xml b/src/demos/zdemo_excel31.w3mi.xml new file mode 100644 index 0000000..56cecb6 --- /dev/null +++ b/src/demos/zdemo_excel31.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL31 + 31_AutosizeWithDifferentFontSizes.xlsx (ZDEMO_EXCEL31) + + + MI + ZDEMO_EXCEL31 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL31 + filename + 31_AutosizeWithDifferentFontSizes.xlsx + + + MI + ZDEMO_EXCEL31 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel33.prog.abap b/src/demos/zdemo_excel33.prog.abap index 29a8970..adfe106 100644 --- a/src/demos/zdemo_excel33.prog.abap +++ b/src/demos/zdemo_excel33.prog.abap @@ -8,12 +8,14 @@ REPORT zdemo_excel33. +TYPES: ty_t005t_lines TYPE TABLE OF t005t. + DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_converter TYPE REF TO zcl_excel_converter, lo_autofilter TYPE REF TO zcl_excel_autofilter. -DATA lt_test TYPE TABLE OF t005t. +DATA lt_test TYPE ty_t005t_lines. DATA: l_cell_value TYPE zexcel_cell_value, ls_area TYPE zexcel_s_autofilter_area. @@ -33,7 +35,7 @@ START-OF-SELECTION. lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'Internal table' ). - SELECT * UP TO 2 ROWS FROM t005t INTO TABLE lt_test. "#EC CI_NOWHERE + PERFORM load_fixed_data CHANGING lt_test. CREATE OBJECT lo_converter. @@ -65,3 +67,30 @@ START-OF-SELECTION. *** Create output lcl_output=>output( lo_excel ). + + +FORM load_fixed_data CHANGING ct_test TYPE ty_t005t_lines. + DATA: lt_lines TYPE TABLE OF string, + lv_line TYPE string, + lt_fields TYPE TABLE OF string, + lv_comp TYPE i, + lv_field TYPE string, + ls_test TYPE t005t. + FIELD-SYMBOLS: TYPE simple. + + APPEND '001 E AD Andorra Andorran Andorra Andorran ' TO lt_lines. + APPEND '001 E BE Belgium Belgian Belgium Belgian ' TO lt_lines. + APPEND '001 E DE Germany German Germany German ' TO lt_lines. + APPEND '001 E FM Micronesia Micronesian Micronesia Micronesian' TO lt_lines. + LOOP AT lt_lines INTO lv_line. + CONDENSE lv_line. + SPLIT lv_line AT space INTO TABLE lt_fields. + lv_comp = 1. + LOOP AT lt_fields INTO lv_field. + ASSIGN COMPONENT lv_comp OF STRUCTURE ls_test TO . + = lv_field. + lv_comp = lv_comp + 1. + ENDLOOP. + APPEND ls_test TO ct_test. + ENDLOOP. +ENDFORM. diff --git a/src/demos/zdemo_excel33.w3mi.data.xlsx b/src/demos/zdemo_excel33.w3mi.data.xlsx new file mode 100644 index 0000000..bec0a54 Binary files /dev/null and b/src/demos/zdemo_excel33.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel33.w3mi.xml b/src/demos/zdemo_excel33.w3mi.xml new file mode 100644 index 0000000..92bdb7b --- /dev/null +++ b/src/demos/zdemo_excel33.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL33 + 33_autofilter.xlsx (ZDEMO_EXCEL33) + + + MI + ZDEMO_EXCEL33 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL33 + filename + 33_autofilter.xlsx + + + MI + ZDEMO_EXCEL33 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel34.w3mi.data.xlsx b/src/demos/zdemo_excel34.w3mi.data.xlsx new file mode 100644 index 0000000..f58ce2a Binary files /dev/null and b/src/demos/zdemo_excel34.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel34.w3mi.xml b/src/demos/zdemo_excel34.w3mi.xml new file mode 100644 index 0000000..9231c49 --- /dev/null +++ b/src/demos/zdemo_excel34.w3mi.xml @@ -0,0 +1,29 @@ + + + + + ZDEMO_EXCEL34 + 34_Static Styles_Chess.xlsx (ZDEMO_EXCEL34) + + + MI + ZDEMO_EXCEL34 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL34 + filename + 34_Static Styles_Chess.xlsx + + + MI + ZDEMO_EXCEL34 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel35.w3mi.data.xlsx b/src/demos/zdemo_excel35.w3mi.data.xlsx new file mode 100644 index 0000000..252a5a4 Binary files /dev/null and b/src/demos/zdemo_excel35.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel35.w3mi.xml b/src/demos/zdemo_excel35.w3mi.xml new file mode 100644 index 0000000..63f55ff --- /dev/null +++ b/src/demos/zdemo_excel35.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL35 + 35_Static_Styles.xlsx (ZDEMO_EXCEL35) + + + MI + ZDEMO_EXCEL35 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL35 + filename + + + MI + ZDEMO_EXCEL35 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel36.w3mi.data.xlsx b/src/demos/zdemo_excel36.w3mi.data.xlsx new file mode 100644 index 0000000..5f98556 Binary files /dev/null and b/src/demos/zdemo_excel36.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel36.w3mi.xml b/src/demos/zdemo_excel36.w3mi.xml new file mode 100644 index 0000000..416430d --- /dev/null +++ b/src/demos/zdemo_excel36.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL36 + 36_DefaultStyles.xlsx (ZDEMO_EXCEL36) + + + MI + ZDEMO_EXCEL36 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL36 + filename + + + MI + ZDEMO_EXCEL36 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel38.w3mi.data.xlsx b/src/demos/zdemo_excel38.w3mi.data.xlsx new file mode 100644 index 0000000..a07e3b8 Binary files /dev/null and b/src/demos/zdemo_excel38.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel38.w3mi.xml b/src/demos/zdemo_excel38.w3mi.xml new file mode 100644 index 0000000..6a7b0e0 --- /dev/null +++ b/src/demos/zdemo_excel38.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL38 + 38_SAP-Icons.xlsx (ZDEMO_EXCEL38) + + + MI + ZDEMO_EXCEL38 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL38 + filename + + + MI + ZDEMO_EXCEL38 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel39.w3mi.data.xlsx b/src/demos/zdemo_excel39.w3mi.data.xlsx new file mode 100644 index 0000000..a637b64 Binary files /dev/null and b/src/demos/zdemo_excel39.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel39.w3mi.xml b/src/demos/zdemo_excel39.w3mi.xml new file mode 100644 index 0000000..b3712b4 --- /dev/null +++ b/src/demos/zdemo_excel39.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL39 + 39_Charts.xlsx (ZDEMO_EXCEL39) + + + MI + ZDEMO_EXCEL39 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL39 + filename + + + MI + ZDEMO_EXCEL39 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel4.w3mi.data.xlsx b/src/demos/zdemo_excel4.w3mi.data.xlsx new file mode 100644 index 0000000..d067608 Binary files /dev/null and b/src/demos/zdemo_excel4.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel4.w3mi.xml b/src/demos/zdemo_excel4.w3mi.xml new file mode 100644 index 0000000..4e46475 --- /dev/null +++ b/src/demos/zdemo_excel4.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL4 + 04_Sheets.xlsx (ZDEMO_EXCEL4) + + + MI + ZDEMO_EXCEL4 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL4 + filename + + + MI + ZDEMO_EXCEL4 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel40.w3mi.data.xlsx b/src/demos/zdemo_excel40.w3mi.data.xlsx new file mode 100644 index 0000000..71898fb Binary files /dev/null and b/src/demos/zdemo_excel40.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel40.w3mi.xml b/src/demos/zdemo_excel40.w3mi.xml new file mode 100644 index 0000000..dc1e135 --- /dev/null +++ b/src/demos/zdemo_excel40.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL40 + 40_Printsettings.xlsx (ZDEMO_EXCEL40) + + + MI + ZDEMO_EXCEL40 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL40 + filename + + + MI + ZDEMO_EXCEL40 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel5.w3mi.data.xlsx b/src/demos/zdemo_excel5.w3mi.data.xlsx new file mode 100644 index 0000000..54b0071 Binary files /dev/null and b/src/demos/zdemo_excel5.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel5.w3mi.xml b/src/demos/zdemo_excel5.w3mi.xml new file mode 100644 index 0000000..a388f8a --- /dev/null +++ b/src/demos/zdemo_excel5.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL5 + 05_Conditional.xlsx (ZDEMO_EXCEL5) + + + MI + ZDEMO_EXCEL5 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL5 + filename + + + MI + ZDEMO_EXCEL5 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel6.w3mi.data.xlsx b/src/demos/zdemo_excel6.w3mi.data.xlsx new file mode 100644 index 0000000..6ff9a2f Binary files /dev/null and b/src/demos/zdemo_excel6.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel6.w3mi.xml b/src/demos/zdemo_excel6.w3mi.xml new file mode 100644 index 0000000..dafc22d --- /dev/null +++ b/src/demos/zdemo_excel6.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL6 + 06_Formulas.xlsx (ZDEMO_EXCEL6) + + + MI + ZDEMO_EXCEL6 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL6 + filename + + + MI + ZDEMO_EXCEL6 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel7.w3mi.data.xlsx b/src/demos/zdemo_excel7.w3mi.data.xlsx new file mode 100644 index 0000000..1c86578 Binary files /dev/null and b/src/demos/zdemo_excel7.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel7.w3mi.xml b/src/demos/zdemo_excel7.w3mi.xml new file mode 100644 index 0000000..56060f7 --- /dev/null +++ b/src/demos/zdemo_excel7.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL7 + 07_ConditionalAll.xlsx (ZDEMO_EXCEL7) + + + MI + ZDEMO_EXCEL7 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL7 + filename + + + MI + ZDEMO_EXCEL7 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel8.w3mi.data.xlsx b/src/demos/zdemo_excel8.w3mi.data.xlsx new file mode 100644 index 0000000..ddd4fed Binary files /dev/null and b/src/demos/zdemo_excel8.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel8.w3mi.xml b/src/demos/zdemo_excel8.w3mi.xml new file mode 100644 index 0000000..d9f1415 --- /dev/null +++ b/src/demos/zdemo_excel8.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL8 + 08_Range.xlsx (ZDEMO_EXCEL8) + + + MI + ZDEMO_EXCEL8 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL8 + filename + + + MI + ZDEMO_EXCEL8 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel9.w3mi.data.xlsx b/src/demos/zdemo_excel9.w3mi.data.xlsx new file mode 100644 index 0000000..b51b6a0 Binary files /dev/null and b/src/demos/zdemo_excel9.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel9.w3mi.xml b/src/demos/zdemo_excel9.w3mi.xml new file mode 100644 index 0000000..eb6616c --- /dev/null +++ b/src/demos/zdemo_excel9.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL9 + 09_DataValidation.xlsx (ZDEMO_EXCEL9) + + + MI + ZDEMO_EXCEL9 + fileextension + .xlsx + + + MI + ZDEMO_EXCEL9 + filename + + + MI + ZDEMO_EXCEL9 + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/zdemo_excel_checker.prog.abap b/src/demos/zdemo_excel_checker.prog.abap new file mode 100644 index 0000000..36df336 --- /dev/null +++ b/src/demos/zdemo_excel_checker.prog.abap @@ -0,0 +1,1384 @@ +*&---------------------------------------------------------------------* +*& Report zdemo_excel_checker +*&---------------------------------------------------------------------* +*& +*&---------------------------------------------------------------------* +REPORT zdemo_excel_checker. + +CLASS lcl_zip_cleanup_for_diff DEFINITION + CREATE PUBLIC . + + PUBLIC SECTION. + + TYPES : BEGIN OF ty_zip_structure, + ref_to_structure TYPE REF TO data, + ref_to_x TYPE REF TO data, + length TYPE i, + view TYPE REF TO cl_abap_view_offlen, + charset_bit TYPE i, + conv_in_utf8 TYPE REF TO cl_abap_conv_in_ce, + conv_in_ibm437 TYPE REF TO cl_abap_conv_in_ce, + conv_out_utf8 TYPE REF TO cl_abap_conv_out_ce, + conv_out_ibm437 TYPE REF TO cl_abap_conv_out_ce, + END OF ty_zip_structure. + + METHODS run + IMPORTING + zip_xstring TYPE xstring + RETURNING + VALUE(result) TYPE xstring + RAISING + zcx_excel. + + PRIVATE SECTION. + + METHODS init_structure + IMPORTING + length TYPE i + charset_bit TYPE i + structure TYPE any + RETURNING + VALUE(result) TYPE ty_zip_structure. + + METHODS write_zip + IMPORTING + offset TYPE i + CHANGING + zip_structure TYPE ty_zip_structure + zip_xstring TYPE xstring. + + METHODS read_zip + IMPORTING + zip_xstring TYPE xstring + offset TYPE i + CHANGING + zip_structure TYPE ty_zip_structure. + +ENDCLASS. + + +CLASS lcl_xlsx_cleanup_for_diff DEFINITION + CREATE PUBLIC . + + PUBLIC SECTION. + + METHODS run + IMPORTING + xstring TYPE xstring + + RETURNING + VALUE(result) TYPE xstring + RAISING + zcx_excel. + +ENDCLASS. + + +CLASS lcl_app DEFINITION. + + PUBLIC SECTION. + + METHODS at_selection_screen. + + METHODS at_selection_screen_on_exit. + + METHODS at_selection_screen_output. + + METHODS set_sscrfields + CHANGING + sscrfields TYPE sscrfields. + + PRIVATE SECTION. + + TYPES : BEGIN OF ty_demo, + program TYPE trdir-name, + objid TYPE wwwdata-objid, + text TYPE wwwdata-text, + filename TYPE string, + END OF ty_demo, + ty_demos TYPE STANDARD TABLE OF ty_demo WITH DEFAULT KEY, + BEGIN OF ty_check_result, + diff TYPE abap_bool, + xlsx_just_now TYPE xstring, + xlsx_reference TYPE xstring, + compare_xlsx_just_now TYPE xstring, + compare_xlsx_reference TYPE xstring, + END OF ty_check_result, + BEGIN OF ty_alv_line, + status_icon TYPE string, + xlsx_diff TYPE string, + write_smw0 TYPE string, + objid TYPE wwwdata-objid, + obj_text TYPE wwwdata-text, + program TYPE trdir-name, + prog_text TYPE trdirt-text, + filename TYPE string, + xlsx_just_now TYPE xstring, + xlsx_reference TYPE xstring, + compare_xlsx_just_now TYPE xstring, + compare_xlsx_reference TYPE xstring, + cell_types TYPE salv_t_int4_column, + END OF ty_alv_line, + ty_alv_table TYPE STANDARD TABLE OF ty_alv_line WITH DEFAULT KEY, + ty_popup_confirm_question TYPE c LENGTH 400. + + METHODS at_selection_screen_output1000. + + METHODS at_selection_screen_output1001 + RAISING + zcx_excel + cx_salv_data_error + cx_salv_not_found + cx_salv_msg. + + METHODS check_regression + IMPORTING + demo TYPE ty_demo + RETURNING + VALUE(result) TYPE ty_check_result + RAISING + zcx_excel. + + METHODS get_list_of_demo_files + RETURNING + VALUE(result) TYPE ty_demos. + + METHODS gui_upload + IMPORTING + file_name TYPE string + RETURNING + VALUE(result) TYPE xstring + RAISING + zcx_excel. + + METHODS load_alv_table + RAISING + zcx_excel. + + METHODS on_link_clicked FOR EVENT link_click OF cl_salv_events_table IMPORTING column row. + + METHODS popup_confirm + IMPORTING + question TYPE ty_popup_confirm_question + RAISING + zcx_excel. + + METHODS read_screen_fields. + + METHODS read_xlsx_from_web_repository + IMPORTING + objid TYPE wwwdata-objid + RETURNING + VALUE(result) TYPE xstring + RAISING + zcx_excel. + + METHODS screen_1001_pbo_first_time + RAISING + cx_salv_data_error + cx_salv_msg + cx_salv_not_found + zcx_excel . + + METHODS write_screen_fields. + + METHODS write_xlsx_to_web_repository + IMPORTING + objid TYPE wwwdata-objid + text TYPE wwwdata-text + xstring TYPE xstring + filename TYPE clike + RAISING + zcx_excel. + + DATA: ref_sscrfields TYPE REF TO sscrfields, + p_path TYPE zexcel_export_dir, + splitter TYPE REF TO cl_gui_splitter_container, + alv_container TYPE REF TO cl_gui_container, + zip_diff_container TYPE REF TO cl_gui_container, + viewer TYPE REF TO object, + salv TYPE REF TO cl_salv_table, + alv_table TYPE ty_alv_table, + lv_filesep TYPE c LENGTH 1. + +ENDCLASS. + + + +CLASS lcl_zip_cleanup_for_diff IMPLEMENTATION. + + + METHOD run. + + TYPES : BEGIN OF ty_local_file_header, + local_file_header_signature TYPE x LENGTH 4, " 04034b50 + version_needed_to_extract TYPE x LENGTH 2, + general_purpose_bit_flag TYPE x LENGTH 2, + compression_method TYPE x LENGTH 2, + last_mod_file_time TYPE int2, + last_mod_file_date TYPE int2, + crc_32 TYPE x LENGTH 4, + compressed_size TYPE i, + uncompressed_size TYPE i, + file_name_length TYPE int2, + extra_field_length TYPE int2, + " file name (variable size) + " extra field (variable size) + END OF ty_local_file_header, + BEGIN OF ty_central_file_header, + central_file_header_signature TYPE x LENGTH 4, " 02014b50 + version_made_by TYPE x LENGTH 2, + version_needed_to_extract TYPE x LENGTH 2, + general_purpose_bit_flag TYPE x LENGTH 2, + compression_method TYPE x LENGTH 2, + last_mod_file_time TYPE int2, + last_mod_file_date TYPE int2, + crc_32 TYPE x LENGTH 4, + compressed_size TYPE i, + uncompressed_size TYPE i, + file_name_length TYPE int2, " field 12 + extra_field_length TYPE int2, " field 13 + file_comment_length TYPE int2, " field 14 + disk_number_start TYPE int2, + internal_file_attributes TYPE x LENGTH 2, + external_file_attributes TYPE x LENGTH 4, + rel_offset_of_local_header TYPE x LENGTH 4, + " file name (variable size defined in 12) + " extra field (variable size defined in 13) + " file comment (variable size defined in 14) + END OF ty_central_file_header, + BEGIN OF ty_end_of_central_dir, + signature TYPE x LENGTH 4, " 0x06054b50 + number_of_this_disk TYPE int2, + disk_num_start_of_central_dir TYPE int2, + n_of_entries_in_central_dir_dk TYPE int2, + n_of_entries_in_central_dir TYPE int2, + size_of_central_dir TYPE i, + offset_start_of_central_dir TYPE i, + file_comment_length TYPE int2, + END OF ty_end_of_central_dir. + + FIELD-SYMBOLS: + TYPE x, + TYPE x, + TYPE x, + TYPE ty_local_file_header, + TYPE ty_central_file_header, + TYPE ty_end_of_central_dir. + CONSTANTS: + local_file_header_signature TYPE x LENGTH 4 VALUE '504B0304', + central_file_header_signature TYPE x LENGTH 4 VALUE '504B0102', + end_of_central_dir_signature TYPE x LENGTH 4 VALUE '504B0506'. + DATA: + dummy_local_file_header TYPE ty_local_file_header, + dummy_central_file_header TYPE ty_central_file_header, + dummy_end_of_central_dir TYPE ty_end_of_central_dir, + local_file_header TYPE ty_zip_structure, + central_file_header TYPE ty_zip_structure, + end_of_central_dir TYPE ty_zip_structure, + offset TYPE i, + max_offset TYPE i. + + + + local_file_header = init_structure( length = 30 charset_bit = 60 structure = dummy_local_file_header ). + ASSIGN local_file_header-ref_to_structure->* TO . + ASSIGN local_file_header-ref_to_x->* TO . + + central_file_header = init_structure( length = 46 charset_bit = 76 structure = dummy_central_file_header ). + ASSIGN central_file_header-ref_to_structure->* TO . + ASSIGN central_file_header-ref_to_x->* TO . + + end_of_central_dir = init_structure( length = 22 charset_bit = 0 structure = dummy_end_of_central_dir ). + ASSIGN end_of_central_dir-ref_to_structure->* TO . + ASSIGN end_of_central_dir-ref_to_x->* TO . + + result = zip_xstring. + + offset = 0. + max_offset = xstrlen( result ) - 4. + WHILE offset <= max_offset. + + CASE result+offset(4). + + WHEN local_file_header_signature. + + read_zip( EXPORTING zip_xstring = result offset = offset CHANGING zip_structure = local_file_header ). + + CLEAR -last_mod_file_date. + CLEAR -last_mod_file_time. + + write_zip( EXPORTING offset = offset CHANGING zip_structure = local_file_header zip_xstring = result ). + + offset = offset + local_file_header-length + -file_name_length + -extra_field_length + -compressed_size. + + WHEN central_file_header_signature. + + read_zip( EXPORTING zip_xstring = result offset = offset CHANGING zip_structure = central_file_header ). + + CLEAR -last_mod_file_date. + CLEAR -last_mod_file_time. + + write_zip( EXPORTING offset = offset CHANGING zip_structure = central_file_header zip_xstring = result ). + + offset = offset + central_file_header-length + -file_name_length + -extra_field_length + -file_comment_length. + + WHEN end_of_central_dir_signature. + + read_zip( EXPORTING zip_xstring = result offset = offset CHANGING zip_structure = end_of_central_dir ). + + offset = offset + end_of_central_dir-length + -file_comment_length. + + WHEN OTHERS. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Invalid ZIP file'. + + ENDCASE. + + ENDWHILE. + + ENDMETHOD. + + + METHOD init_structure. + + DATA: + offset TYPE i, + rtts_struct TYPE REF TO cl_abap_structdescr. + FIELD-SYMBOLS: + TYPE abap_compdescr. + + CREATE DATA result-ref_to_structure LIKE structure. + result-length = length. + result-charset_bit = charset_bit. + CREATE DATA result-ref_to_x TYPE x LENGTH length. + + result-view = cl_abap_view_offlen=>create( ). + offset = 0. + rtts_struct ?= cl_abap_typedescr=>describe_by_data( structure ). + LOOP AT rtts_struct->components ASSIGNING . + result-view->append( off = offset len = -length ). + offset = offset + -length. + ENDLOOP. + + ENDMETHOD. + + + METHOD read_zip. + + DATA: + charset TYPE i. + FIELD-SYMBOLS: + TYPE x, + TYPE any. + + ASSIGN zip_structure-ref_to_x->* TO . + ASSIGN zip_structure-ref_to_structure->* TO . + + = zip_xstring+offset. + + IF zip_structure-charset_bit >= 1. + GET BIT zip_structure-charset_bit OF INTO charset. + ENDIF. + + IF charset = 0. + IF zip_structure-conv_in_ibm437 IS NOT BOUND. + zip_structure-conv_in_ibm437 = cl_abap_conv_in_ce=>create( + encoding = '1107' + endian = 'L' ). + ENDIF. + zip_structure-conv_in_ibm437->convert_struc( + EXPORTING input = + view = zip_structure-view + IMPORTING data = ). + ELSE. + IF zip_structure-conv_in_utf8 IS NOT BOUND. + zip_structure-conv_in_utf8 = cl_abap_conv_in_ce=>create( + encoding = '4110' + endian = 'L' ). + ENDIF. + zip_structure-conv_in_utf8->convert_struc( + EXPORTING input = + view = zip_structure-view + IMPORTING data = ). + ENDIF. + + ENDMETHOD. + + + METHOD write_zip. + + DATA: + charset TYPE i. + FIELD-SYMBOLS: + TYPE x, + TYPE any. + + ASSIGN zip_structure-ref_to_x->* TO . + ASSIGN zip_structure-ref_to_structure->* TO . + + IF zip_structure-charset_bit >= 1. + GET BIT zip_structure-charset_bit OF INTO charset. + ENDIF. + + IF charset = 0. + IF zip_structure-conv_out_ibm437 IS NOT BOUND. + zip_structure-conv_out_ibm437 = cl_abap_conv_out_ce=>create( + encoding = '1107' + endian = 'L' ). + ENDIF. + zip_structure-conv_out_ibm437->convert_struc( + EXPORTING data = + view = zip_structure-view + IMPORTING buffer = ). + ELSE. + IF zip_structure-conv_out_utf8 IS NOT BOUND. + zip_structure-conv_out_utf8 = cl_abap_conv_out_ce=>create( + encoding = '4110' + endian = 'L' ). + ENDIF. + zip_structure-conv_out_utf8->convert_struc( + EXPORTING data = + view = zip_structure-view + IMPORTING buffer = ). + ENDIF. + + REPLACE SECTION OFFSET offset LENGTH zip_structure-length OF zip_xstring WITH IN BYTE MODE. + + ENDMETHOD. + + +ENDCLASS. + + +CLASS lcl_xlsx_cleanup_for_diff IMPLEMENTATION. + + METHOD run. + + TYPES: BEGIN OF ty_docprops_core, + creator TYPE string, + description TYPE string, + last_modified_by TYPE string, + created TYPE string, + modified TYPE string, + END OF ty_docprops_core. + TYPES: BEGIN OF ty_file, + name TYPE string, + content TYPE xstring, + END OF ty_file. + DATA: zip TYPE REF TO cl_abap_zip, + content TYPE xstring, + docprops_core TYPE ty_docprops_core, + ls_file TYPE ty_file, + lt_file TYPE TABLE OF ty_file, + lo_ixml TYPE REF TO if_ixml, + lo_streamfactory TYPE REF TO if_ixml_stream_factory, + lo_istream TYPE REF TO if_ixml_istream, + lo_parser TYPE REF TO if_ixml_parser, + lo_renderer TYPE REF TO if_ixml_renderer, + lo_ostream TYPE REF TO if_ixml_ostream, + lo_document TYPE REF TO if_ixml_document, + lo_element TYPE REF TO if_ixml_element, + lo_filter TYPE REF TO if_ixml_node_filter, + lo_iterator TYPE REF TO if_ixml_node_iterator, + zip_cleanup_for_diff TYPE REF TO lcl_zip_cleanup_for_diff. + FIELD-SYMBOLS: + TYPE cl_abap_zip=>t_file, + TYPE ty_file. + + CREATE OBJECT zip. + zip->load( + EXPORTING + zip = xstring + EXCEPTIONS + zip_parse_error = 1 + OTHERS = 2 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'zip load'. + ENDIF. + + zip->get( + EXPORTING + name = 'docProps/core.xml' + IMPORTING + content = content + EXCEPTIONS + zip_index_error = 1 + zip_decompression_error = 2 + OTHERS = 3 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'docProps/core.xml not found'. + ENDIF. + + CALL TRANSFORMATION zexcel_tr_docprops_core SOURCE XML content RESULT root = docprops_core. + + CLEAR: docprops_core-creator, + docprops_core-description, + docprops_core-created, + docprops_core-modified. + + CALL TRANSFORMATION zexcel_tr_docprops_core SOURCE root = docprops_core RESULT XML content. + + zip->delete( + EXPORTING + name = 'docProps/core.xml' + EXCEPTIONS + zip_index_error = 1 + OTHERS = 2 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |delete before add of docProps/core.xml|. + ENDIF. + + zip->add( + name = 'docProps/core.xml' + content = content ). + + LOOP AT zip->files ASSIGNING + WHERE name CP 'xl/drawings/drawing*.xml'. + + zip->get( + EXPORTING + name = -name + IMPORTING + content = content + EXCEPTIONS + zip_index_error = 1 + zip_decompression_error = 2 + OTHERS = 3 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |{ -name } not found|. + ENDIF. + + lo_ixml = cl_ixml=>create( ). + lo_streamfactory = lo_ixml->create_stream_factory( ). + lo_istream = lo_streamfactory->create_istream_xstring( content ). + lo_document = lo_ixml->create_document( ). + lo_parser = lo_ixml->create_parser( + document = lo_document + istream = lo_istream + stream_factory = lo_streamfactory ). + lo_parser->parse( ). + + lo_filter = lo_document->create_filter_name_ns( + name = 'cNvPr' + namespace = 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing' ). + lo_iterator = lo_document->create_iterator_filtered( lo_filter ). + DO. + lo_element ?= lo_iterator->get_next( ). + IF lo_element IS NOT BOUND. + EXIT. + ENDIF. + lo_element->set_attribute_ns( name = 'name' value = '' ). + ENDDO. + + CLEAR content. + lo_ostream = lo_streamfactory->create_ostream_xstring( content ). + lo_renderer = lo_ixml->create_renderer( + document = lo_document + ostream = lo_ostream ). + lo_renderer->render( ). + + ls_file-name = -name. + ls_file-content = content. + APPEND ls_file TO lt_file. + + ENDLOOP. + + LOOP AT lt_file ASSIGNING . + zip->delete( name = -name ). + zip->add( name = -name content = -content ). + ENDLOOP. + + result = zip->save( ). + + CREATE OBJECT zip_cleanup_for_diff. + result = zip_cleanup_for_diff->run( result ). + + ENDMETHOD. + + +ENDCLASS. + + +CLASS lcl_app IMPLEMENTATION. + + + METHOD at_selection_screen. + + DATA: error TYPE REF TO cx_root. + + TRY. + + CASE sy-dynnr. + + WHEN 1000. + + CASE ref_sscrfields->ucomm. + + WHEN 'ONLI'. + + read_screen_fields( ). + SUBMIT zdemo_excel WITH p_path = p_path WITH p_checkr = abap_true AND RETURN. + CALL SELECTION-SCREEN 1001. + + ENDCASE. + + WHEN 1001. + + CASE ref_sscrfields->ucomm. + + WHEN 'FC01'. " REFRESH + + SUBMIT (sy-repid) WITH p_path = p_path. + + ENDCASE. + ENDCASE. + + CATCH cx_root INTO error. + MESSAGE error TYPE 'E'. + ENDTRY. + + ENDMETHOD. + + + METHOD at_selection_screen_on_exit. + + CASE sy-dynnr. + + WHEN 1001. + + CALL SELECTION-SCREEN 1000. + + ENDCASE. + + ENDMETHOD. + + + METHOD at_selection_screen_output. + + DATA: error TYPE REF TO cx_root. + + TRY. + + CASE sy-dynnr. + + WHEN 1000. + + at_selection_screen_output1000( ). + + WHEN 1001. + + at_selection_screen_output1001( ). + + ENDCASE. + + CATCH cx_root INTO error. + MESSAGE error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + + ENDMETHOD. + + + METHOD at_selection_screen_output1000. + + DATA: lv_workdir TYPE string. + + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_filesep ). + + IF p_path IS INITIAL. + + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + + ENDIF. + + write_screen_fields( ). + + ENDMETHOD. + + + METHOD at_selection_screen_output1001. + + DATA: excluded_functions TYPE ui_functions. + + LOOP AT SCREEN. + screen-active = '0'. + MODIFY SCREEN. + ENDLOOP. + + ref_sscrfields->functxt_01 = icon_refresh. + + APPEND 'ONLI' TO excluded_functions. + APPEND 'PRIN' TO excluded_functions. + APPEND 'SPOS' TO excluded_functions. + CALL FUNCTION 'RS_SET_SELSCREEN_STATUS' + EXPORTING + p_status = sy-pfkey + TABLES + p_exclude = excluded_functions. + + load_alv_table( ). + + IF alv_container IS NOT BOUND. + + screen_1001_pbo_first_time( ). + + ENDIF. + + ENDMETHOD. + + + METHOD check_regression. + + DATA: xlsx_cleanup_for_diff TYPE REF TO lcl_xlsx_cleanup_for_diff. + + + result-xlsx_just_now = gui_upload( file_name = p_path && lv_filesep && demo-filename ). + + result-xlsx_reference = read_xlsx_from_web_repository( objid = demo-objid ). + + IF result-xlsx_reference IS INITIAL. + + result-diff = abap_true. + + ELSE. + + CREATE OBJECT xlsx_cleanup_for_diff. + result-compare_xlsx_just_now = xlsx_cleanup_for_diff->run( result-xlsx_just_now ). + result-compare_xlsx_reference = xlsx_cleanup_for_diff->run( result-xlsx_reference ). + + result-diff = boolc( result-compare_xlsx_just_now <> result-compare_xlsx_reference ). + + ENDIF. + + ENDMETHOD. + + + METHOD get_list_of_demo_files. + + DATA: line TYPE ty_demo. + + line-program = 'ZDEMO_EXCEL1'. + line-objid = 'ZDEMO_EXCEL1'. + line-filename = '01_HelloWorld.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL2'. + line-objid = 'ZDEMO_EXCEL2'. + line-filename = '02_Styles.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL3'. + line-objid = 'ZDEMO_EXCEL3'. + line-filename = '03_iTab.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL4'. + line-objid = 'ZDEMO_EXCEL4'. + line-filename = '04_Sheets.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL5'. + line-objid = 'ZDEMO_EXCEL5'. + line-filename = '05_Conditional.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL6'. + line-objid = 'ZDEMO_EXCEL6'. + line-filename = '06_Formulas.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL7'. + line-objid = 'ZDEMO_EXCEL7'. + line-filename = '07_ConditionalAll.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL8'. + line-objid = 'ZDEMO_EXCEL8'. + line-filename = '08_Range.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL9'. + line-objid = 'ZDEMO_EXCEL9'. + line-filename = '09_DataValidation.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL10'. + line-objid = 'ZDEMO_EXCEL10'. + line-filename = '10_iTabFieldCatalog.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL12'. + line-objid = 'ZDEMO_EXCEL12'. + line-filename = '12_HideSizeOutlineRowsAndColumns.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL13'. + line-objid = 'ZDEMO_EXCEL13'. + line-filename = '13_MergedCells.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL14'. + line-objid = 'ZDEMO_EXCEL14'. + line-filename = '14_Alignment.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL16'. + line-objid = 'ZDEMO_EXCEL16'. + line-filename = '16_Drawings.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL17'. + line-objid = 'ZDEMO_EXCEL17'. + line-filename = '17_SheetProtection.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL18'. + line-objid = 'ZDEMO_EXCEL18'. + line-filename = '18_BookProtection.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL19'. + line-objid = 'ZDEMO_EXCEL19'. + line-filename = '19_SetActiveSheet.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL21'. + line-objid = 'ZDEMO_EXCEL21'. + line-filename = '21_BackgroundColorPicker.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL22'. + line-objid = 'ZDEMO_EXCEL22'. + line-filename = '22_itab_fieldcatalog.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL23'. + line-objid = 'ZDEMO_EXCEL23'. + line-filename = '23_Sheets_with_and_without_grid_lines.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL24'. + line-objid = 'ZDEMO_EXCEL24'. + line-filename = '24_Sheets_with_different_default_date_formats.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL27'. + line-objid = 'ZDEMO_EXCEL27'. + line-filename = '27_ConditionalFormatting.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL30'. + line-objid = 'ZDEMO_EXCEL30'. + line-filename = '30_CellDataTypes.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL31'. + line-objid = 'ZDEMO_EXCEL31'. + line-filename = '31_AutosizeWithDifferentFontSizes.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL33'. + line-objid = 'ZDEMO_EXCEL33'. + line-filename = '33_autofilter.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL34'. + line-objid = 'ZDEMO_EXCEL34'. + line-filename = '34_Static Styles_Chess.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL35'. + line-objid = 'ZDEMO_EXCEL35'. + line-filename = '35_Static_Styles.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL36'. + line-objid = 'ZDEMO_EXCEL36'. + line-filename = '36_DefaultStyles.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL37'. + line-objid = 'ZDEMO_EXCEL37'. + line-filename = '37- Read template and output.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL38'. + line-objid = 'ZDEMO_EXCEL38'. + line-filename = '38_SAP-Icons.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL39'. + line-objid = 'ZDEMO_EXCEL39'. + line-filename = '39_Charts.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL40'. + line-objid = 'ZDEMO_EXCEL40'. + line-filename = '40_Printsettings.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL41'. + line-objid = 'ZDEMO_EXCEL41'. + line-filename = 'ABAP2XLSX Inheritance.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL_COMMENTS'. + line-objid = 'ZDEMO_EXCEL_COMMENTS'. + line-filename = 'Comments.xlsx'. + APPEND line TO result. + line-program = 'ZTEST_EXCEL_IMAGE_HEADER'. + line-objid = 'ZTEST_EXCEL_IMAGE_HEADER'. + line-filename = 'Image_Header_Footer.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_01'. + line-filename = '15_01_HelloWorldFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_02'. + line-filename = '15_02_StylesFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_03'. + line-filename = '15_03_iTabFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_04'. + line-filename = '15_04_SheetsFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_05'. + line-filename = '15_05_ConditionalFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_07'. + line-filename = '15_07_ConditionalAllFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_08'. + line-filename = '15_08_RangeFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_13'. + line-filename = '15_13_MergedCellsFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_24'. + line-filename = '15_24_Sheets_with_different_default_date_formatsFromReader.xlsx'. + APPEND line TO result. + line-program = 'ZDEMO_EXCEL15'. + line-objid = 'ZDEMO_EXCEL15_31'. + line-filename = '15_31_AutosizeWithDifferentFontSizesFromReader.xlsx'. + APPEND line TO result. + + ENDMETHOD. + + + METHOD gui_upload. + + DATA: solix_tab TYPE solix_tab, + file_length TYPE i. + + cl_gui_frontend_services=>gui_upload( + EXPORTING + filename = file_name + filetype = 'BIN' + IMPORTING + filelength = file_length + CHANGING + data_tab = solix_tab + EXCEPTIONS + file_open_error = 1 + file_read_error = 2 + no_batch = 3 + gui_refuse_filetransfer = 4 + invalid_type = 5 + no_authority = 6 + unknown_error = 7 + bad_data_format = 8 + header_not_allowed = 9 + separator_not_allowed = 10 + header_too_long = 11 + unknown_dp_error = 12 + access_denied = 13 + dp_out_of_memory = 14 + disk_full = 15 + dp_timeout = 16 + not_supported_by_gui = 17 + error_no_gui = 18 + OTHERS = 19 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |gui_upload error { file_name }|. + ENDIF. + + result = cl_bcs_convert=>solix_to_xstring( it_solix = solix_tab iv_size = file_length ). + + ENDMETHOD. + + + METHOD load_alv_table. + + DATA: demos TYPE ty_demos, + alv_line TYPE ty_alv_line, + cell_type TYPE salv_s_int4_column, + error TYPE REF TO cx_root, + check_result TYPE ty_check_result. + FIELD-SYMBOLS: + TYPE ty_demo. + + CLEAR alv_table. + + demos = get_list_of_demo_files( ). + LOOP AT demos ASSIGNING . + + TRY. + + CLEAR alv_line. + alv_line-objid = -objid. + alv_line-obj_text = |{ -filename } ({ -program })|. + alv_line-filename = -filename. + alv_line-program = -program. + SELECT SINGLE text FROM trdirt INTO alv_line-prog_text + WHERE sprsl = sy-langu + AND name = alv_line-program. + + check_result = check_regression( ). + + CASE check_result-diff. + WHEN abap_true. + alv_line-status_icon = '@0W\QFiles are different@'. + WHEN abap_false. + alv_line-status_icon = '@0V\QFiles are identical@'. + ENDCASE. + IF check_result-diff = abap_true. + alv_line-xlsx_diff = '@46\QShow differences@'. + alv_line-write_smw0 = '@2L\QSave XLSX to Web Repository@'. + cell_type-columnname = 'XLSX_DIFF'. + cell_type-value = if_salv_c_cell_type=>hotspot. + APPEND cell_type TO alv_line-cell_types. + cell_type-columnname = 'WRITE_SMW0'. + cell_type-value = if_salv_c_cell_type=>hotspot. + APPEND cell_type TO alv_line-cell_types. + ENDIF. + alv_line-xlsx_just_now = check_result-xlsx_just_now. + alv_line-xlsx_reference = check_result-xlsx_reference. + alv_line-compare_xlsx_just_now = check_result-compare_xlsx_just_now. + alv_line-compare_xlsx_reference = check_result-compare_xlsx_reference. + APPEND alv_line TO alv_table. + + CATCH cx_root INTO error. + alv_line-status_icon = |{ icon_cancel }{ error->get_text( ) }|. + ENDTRY. + + ENDLOOP. + + ENDMETHOD. + + + METHOD on_link_clicked. + + DATA: alv_line TYPE ty_alv_line, + error TYPE REF TO cx_root, + zip_old TYPE REF TO cl_abap_zip, + zip_new TYPE REF TO cl_abap_zip, + refresh_stable TYPE lvc_s_stbl, + question TYPE ty_popup_confirm_question. + + TRY. + + READ TABLE alv_table INDEX row INTO alv_line. + ASSERT sy-subrc = 0. + + CASE column. + + WHEN 'XLSX_DIFF'. + + TRY. + IF viewer IS NOT BOUND. + CREATE OBJECT viewer TYPE ('ZCL_ZIP_DIFF_VIEWER2') + EXPORTING + io_container = zip_diff_container. + ENDIF. + + CREATE OBJECT zip_old. + zip_old->load( + EXPORTING + zip = alv_line-compare_xlsx_reference + EXCEPTIONS + zip_parse_error = 1 + OTHERS = 2 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |zip load old { alv_line-obj_text }|. + ENDIF. + + CREATE OBJECT zip_new. + zip_new->load( + EXPORTING + zip = alv_line-compare_xlsx_just_now + EXCEPTIONS + zip_parse_error = 1 + OTHERS = 2 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |zip load new { alv_line-filename }|. + ENDIF. + + CALL METHOD viewer->('DIFF_AND_VIEW') + EXPORTING + zip_old = zip_old + zip_new = zip_new. + + CATCH cx_root INTO error. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |Viewer error (https://github.com/sandraros/zip-diff): { error->get_text( ) }|. + ENDTRY. + + WHEN 'WRITE_SMW0'. + + question = |Are you sure you want to overwrite { alv_line-objid } in Web repository?|. + popup_confirm( question ). + + write_xlsx_to_web_repository( + objid = alv_line-objid + text = alv_line-obj_text + xstring = alv_line-xlsx_just_now + filename = alv_line-filename ). + COMMIT WORK. + + alv_line-status_icon = icon_okay. + CLEAR alv_line-xlsx_diff. + CLEAR alv_line-write_smw0. + CLEAR alv_line-cell_types. + MODIFY alv_table INDEX row FROM alv_line. + + refresh_stable-row = abap_true. + refresh_stable-col = abap_true. + salv->refresh( s_stable = refresh_stable ). + + ENDCASE. + + CATCH cx_root INTO error. + MESSAGE error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + + ENDMETHOD. + + + METHOD popup_confirm. + + DATA: l_answer TYPE c LENGTH 1. + + CALL FUNCTION 'POPUP_TO_CONFIRM' + EXPORTING + text_question = question + IMPORTING + answer = l_answer. "1 = button 1, 2 = button 2, A = cancel + CASE l_answer. + WHEN '2' OR 'A'. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Action cancelled by user'. + ENDCASE. + + ENDMETHOD. + + + METHOD read_xlsx_from_web_repository. + + DATA: query_string TYPE w3query, + query_table TYPE TABLE OF w3query, + html_table TYPE TABLE OF w3html, + return_code TYPE w3param-ret_code, + content_type TYPE w3param-cont_type, + content_length TYPE w3param-cont_len, + mime_table TYPE TABLE OF w3mime. + + CLEAR: query_table, query_string. + query_string-name = '_OBJECT_ID'. + query_string-value = objid. + APPEND query_string TO query_table. + + CALL FUNCTION 'WWW_GET_MIME_OBJECT' + TABLES + query_string = query_table + html = html_table + mime = mime_table + CHANGING + return_code = return_code + content_type = content_type + content_length = content_length + EXCEPTIONS + object_not_found = 1 + parameter_not_found = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'WWW_GET_MIME_OBJECT'. + ENDIF. + + result = cl_bcs_convert=>solix_to_xstring( it_solix = mime_table iv_size = content_length ). + + ENDMETHOD. + + + METHOD read_screen_fields. + + DATA: lt_dummy TYPE TABLE OF rsparams, + lt_sel_255 TYPE TABLE OF rsparamsl_255. + FIELD-SYMBOLS: + TYPE rsparamsl_255. + + CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS' + EXPORTING + curr_report = sy-repid + TABLES + selection_table = lt_dummy + selection_table_255 = lt_sel_255 + EXCEPTIONS + not_found = 1 + no_report = 2 + OTHERS = 3. + + READ TABLE lt_sel_255 WITH KEY selname = 'P_PATH' ASSIGNING . + ASSERT sy-subrc = 0. + p_path = -low. + + ENDMETHOD. + + + METHOD screen_1001_pbo_first_time. + + DATA: columns TYPE REF TO cl_salv_columns_table, + events TYPE REF TO cl_salv_events_table. + + CREATE OBJECT splitter + EXPORTING + parent = cl_gui_container=>screen0 + rows = 1 + columns = 2 + EXCEPTIONS + cntl_error = 1 + cntl_system_error = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'create splitter'. + ENDIF. + + alv_container = splitter->get_container( row = 1 column = 1 ). + zip_diff_container = splitter->get_container( row = 1 column = 2 ). + + cl_salv_table=>factory( + EXPORTING + r_container = alv_container + IMPORTING + r_salv_table = salv + CHANGING + t_table = alv_table ). + + columns = salv->get_columns( ). + columns->set_cell_type_column( value = 'CELL_TYPES' ). + columns->get_column( 'STATUS_ICON' )->set_medium_text( 'Diff status' ). + columns->get_column( 'STATUS_ICON' )->set_output_length( 2 ). + columns->get_column( 'XLSX_DIFF' )->set_medium_text( 'View diff' ). + columns->get_column( 'XLSX_DIFF' )->set_output_length( 5 ). + columns->get_column( 'XLSX_DIFF' )->set_alignment( if_salv_c_alignment=>centered ). + columns->get_column( 'WRITE_SMW0' )->set_medium_text( 'Web repository' ). + columns->get_column( 'WRITE_SMW0' )->set_output_length( 5 ). + columns->get_column( 'WRITE_SMW0' )->set_alignment( if_salv_c_alignment=>centered ). + columns->get_column( 'PROGRAM' )->set_output_length( 15 ). + columns->get_column( 'PROG_TEXT' )->set_output_length( 30 ). + columns->get_column( 'OBJID' )->set_output_length( 20 ). + columns->get_column( 'OBJ_TEXT' )->set_output_length( 50 ). + columns->get_column( 'FILENAME' )->set_output_length( 50 ). + columns->get_column( 'XLSX_JUST_NOW' )->set_technical( ). + columns->get_column( 'XLSX_REFERENCE' )->set_technical( ). +columns->get_column( 'COMPARE_XLSX_JUST_NOW' )->set_technical( ). +columns->get_column( 'COMPARE_XLSX_REFERENCE' )->set_technical( ). + + events = salv->get_event( ). + SET HANDLER on_link_clicked FOR events. + + salv->display( ). + + ENDMETHOD. + + + METHOD set_sscrfields. + + GET REFERENCE OF sscrfields INTO ref_sscrfields. + + ENDMETHOD. + + + METHOD write_screen_fields. + + DATA: fieldname TYPE string. + FIELD-SYMBOLS: + TYPE simple. + + fieldname = |({ sy-repid })P_PATH|. + ASSIGN (fieldname) TO . + = p_path. + + ENDMETHOD. + + + METHOD write_xlsx_to_web_repository. + + DATA: key TYPE wwwdatatab, + mime TYPE TABLE OF w3mime, + devclass TYPE devclass, + wwwparam TYPE wwwparams, + table_of_wwwparams TYPE TABLE OF wwwparams. + + SELECT SINGLE devclass FROM tadir + INTO devclass + WHERE pgmid = 'R3TR' + AND object = 'W3MI' + AND obj_name = objid. + + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |Object must be first created manually|. + ENDIF. + + mime = cl_bcs_convert=>xstring_to_solix( xstring ). + key-relid = 'MI'. + key-objid = objid. + key-chname = sy-uname. + key-text = text. + key-tdate = sy-datum. + key-ttime = sy-uzeit. + + CALL FUNCTION 'WWWDATA_EXPORT' + EXPORTING + key = key + TABLES + mime = mime + EXCEPTIONS + wrong_object_type = 1 + export_error = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'WWWDATA_EXPORT'. + ENDIF. + + wwwparam-relid = 'MI'. + wwwparam-objid = objid. + wwwparam-name = 'mimetype'. + wwwparam-value = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'. + APPEND wwwparam TO table_of_wwwparams. + wwwparam-name = 'filename'. + wwwparam-value = filename. + APPEND wwwparam TO table_of_wwwparams. + wwwparam-name = 'filesize'. + wwwparam-value = |{ xstrlen( xstring ) }|. + APPEND wwwparam TO table_of_wwwparams. + wwwparam-name = 'version'. + wwwparam-value = |00001|. + APPEND wwwparam TO table_of_wwwparams. + wwwparam-name = 'fileextension'. + wwwparam-value = |.xlsx|. + APPEND wwwparam TO table_of_wwwparams. + + CALL FUNCTION 'WWWPARAMS_UPDATE' + TABLES + params = table_of_wwwparams + EXCEPTIONS + update_error = 1 + OTHERS = 2. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_excel EXPORTING error = |WWWPARAMS_UPDATE { objid } { filename }|. + ENDIF. + + ENDMETHOD. + + +ENDCLASS. + + + +TABLES sscrfields. +DATA: app TYPE REF TO lcl_app. + +PARAMETERS p_path TYPE zexcel_export_dir. + +SELECTION-SCREEN BEGIN OF SCREEN 1001. +SELECTION-SCREEN FUNCTION KEY 1. +PARAMETERS dummy. +SELECTION-SCREEN END OF SCREEN 1001. + +INITIALIZATION. + CREATE OBJECT app. + app->set_sscrfields( CHANGING sscrfields = sscrfields ). + +AT SELECTION-SCREEN OUTPUT. + app->at_selection_screen_output( ). + +AT SELECTION-SCREEN. + app->at_selection_screen( ). + +AT SELECTION-SCREEN ON EXIT-COMMAND. + app->at_selection_screen_on_exit( ). diff --git a/src/demos/zdemo_excel_checker.prog.xml b/src/demos/zdemo_excel_checker.prog.xml new file mode 100644 index 0000000..468a47c --- /dev/null +++ b/src/demos/zdemo_excel_checker.prog.xml @@ -0,0 +1,22 @@ + + + + + + ZDEMO_EXCEL_CHECKER + S + 1 + X + D$S + X + + + + R + abap2xlsx demos: check for regressions + 38 + + + + + diff --git a/src/demos/zdemo_excel_comments.prog.abap b/src/demos/zdemo_excel_comments.prog.abap index 4835f70..61de791 100644 --- a/src/demos/zdemo_excel_comments.prog.abap +++ b/src/demos/zdemo_excel_comments.prog.abap @@ -23,11 +23,6 @@ START-OF-SELECTION. " Get active sheet lo_worksheet = lo_excel->get_active_worksheet( ). - lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). - lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = sy-datum ). - lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = sy-uzeit ). - lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = 'http://www.abap2xlsx.org' ). - lo_worksheet->set_cell( ip_column = 'B' ip_row = 4 ip_value = 'Click here to visit abap2xlsx homepage' ip_hyperlink = lo_hyperlink ). " Comments lo_comment = lo_excel->add_new_comment( ). @@ -42,15 +37,6 @@ START-OF-SELECTION. " Second sheet lo_worksheet = lo_excel->add_new_worksheet( ). - lo_worksheet->set_default_excel_date_format( zcl_excel_style_number_format=>c_format_date_yyyymmdd ). - lo_worksheet->set_title( ip_title = 'Sheet2' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Date Format set to YYYYMMDD' ). - " Insert current date - lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Current Date:' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 4 ip_value = sy-datum ). - - lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet3!B2' ). - lo_worksheet->set_cell( ip_column = 'A' ip_row = 6 ip_value = 'This is link to the third sheet' ip_hyperlink = lo_hyperlink ). lo_comment = lo_excel->add_new_comment( ). lo_comment->set_text( ip_ref = 'A8' ip_text = 'What about a comment on second sheet?' ). diff --git a/src/demos/zdemo_excel_comments.w3mi.data.xlsx b/src/demos/zdemo_excel_comments.w3mi.data.xlsx new file mode 100644 index 0000000..5a09a1a Binary files /dev/null and b/src/demos/zdemo_excel_comments.w3mi.data.xlsx differ diff --git a/src/demos/zdemo_excel_comments.w3mi.xml b/src/demos/zdemo_excel_comments.w3mi.xml new file mode 100644 index 0000000..56cbf1e --- /dev/null +++ b/src/demos/zdemo_excel_comments.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZDEMO_EXCEL_COMMENTS + Comments.xlsx (ZDEMO_EXCEL_COMMENTS) + + + MI + ZDEMO_EXCEL_COMMENTS + fileextension + .xlsx + + + MI + ZDEMO_EXCEL_COMMENTS + filename + + + MI + ZDEMO_EXCEL_COMMENTS + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/demos/ztest_excel_image_header.prog.abap b/src/demos/ztest_excel_image_header.prog.abap index ec86bb2..4214c15 100644 --- a/src/demos/ztest_excel_image_header.prog.abap +++ b/src/demos/ztest_excel_image_header.prog.abap @@ -82,8 +82,7 @@ START-OF-SELECTION. lo_worksheet = lo_excel->add_new_worksheet( 'Sheet2' ). " Add some content otherwise the error "nothing to be printed" is shown - lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = sy-datum ). - lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = sy-uzeit ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'Hello world' ). ********************************************************************** *** Header Left diff --git a/src/demos/ztest_excel_image_header.w3mi.data.xlsx b/src/demos/ztest_excel_image_header.w3mi.data.xlsx new file mode 100644 index 0000000..4fc52b4 Binary files /dev/null and b/src/demos/ztest_excel_image_header.w3mi.data.xlsx differ diff --git a/src/demos/ztest_excel_image_header.w3mi.xml b/src/demos/ztest_excel_image_header.w3mi.xml new file mode 100644 index 0000000..5f55b16 --- /dev/null +++ b/src/demos/ztest_excel_image_header.w3mi.xml @@ -0,0 +1,28 @@ + + + + + ZTEST_EXCEL_IMAGE_HEADER + Image_Header_Footer.xlsx (ZTEST_EXCEL_IMAGE_HEADER) + + + MI + ZTEST_EXCEL_IMAGE_HEADER + fileextension + .xlsx + + + MI + ZTEST_EXCEL_IMAGE_HEADER + filename + + + MI + ZTEST_EXCEL_IMAGE_HEADER + mimetype + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + + + + diff --git a/src/zexcel_tr_docprops_core.xslt.source.xml b/src/zexcel_tr_docprops_core.xslt.source.xml new file mode 100644 index 0000000..674d63a --- /dev/null +++ b/src/zexcel_tr_docprops_core.xslt.source.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/zexcel_tr_docprops_core.xslt.xml b/src/zexcel_tr_docprops_core.xslt.xml new file mode 100644 index 0000000..0cb8203 --- /dev/null +++ b/src/zexcel_tr_docprops_core.xslt.xml @@ -0,0 +1,12 @@ + + + + + + ZEXCEL_TR_DOCPROPS_CORE + E + docProps/core.xml + + + +