From 14874360eb260adae833291ee2b802a297091340 Mon Sep 17 00:00:00 2001 From: Ivan Femia Date: Tue, 16 May 2017 22:27:34 +0200 Subject: [PATCH] Moving to abapGit --- src/zabap2xlsx_demo_show.prog.abap | 259 +++++++ src/zabap2xlsx_demo_show.prog.xml | 25 + src/zangry_birds.prog.abap | 757 ++++++++++++++++++++ src/zangry_birds.prog.xml | 32 + src/zdemo_calendar.prog.abap | 385 ++++++++++ src/zdemo_calendar.prog.xml | 136 ++++ src/zdemo_calendar_classes.prog.abap | 471 ++++++++++++ src/zdemo_calendar_classes.prog.xml | 22 + src/zdemo_excel.prog.abap | 83 +++ src/zdemo_excel.prog.xml | 26 + src/zdemo_excel1.prog.abap | 40 ++ src/zdemo_excel1.prog.xml | 37 + src/zdemo_excel10.prog.abap | 95 +++ src/zdemo_excel10.prog.xml | 32 + src/zdemo_excel11.prog.abap | 414 +++++++++++ src/zdemo_excel11.prog.xml | 98 +++ src/zdemo_excel12.prog.abap | 116 +++ src/zdemo_excel12.prog.xml | 32 + src/zdemo_excel13.prog.abap | 83 +++ src/zdemo_excel13.prog.xml | 32 + src/zdemo_excel14.prog.abap | 160 +++++ src/zdemo_excel14.prog.xml | 32 + src/zdemo_excel15.prog.abap | 146 ++++ src/zdemo_excel15.prog.xml | 38 + src/zdemo_excel16.prog.abap | 136 ++++ src/zdemo_excel16.prog.xml | 53 ++ src/zdemo_excel17.prog.abap | 56 ++ src/zdemo_excel17.prog.xml | 39 + src/zdemo_excel18.prog.abap | 37 + src/zdemo_excel18.prog.xml | 32 + src/zdemo_excel19.prog.abap | 56 ++ src/zdemo_excel19.prog.xml | 57 ++ src/zdemo_excel2.prog.abap | 330 +++++++++ src/zdemo_excel2.prog.xml | 32 + src/zdemo_excel21.prog.abap | 123 ++++ src/zdemo_excel21.prog.xml | 31 + src/zdemo_excel22.prog.abap | 126 ++++ src/zdemo_excel22.prog.xml | 32 + src/zdemo_excel23.prog.abap | 91 +++ src/zdemo_excel23.prog.xml | 25 + src/zdemo_excel24.prog.abap | 111 +++ src/zdemo_excel24.prog.xml | 25 + src/zdemo_excel25.prog.abap | 46 ++ src/zdemo_excel25.prog.xml | 32 + src/zdemo_excel27.prog.abap | 103 +++ src/zdemo_excel27.prog.xml | 38 + src/zdemo_excel28.prog.abap | 116 +++ src/zdemo_excel28.prog.xml | 25 + src/zdemo_excel29.prog.abap | 80 +++ src/zdemo_excel29.prog.xml | 31 + src/zdemo_excel3.prog.abap | 89 +++ src/zdemo_excel3.prog.xml | 38 + src/zdemo_excel30.prog.abap | 99 +++ src/zdemo_excel30.prog.xml | 32 + src/zdemo_excel31.prog.abap | 157 ++++ src/zdemo_excel31.prog.xml | 32 + src/zdemo_excel33.prog.abap | 69 ++ src/zdemo_excel33.prog.xml | 38 + src/zdemo_excel34.prog.abap | 217 ++++++ src/zdemo_excel34.prog.xml | 32 + src/zdemo_excel35.prog.abap | 176 +++++ src/zdemo_excel35.prog.xml | 32 + src/zdemo_excel36.prog.abap | 111 +++ src/zdemo_excel36.prog.xml | 25 + src/zdemo_excel37.prog.abap | 301 ++++++++ src/zdemo_excel37.prog.xml | 133 ++++ src/zdemo_excel38.prog.abap | 106 +++ src/zdemo_excel38.prog.xml | 32 + src/zdemo_excel39.prog.abap | 473 ++++++++++++ src/zdemo_excel39.prog.xml | 53 ++ src/zdemo_excel4.prog.abap | 115 +++ src/zdemo_excel4.prog.xml | 32 + src/zdemo_excel40.prog.abap | 83 +++ src/zdemo_excel40.prog.xml | 32 + src/zdemo_excel42.prog.abap | 102 +++ src/zdemo_excel42.prog.xml | 26 + src/zdemo_excel5.prog.abap | 79 ++ src/zdemo_excel5.prog.xml | 25 + src/zdemo_excel6.prog.abap | 61 ++ src/zdemo_excel6.prog.xml | 32 + src/zdemo_excel7.prog.abap | 425 +++++++++++ src/zdemo_excel7.prog.xml | 32 + src/zdemo_excel8.prog.abap | 71 ++ src/zdemo_excel8.prog.xml | 32 + src/zdemo_excel9.prog.abap | 203 ++++++ src/zdemo_excel9.prog.xml | 38 + src/zdemo_excel_outputopt_incl.prog.abap | 372 ++++++++++ src/zdemo_excel_outputopt_incl.prog.xml | 22 + src/zdemo_teched1.prog.abap | 83 +++ src/zdemo_teched1.prog.xml | 32 + src/zdemo_teched10.prog.abap | 49 ++ src/zdemo_teched10.prog.xml | 32 + src/zdemo_teched2.prog.abap | 91 +++ src/zdemo_teched2.prog.xml | 32 + src/zdemo_teched3.prog.abap | 107 +++ src/zdemo_teched3.prog.xml | 32 + src/zdemo_teched4.prog.abap | 129 ++++ src/zdemo_teched4.prog.xml | 32 + src/zdemo_teched5.prog.abap | 150 ++++ src/zdemo_teched5.prog.xml | 32 + src/zdemo_teched6.prog.abap | 157 ++++ src/zdemo_teched6.prog.xml | 32 + src/zdemo_teched7.prog.abap | 160 +++++ src/zdemo_teched7.prog.xml | 32 + src/zdemo_teched8.prog.abap | 222 ++++++ src/zdemo_teched8.prog.xml | 32 + src/zdemo_teched9.prog.abap | 215 ++++++ src/zdemo_teched9.prog.xml | 32 + src/zexcel_active_worksheet.dtel.xml | 24 + src/zexcel_aes_password.dtel.xml | 24 + src/zexcel_alignment.dtel.xml | 24 + src/zexcel_application.dtel.xml | 24 + src/zexcel_appversion.dtel.xml | 24 + src/zexcel_book_protection.dtel.xml | 24 + src/zexcel_boole01.doma.xml | 32 + src/zexcel_border.dtel.xml | 24 + src/zexcel_break.dtel.xml | 24 + src/zexcel_category.dtel.xml | 24 + src/zexcel_cell_column.dtel.xml | 24 + src/zexcel_cell_column_alpha.dtel.xml | 24 + src/zexcel_cell_coords.dtel.xml | 23 + src/zexcel_cell_data_type.dtel.xml | 23 + src/zexcel_cell_formula.dtel.xml | 23 + src/zexcel_cell_protection.doma.xml | 32 + src/zexcel_cell_protection.dtel.xml | 24 + src/zexcel_cell_row.dtel.xml | 24 + src/zexcel_cell_style.dtel.xml | 24 + src/zexcel_cell_value.dtel.xml | 24 + src/zexcel_color.dtel.xml | 24 + src/zexcel_company.dtel.xml | 24 + src/zexcel_condition_operator.dtel.xml | 24 + src/zexcel_condition_rule.dtel.xml | 24 + src/zexcel_condition_rule_iconset.dtel.xml | 24 + src/zexcel_conditional.dtel.xml | 24 + src/zexcel_conditional_show_value.dtel.xml | 24 + src/zexcel_conditional_type.dtel.xml | 24 + src/zexcel_conditional_value.dtel.xml | 24 + src/zexcel_converter_option.doma.xml | 38 + src/zexcel_converter_option_filter.dtel.xml | 24 + src/zexcel_converter_option_hidehd.dtel.xml | 24 + src/zexcel_converter_option_hidenc.dtel.xml | 24 + src/zexcel_converter_option_subtot.dtel.xml | 24 + src/zexcel_creator.dtel.xml | 24 + src/zexcel_data_val_error_style.dtel.xml | 24 + src/zexcel_data_val_operator.dtel.xml | 24 + src/zexcel_data_val_type.dtel.xml | 24 + src/zexcel_dec_8_2.doma.xml | 17 + src/zexcel_dec_8_2.dtel.xml | 24 + src/zexcel_description.dtel.xml | 24 + src/zexcel_diagonal.dtel.xml | 24 + src/zexcel_docsecurity.dtel.xml | 24 + src/zexcel_drawing_anchor.doma.xml | 39 + src/zexcel_drawing_anchor.dtel.xml | 24 + src/zexcel_drawing_type.doma.xml | 33 + src/zexcel_drawing_type.dtel.xml | 24 + src/zexcel_export_dir.dtel.xml | 24 + src/zexcel_fill.dtel.xml | 24 + src/zexcel_fill_type.dtel.xml | 24 + src/zexcel_font.dtel.xml | 24 + src/zexcel_format.doma.xml | 32 + src/zexcel_format.dtel.xml | 24 + src/zexcel_graph_type.dtel.xml | 24 + src/zexcel_hidden.dtel.xml | 24 + src/zexcel_indent.dtel.xml | 24 + src/zexcel_keywords.dtel.xml | 24 + src/zexcel_locked.dtel.xml | 24 + src/zexcel_number_format.dtel.xml | 24 + src/zexcel_pane_state.dtel.xml | 25 + src/zexcel_pane_type.dtel.xml | 25 + src/zexcel_print_gridlines.dtel.xml | 24 + src/zexcel_protection.dtel.xml | 24 + src/zexcel_pwd_hash.doma.xml | 16 + src/zexcel_pwd_hash.dtel.xml | 24 + src/zexcel_range_guid.dtel.xml | 24 + src/zexcel_range_name.dtel.xml | 24 + src/zexcel_range_value.dtel.xml | 24 + src/zexcel_revisionspassword.dtel.xml | 24 + src/zexcel_rotation.dtel.xml | 24 + src/zexcel_scalecrop.dtel.xml | 24 + src/zexcel_sheet_bool.doma.xml | 32 + src/zexcel_sheet_hidden.dtel.xml | 24 + src/zexcel_sheet_orienatation.dtel.xml | 24 + src/zexcel_sheet_paper_size.dtel.xml | 24 + src/zexcel_sheet_protection.dtel.xml | 24 + src/zexcel_sheet_protection_bool.dtel.xml | 24 + src/zexcel_sheet_selected.dtel.xml | 24 + src/zexcel_sheet_showzeros.dtel.xml | 24 + src/zexcel_sheet_state.dtel.xml | 24 + src/zexcel_sheet_summary.dtel.xml | 24 + src/zexcel_sheet_title.dtel.xml | 24 + src/zexcel_sheet_zoomscale.dtel.xml | 24 + src/zexcel_show_gridlines.dtel.xml | 24 + src/zexcel_show_rowcolheader.dtel.xml | 24 + src/zexcel_style_color_argb.dtel.xml | 24 + src/zexcel_style_color_component.dtel.xml | 24 + src/zexcel_style_color_indexed.dtel.xml | 25 + src/zexcel_style_color_theme.dtel.xml | 25 + src/zexcel_style_color_tint.dtel.xml | 26 + src/zexcel_style_font_family.dtel.xml | 24 + src/zexcel_style_font_name.dtel.xml | 24 + src/zexcel_style_font_scheme.dtel.xml | 24 + src/zexcel_style_font_size.dtel.xml | 24 + src/zexcel_style_font_underline.dtel.xml | 24 + src/zexcel_style_formula.dtel.xml | 24 + src/zexcel_style_priority.dtel.xml | 24 + src/zexcel_subject.dtel.xml | 24 + src/zexcel_t_autofilter_values.ttyp.xml | 20 + src/zexcel_t_cell_data.ttyp.xml | 34 + src/zexcel_t_cell_data_unsorted.ttyp.xml | 20 + src/zexcel_t_cellxfs.ttyp.xml | 100 +++ src/zexcel_t_conv_fieldcatalog.ttyp.xml | 20 + src/zexcel_t_converter_col.ttyp.xml | 34 + src/zexcel_t_converter_fcat.ttyp.xml | 20 + src/zexcel_t_converter_fil.ttyp.xml | 34 + src/zexcel_t_converter_layo.ttyp.xml | 20 + src/zexcel_t_fieldcatalog.ttyp.xml | 20 + src/zexcel_t_shared_string.ttyp.xml | 28 + src/zexcel_t_sheet_style.ttyp.xml | 20 + src/zexcel_t_style_alignment.ttyp.xml | 58 ++ src/zexcel_t_style_border.ttyp.xml | 94 +++ src/zexcel_t_style_color_argb.ttyp.xml | 21 + src/zexcel_t_style_fill.ttyp.xml | 52 ++ src/zexcel_t_style_font.ttyp.xml | 82 +++ src/zexcel_t_style_numfmt.ttyp.xml | 28 + src/zexcel_t_style_protection.ttyp.xml | 34 + src/zexcel_t_stylemapping1.ttyp.xml | 40 ++ src/zexcel_t_stylemapping2.ttyp.xml | 28 + src/zexcel_t_styles_cond_mapping.ttyp.xml | 20 + src/zexcel_t_styles_mapping.ttyp.xml | 20 + src/zexcel_t_worksheet_columndime.ttyp.xml | 20 + src/zexcel_t_worksheet_rowdimensio.ttyp.xml | 20 + src/zexcel_table_style.dtel.xml | 17 + src/zexcel_table_totals_function.dtel.xml | 17 + src/zexcel_text_rotation.dtel.xml | 24 + src/zexcel_title.dtel.xml | 24 + src/zexcel_validation_formula1.dtel.xml | 24 + src/zexcel_workbookpassword.dtel.xml | 24 + src/zexcel_worksheets_name.dtel.xml | 24 + src/zif_excel_book_properties.intf.abap | 24 + src/zif_excel_book_properties.intf.xml | 126 ++++ src/zif_excel_book_protection.intf.abap | 17 + src/zif_excel_book_protection.intf.xml | 84 +++ src/zif_excel_book_vba_project.intf.abap | 18 + src/zif_excel_book_vba_project.intf.xml | 16 + src/zif_excel_converter.intf.abap | 23 + src/zif_excel_converter.intf.xml | 30 + src/zif_excel_customui_element.intf.abap | 7 + src/zif_excel_customui_element.intf.xml | 16 + src/zif_excel_reader.intf.abap | 24 + src/zif_excel_reader.intf.xml | 30 + src/zif_excel_sheet_printsettings.intf.abap | 29 + src/zif_excel_sheet_printsettings.intf.xml | 60 ++ src/zif_excel_sheet_properties.intf.abap | 34 + src/zif_excel_sheet_properties.intf.xml | 162 +++++ src/zif_excel_sheet_protection.intf.abap | 29 + src/zif_excel_sheet_protection.intf.xml | 156 ++++ src/zif_excel_sheet_vba_project.intf.abap | 15 + src/zif_excel_sheet_vba_project.intf.xml | 16 + src/zif_excel_writer.intf.abap | 10 + src/zif_excel_writer.intf.xml | 16 + 260 files changed, 15517 insertions(+) create mode 100644 src/zabap2xlsx_demo_show.prog.abap create mode 100644 src/zabap2xlsx_demo_show.prog.xml create mode 100644 src/zangry_birds.prog.abap create mode 100644 src/zangry_birds.prog.xml create mode 100644 src/zdemo_calendar.prog.abap create mode 100644 src/zdemo_calendar.prog.xml create mode 100644 src/zdemo_calendar_classes.prog.abap create mode 100644 src/zdemo_calendar_classes.prog.xml create mode 100644 src/zdemo_excel.prog.abap create mode 100644 src/zdemo_excel.prog.xml create mode 100644 src/zdemo_excel1.prog.abap create mode 100644 src/zdemo_excel1.prog.xml create mode 100644 src/zdemo_excel10.prog.abap create mode 100644 src/zdemo_excel10.prog.xml create mode 100644 src/zdemo_excel11.prog.abap create mode 100644 src/zdemo_excel11.prog.xml create mode 100644 src/zdemo_excel12.prog.abap create mode 100644 src/zdemo_excel12.prog.xml create mode 100644 src/zdemo_excel13.prog.abap create mode 100644 src/zdemo_excel13.prog.xml create mode 100644 src/zdemo_excel14.prog.abap create mode 100644 src/zdemo_excel14.prog.xml create mode 100644 src/zdemo_excel15.prog.abap create mode 100644 src/zdemo_excel15.prog.xml create mode 100644 src/zdemo_excel16.prog.abap create mode 100644 src/zdemo_excel16.prog.xml create mode 100644 src/zdemo_excel17.prog.abap create mode 100644 src/zdemo_excel17.prog.xml create mode 100644 src/zdemo_excel18.prog.abap create mode 100644 src/zdemo_excel18.prog.xml create mode 100644 src/zdemo_excel19.prog.abap create mode 100644 src/zdemo_excel19.prog.xml create mode 100644 src/zdemo_excel2.prog.abap create mode 100644 src/zdemo_excel2.prog.xml create mode 100644 src/zdemo_excel21.prog.abap create mode 100644 src/zdemo_excel21.prog.xml create mode 100644 src/zdemo_excel22.prog.abap create mode 100644 src/zdemo_excel22.prog.xml create mode 100644 src/zdemo_excel23.prog.abap create mode 100644 src/zdemo_excel23.prog.xml create mode 100644 src/zdemo_excel24.prog.abap create mode 100644 src/zdemo_excel24.prog.xml create mode 100644 src/zdemo_excel25.prog.abap create mode 100644 src/zdemo_excel25.prog.xml create mode 100644 src/zdemo_excel27.prog.abap create mode 100644 src/zdemo_excel27.prog.xml create mode 100644 src/zdemo_excel28.prog.abap create mode 100644 src/zdemo_excel28.prog.xml create mode 100644 src/zdemo_excel29.prog.abap create mode 100644 src/zdemo_excel29.prog.xml create mode 100644 src/zdemo_excel3.prog.abap create mode 100644 src/zdemo_excel3.prog.xml create mode 100644 src/zdemo_excel30.prog.abap create mode 100644 src/zdemo_excel30.prog.xml create mode 100644 src/zdemo_excel31.prog.abap create mode 100644 src/zdemo_excel31.prog.xml create mode 100644 src/zdemo_excel33.prog.abap create mode 100644 src/zdemo_excel33.prog.xml create mode 100644 src/zdemo_excel34.prog.abap create mode 100644 src/zdemo_excel34.prog.xml create mode 100644 src/zdemo_excel35.prog.abap create mode 100644 src/zdemo_excel35.prog.xml create mode 100644 src/zdemo_excel36.prog.abap create mode 100644 src/zdemo_excel36.prog.xml create mode 100644 src/zdemo_excel37.prog.abap create mode 100644 src/zdemo_excel37.prog.xml create mode 100644 src/zdemo_excel38.prog.abap create mode 100644 src/zdemo_excel38.prog.xml create mode 100644 src/zdemo_excel39.prog.abap create mode 100644 src/zdemo_excel39.prog.xml create mode 100644 src/zdemo_excel4.prog.abap create mode 100644 src/zdemo_excel4.prog.xml create mode 100644 src/zdemo_excel40.prog.abap create mode 100644 src/zdemo_excel40.prog.xml create mode 100644 src/zdemo_excel42.prog.abap create mode 100644 src/zdemo_excel42.prog.xml create mode 100644 src/zdemo_excel5.prog.abap create mode 100644 src/zdemo_excel5.prog.xml create mode 100644 src/zdemo_excel6.prog.abap create mode 100644 src/zdemo_excel6.prog.xml create mode 100644 src/zdemo_excel7.prog.abap create mode 100644 src/zdemo_excel7.prog.xml create mode 100644 src/zdemo_excel8.prog.abap create mode 100644 src/zdemo_excel8.prog.xml create mode 100644 src/zdemo_excel9.prog.abap create mode 100644 src/zdemo_excel9.prog.xml create mode 100644 src/zdemo_excel_outputopt_incl.prog.abap create mode 100644 src/zdemo_excel_outputopt_incl.prog.xml create mode 100644 src/zdemo_teched1.prog.abap create mode 100644 src/zdemo_teched1.prog.xml create mode 100644 src/zdemo_teched10.prog.abap create mode 100644 src/zdemo_teched10.prog.xml create mode 100644 src/zdemo_teched2.prog.abap create mode 100644 src/zdemo_teched2.prog.xml create mode 100644 src/zdemo_teched3.prog.abap create mode 100644 src/zdemo_teched3.prog.xml create mode 100644 src/zdemo_teched4.prog.abap create mode 100644 src/zdemo_teched4.prog.xml create mode 100644 src/zdemo_teched5.prog.abap create mode 100644 src/zdemo_teched5.prog.xml create mode 100644 src/zdemo_teched6.prog.abap create mode 100644 src/zdemo_teched6.prog.xml create mode 100644 src/zdemo_teched7.prog.abap create mode 100644 src/zdemo_teched7.prog.xml create mode 100644 src/zdemo_teched8.prog.abap create mode 100644 src/zdemo_teched8.prog.xml create mode 100644 src/zdemo_teched9.prog.abap create mode 100644 src/zdemo_teched9.prog.xml create mode 100644 src/zexcel_active_worksheet.dtel.xml create mode 100644 src/zexcel_aes_password.dtel.xml create mode 100644 src/zexcel_alignment.dtel.xml create mode 100644 src/zexcel_application.dtel.xml create mode 100644 src/zexcel_appversion.dtel.xml create mode 100644 src/zexcel_book_protection.dtel.xml create mode 100644 src/zexcel_boole01.doma.xml create mode 100644 src/zexcel_border.dtel.xml create mode 100644 src/zexcel_break.dtel.xml create mode 100644 src/zexcel_category.dtel.xml create mode 100644 src/zexcel_cell_column.dtel.xml create mode 100644 src/zexcel_cell_column_alpha.dtel.xml create mode 100644 src/zexcel_cell_coords.dtel.xml create mode 100644 src/zexcel_cell_data_type.dtel.xml create mode 100644 src/zexcel_cell_formula.dtel.xml create mode 100644 src/zexcel_cell_protection.doma.xml create mode 100644 src/zexcel_cell_protection.dtel.xml create mode 100644 src/zexcel_cell_row.dtel.xml create mode 100644 src/zexcel_cell_style.dtel.xml create mode 100644 src/zexcel_cell_value.dtel.xml create mode 100644 src/zexcel_color.dtel.xml create mode 100644 src/zexcel_company.dtel.xml create mode 100644 src/zexcel_condition_operator.dtel.xml create mode 100644 src/zexcel_condition_rule.dtel.xml create mode 100644 src/zexcel_condition_rule_iconset.dtel.xml create mode 100644 src/zexcel_conditional.dtel.xml create mode 100644 src/zexcel_conditional_show_value.dtel.xml create mode 100644 src/zexcel_conditional_type.dtel.xml create mode 100644 src/zexcel_conditional_value.dtel.xml create mode 100644 src/zexcel_converter_option.doma.xml create mode 100644 src/zexcel_converter_option_filter.dtel.xml create mode 100644 src/zexcel_converter_option_hidehd.dtel.xml create mode 100644 src/zexcel_converter_option_hidenc.dtel.xml create mode 100644 src/zexcel_converter_option_subtot.dtel.xml create mode 100644 src/zexcel_creator.dtel.xml create mode 100644 src/zexcel_data_val_error_style.dtel.xml create mode 100644 src/zexcel_data_val_operator.dtel.xml create mode 100644 src/zexcel_data_val_type.dtel.xml create mode 100644 src/zexcel_dec_8_2.doma.xml create mode 100644 src/zexcel_dec_8_2.dtel.xml create mode 100644 src/zexcel_description.dtel.xml create mode 100644 src/zexcel_diagonal.dtel.xml create mode 100644 src/zexcel_docsecurity.dtel.xml create mode 100644 src/zexcel_drawing_anchor.doma.xml create mode 100644 src/zexcel_drawing_anchor.dtel.xml create mode 100644 src/zexcel_drawing_type.doma.xml create mode 100644 src/zexcel_drawing_type.dtel.xml create mode 100644 src/zexcel_export_dir.dtel.xml create mode 100644 src/zexcel_fill.dtel.xml create mode 100644 src/zexcel_fill_type.dtel.xml create mode 100644 src/zexcel_font.dtel.xml create mode 100644 src/zexcel_format.doma.xml create mode 100644 src/zexcel_format.dtel.xml create mode 100644 src/zexcel_graph_type.dtel.xml create mode 100644 src/zexcel_hidden.dtel.xml create mode 100644 src/zexcel_indent.dtel.xml create mode 100644 src/zexcel_keywords.dtel.xml create mode 100644 src/zexcel_locked.dtel.xml create mode 100644 src/zexcel_number_format.dtel.xml create mode 100644 src/zexcel_pane_state.dtel.xml create mode 100644 src/zexcel_pane_type.dtel.xml create mode 100644 src/zexcel_print_gridlines.dtel.xml create mode 100644 src/zexcel_protection.dtel.xml create mode 100644 src/zexcel_pwd_hash.doma.xml create mode 100644 src/zexcel_pwd_hash.dtel.xml create mode 100644 src/zexcel_range_guid.dtel.xml create mode 100644 src/zexcel_range_name.dtel.xml create mode 100644 src/zexcel_range_value.dtel.xml create mode 100644 src/zexcel_revisionspassword.dtel.xml create mode 100644 src/zexcel_rotation.dtel.xml create mode 100644 src/zexcel_scalecrop.dtel.xml create mode 100644 src/zexcel_sheet_bool.doma.xml create mode 100644 src/zexcel_sheet_hidden.dtel.xml create mode 100644 src/zexcel_sheet_orienatation.dtel.xml create mode 100644 src/zexcel_sheet_paper_size.dtel.xml create mode 100644 src/zexcel_sheet_protection.dtel.xml create mode 100644 src/zexcel_sheet_protection_bool.dtel.xml create mode 100644 src/zexcel_sheet_selected.dtel.xml create mode 100644 src/zexcel_sheet_showzeros.dtel.xml create mode 100644 src/zexcel_sheet_state.dtel.xml create mode 100644 src/zexcel_sheet_summary.dtel.xml create mode 100644 src/zexcel_sheet_title.dtel.xml create mode 100644 src/zexcel_sheet_zoomscale.dtel.xml create mode 100644 src/zexcel_show_gridlines.dtel.xml create mode 100644 src/zexcel_show_rowcolheader.dtel.xml create mode 100644 src/zexcel_style_color_argb.dtel.xml create mode 100644 src/zexcel_style_color_component.dtel.xml create mode 100644 src/zexcel_style_color_indexed.dtel.xml create mode 100644 src/zexcel_style_color_theme.dtel.xml create mode 100644 src/zexcel_style_color_tint.dtel.xml create mode 100644 src/zexcel_style_font_family.dtel.xml create mode 100644 src/zexcel_style_font_name.dtel.xml create mode 100644 src/zexcel_style_font_scheme.dtel.xml create mode 100644 src/zexcel_style_font_size.dtel.xml create mode 100644 src/zexcel_style_font_underline.dtel.xml create mode 100644 src/zexcel_style_formula.dtel.xml create mode 100644 src/zexcel_style_priority.dtel.xml create mode 100644 src/zexcel_subject.dtel.xml create mode 100644 src/zexcel_t_autofilter_values.ttyp.xml create mode 100644 src/zexcel_t_cell_data.ttyp.xml create mode 100644 src/zexcel_t_cell_data_unsorted.ttyp.xml create mode 100644 src/zexcel_t_cellxfs.ttyp.xml create mode 100644 src/zexcel_t_conv_fieldcatalog.ttyp.xml create mode 100644 src/zexcel_t_converter_col.ttyp.xml create mode 100644 src/zexcel_t_converter_fcat.ttyp.xml create mode 100644 src/zexcel_t_converter_fil.ttyp.xml create mode 100644 src/zexcel_t_converter_layo.ttyp.xml create mode 100644 src/zexcel_t_fieldcatalog.ttyp.xml create mode 100644 src/zexcel_t_shared_string.ttyp.xml create mode 100644 src/zexcel_t_sheet_style.ttyp.xml create mode 100644 src/zexcel_t_style_alignment.ttyp.xml create mode 100644 src/zexcel_t_style_border.ttyp.xml create mode 100644 src/zexcel_t_style_color_argb.ttyp.xml create mode 100644 src/zexcel_t_style_fill.ttyp.xml create mode 100644 src/zexcel_t_style_font.ttyp.xml create mode 100644 src/zexcel_t_style_numfmt.ttyp.xml create mode 100644 src/zexcel_t_style_protection.ttyp.xml create mode 100644 src/zexcel_t_stylemapping1.ttyp.xml create mode 100644 src/zexcel_t_stylemapping2.ttyp.xml create mode 100644 src/zexcel_t_styles_cond_mapping.ttyp.xml create mode 100644 src/zexcel_t_styles_mapping.ttyp.xml create mode 100644 src/zexcel_t_worksheet_columndime.ttyp.xml create mode 100644 src/zexcel_t_worksheet_rowdimensio.ttyp.xml create mode 100644 src/zexcel_table_style.dtel.xml create mode 100644 src/zexcel_table_totals_function.dtel.xml create mode 100644 src/zexcel_text_rotation.dtel.xml create mode 100644 src/zexcel_title.dtel.xml create mode 100644 src/zexcel_validation_formula1.dtel.xml create mode 100644 src/zexcel_workbookpassword.dtel.xml create mode 100644 src/zexcel_worksheets_name.dtel.xml create mode 100644 src/zif_excel_book_properties.intf.abap create mode 100644 src/zif_excel_book_properties.intf.xml create mode 100644 src/zif_excel_book_protection.intf.abap create mode 100644 src/zif_excel_book_protection.intf.xml create mode 100644 src/zif_excel_book_vba_project.intf.abap create mode 100644 src/zif_excel_book_vba_project.intf.xml create mode 100644 src/zif_excel_converter.intf.abap create mode 100644 src/zif_excel_converter.intf.xml create mode 100644 src/zif_excel_customui_element.intf.abap create mode 100644 src/zif_excel_customui_element.intf.xml create mode 100644 src/zif_excel_reader.intf.abap create mode 100644 src/zif_excel_reader.intf.xml create mode 100644 src/zif_excel_sheet_printsettings.intf.abap create mode 100644 src/zif_excel_sheet_printsettings.intf.xml create mode 100644 src/zif_excel_sheet_properties.intf.abap create mode 100644 src/zif_excel_sheet_properties.intf.xml create mode 100644 src/zif_excel_sheet_protection.intf.abap create mode 100644 src/zif_excel_sheet_protection.intf.xml create mode 100644 src/zif_excel_sheet_vba_project.intf.abap create mode 100644 src/zif_excel_sheet_vba_project.intf.xml create mode 100644 src/zif_excel_writer.intf.abap create mode 100644 src/zif_excel_writer.intf.xml diff --git a/src/zabap2xlsx_demo_show.prog.abap b/src/zabap2xlsx_demo_show.prog.abap new file mode 100644 index 0000000..98c14bd --- /dev/null +++ b/src/zabap2xlsx_demo_show.prog.abap @@ -0,0 +1,259 @@ +*&---------------------------------------------------------------------* +*& Report ZABAP2XLSX_DEMO_SHOW +*&---------------------------------------------------------------------* +REPORT zabap2xlsx_demo_like_se83. + + +*----------------------------------------------------------------------* +* CLASS lcl_perform DEFINITION +*----------------------------------------------------------------------* +CLASS lcl_perform DEFINITION CREATE PRIVATE. + PUBLIC SECTION. + CLASS-METHODS: setup_objects, + collect_reports, + + handle_nav FOR EVENT double_click OF cl_gui_alv_grid + IMPORTING e_row. + + PRIVATE SECTION. + TYPES: BEGIN OF ty_reports, + progname TYPE reposrc-progname, + sort TYPE reposrc-progname, + filename TYPE string, + END OF ty_reports. + + CLASS-DATA: + lo_grid TYPE REF TO cl_gui_alv_grid, + lo_text TYPE REF TO cl_gui_textedit, + cl_document TYPE REF TO i_oi_document_proxy, + + t_reports TYPE STANDARD TABLE OF ty_reports WITH NON-UNIQUE DEFAULT KEY. + CLASS-DATA:error TYPE REF TO i_oi_error, + t_errors TYPE STANDARD TABLE OF REF TO i_oi_error WITH NON-UNIQUE DEFAULT KEY, + cl_control TYPE REF TO i_oi_container_control. "Office Dokument + +ENDCLASS. "lcl_perform DEFINITION + + +START-OF-SELECTION. + lcl_perform=>collect_reports( ). + lcl_perform=>setup_objects( ). + +END-OF-SELECTION. + + WRITE '.'. " Force output + + +*----------------------------------------------------------------------* +* CLASS lcl_perform IMPLEMENTATION +*----------------------------------------------------------------------* +CLASS lcl_perform IMPLEMENTATION. + METHOD setup_objects. + DATA: lo_split TYPE REF TO cl_gui_splitter_container, + lo_container TYPE REF TO cl_gui_container. + + DATA: it_fieldcat TYPE lvc_t_fcat, + is_layout TYPE lvc_s_layo, + is_variant TYPE disvariant. + FIELD-SYMBOLS: LIKE LINE OF it_fieldcat. + + + CREATE OBJECT lo_split + EXPORTING + parent = cl_gui_container=>screen0 + rows = 1 + columns = 3 + no_autodef_progid_dynnr = 'X'. + lo_split->set_column_width( EXPORTING id = 1 + width = 20 ). + lo_split->set_column_width( EXPORTING id = 2 + width = 40 ). + +* Left: List of reports + lo_container = lo_split->get_container( row = 1 + column = 1 ). + + CREATE OBJECT lo_grid + EXPORTING + i_parent = lo_container. + SET HANDLER lcl_perform=>handle_nav FOR lo_grid. + + is_variant-report = sy-repid. + is_variant-handle = '0001'. + + is_layout-cwidth_opt = 'X'. + + APPEND INITIAL LINE TO it_fieldcat ASSIGNING . + -fieldname = 'PROGNAME'. + -tabname = 'REPOSRC'. + + APPEND INITIAL LINE TO it_fieldcat ASSIGNING . + -fieldname = 'SORT'. + -ref_field = 'PROGNAME'. + -ref_table = 'REPOSRC'. + + + lo_grid->set_table_for_first_display( EXPORTING + is_variant = is_variant + i_save = 'A' + is_layout = is_layout + CHANGING + it_outtab = t_reports + it_fieldcatalog = it_fieldcat + EXCEPTIONS + invalid_parameter_combination = 1 + program_error = 2 + too_many_lines = 3 + OTHERS = 4 ). + +* Middle: Text with coding + lo_container = lo_split->get_container( row = 1 + column = 2 ). + CREATE OBJECT lo_text + EXPORTING + parent = lo_container. + lo_text->set_readonly_mode( cl_gui_textedit=>true ). + lo_text->set_font_fixed( ). + + + +* right: DemoOutput + lo_container = lo_split->get_container( row = 1 + column = 3 ). + + c_oi_container_control_creator=>get_container_control( IMPORTING control = cl_control + error = error ). + APPEND error TO t_errors. + + cl_control->init_control( EXPORTING inplace_enabled = 'X' + no_flush = 'X' + r3_application_name = 'Demo Document Container' + parent = lo_container + IMPORTING error = error + EXCEPTIONS OTHERS = 2 ). + APPEND error TO t_errors. + + cl_control->get_document_proxy( EXPORTING document_type = 'Excel.Sheet' " EXCEL + no_flush = ' ' + IMPORTING document_proxy = cl_document + error = error ). + APPEND error TO t_errors. +* Errorhandling should be inserted here + + + ENDMETHOD. "setup_objects + + "collect_reports + METHOD collect_reports. + FIELD-SYMBOLS: LIKE LINE OF t_reports. + DATA: t_source TYPE STANDARD TABLE OF text255 WITH NON-UNIQUE DEFAULT KEY. + +* Get all demoreports + SELECT progname + INTO CORRESPONDING FIELDS OF TABLE t_reports + FROM reposrc + WHERE progname LIKE 'ZDEMO_EXCEL%' + AND progname <> sy-repid + AND subc = '1'. + + LOOP AT t_reports ASSIGNING . + +* Check if already switched to new outputoptions + READ REPORT -progname INTO t_source. + IF sy-subrc = 0. + FIND 'INCLUDE zdemo_excel_outputopt_incl.' IN TABLE t_source IGNORING CASE. + ENDIF. + IF sy-subrc <> 0. + DELETE t_reports. + CONTINUE. + ENDIF. + + +* Build half-numeric sort + -sort = -progname. + REPLACE REGEX '(ZDEMO_EXCEL)(\d\d)\s*$' IN -sort WITH '$1\0$2'. " REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN -sort WITH '$1$2'.REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN -sort WITH '$1$2'.REPLACE + + REPLACE REGEX '(ZDEMO_EXCEL)(\d)\s*$' IN -sort WITH '$1\0\0$2'. + ENDLOOP. + SORT t_reports BY sort progname. + + ENDMETHOD. "collect_reports + + METHOD handle_nav. + CONSTANTS: filename TYPE text80 VALUE 'ZABAP2XLSX_DEMO_SHOW.xlsx'. + DATA: wa_report LIKE LINE OF t_reports, + t_source TYPE STANDARD TABLE OF text255, + t_rawdata TYPE solix_tab, + wa_rawdata LIKE LINE OF t_rawdata, + bytecount TYPE i, + length TYPE i, + add_selopt TYPE flag. + + + READ TABLE t_reports INTO wa_report INDEX e_row-index. + CHECK sy-subrc = 0. + +* Set new text into middle frame + READ REPORT wa_report-progname INTO t_source. + lo_text->set_text_as_r3table( EXPORTING table = t_source ). + + +* Unload old xls-file + cl_document->close_document( ). + +* Get the demo +* If additional parameters found on selection screen, start via selection screen , otherwise start w/o + CLEAR add_selopt. + FIND 'PARAMETERS' IN TABLE t_source. + IF sy-subrc = 0. + add_selopt = 'X'. + ELSE. + FIND 'SELECT-OPTIONS' IN TABLE t_source. + IF sy-subrc = 0. + add_selopt = 'X'. + ENDIF. + ENDIF. + IF add_selopt IS INITIAL. + SUBMIT (wa_report-progname) AND RETURN "#EC CI_SUBMIT + WITH p_backfn = filename + WITH rb_back = 'X' + WITH rb_down = ' ' + WITH rb_send = ' ' + WITH rb_show = ' '. + ELSE. + SUBMIT (wa_report-progname) VIA SELECTION-SCREEN AND RETURN "#EC CI_SUBMIT + WITH p_backfn = filename + WITH rb_back = 'X' + WITH rb_down = ' ' + WITH rb_send = ' ' + WITH rb_show = ' '. + ENDIF. + + OPEN DATASET filename FOR INPUT IN BINARY MODE. + IF sy-subrc = 0. + DO. + CLEAR wa_rawdata. + READ DATASET filename INTO wa_rawdata LENGTH length. + IF sy-subrc <> 0. + APPEND wa_rawdata TO t_rawdata. + ADD length TO bytecount. + EXIT. + ENDIF. + APPEND wa_rawdata TO t_rawdata. + ADD length TO bytecount. + ENDDO. + CLOSE DATASET filename. + ENDIF. + + cl_control->get_document_proxy( EXPORTING document_type = 'Excel.Sheet' " EXCEL + no_flush = ' ' + IMPORTING document_proxy = cl_document + error = error ). + + cl_document->open_document_from_table( EXPORTING document_size = bytecount + document_table = t_rawdata + open_inplace = 'X' ). + + ENDMETHOD. "handle_nav + +ENDCLASS. "lcl_perform IMPLEMENTATION diff --git a/src/zabap2xlsx_demo_show.prog.xml b/src/zabap2xlsx_demo_show.prog.xml new file mode 100644 index 0000000..ea31f68 --- /dev/null +++ b/src/zabap2xlsx_demo_show.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZABAP2XLSX_DEMO_SHOW + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo Show + 19 + + + + + diff --git a/src/zangry_birds.prog.abap b/src/zangry_birds.prog.abap new file mode 100644 index 0000000..a31d4ea --- /dev/null +++ b/src/zangry_birds.prog.abap @@ -0,0 +1,757 @@ +*&---------------------------------------------------------------------* +*& Report ZANGRY_BIRDS +*& Just for fun +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zangry_birds. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_border_light TYPE REF TO zcl_excel_style_border, + lo_style_color0 TYPE REF TO zcl_excel_style, + lo_style_color1 TYPE REF TO zcl_excel_style, + lo_style_color2 TYPE REF TO zcl_excel_style, + lo_style_color3 TYPE REF TO zcl_excel_style, + lo_style_color4 TYPE REF TO zcl_excel_style, + lo_style_color5 TYPE REF TO zcl_excel_style, + lo_style_color6 TYPE REF TO zcl_excel_style, + lo_style_color7 TYPE REF TO zcl_excel_style, + lo_style_credit TYPE REF TO zcl_excel_style, + lo_style_link TYPE REF TO zcl_excel_style, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lo_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink. + +DATA: lv_style_color0_guid TYPE zexcel_cell_style, + lv_style_color1_guid TYPE zexcel_cell_style, + lv_style_color2_guid TYPE zexcel_cell_style, + lv_style_color3_guid TYPE zexcel_cell_style, + lv_style_color4_guid TYPE zexcel_cell_style, + lv_style_color5_guid TYPE zexcel_cell_style, + lv_style_color6_guid TYPE zexcel_cell_style, + lv_style_color7_guid TYPE zexcel_cell_style, + lv_style_credit_guid TYPE zexcel_cell_style, + lv_style_link_guid TYPE zexcel_cell_style, + lv_style TYPE zexcel_cell_style. + +DATA: lv_col_str TYPE zexcel_cell_column_alpha, + lv_row TYPE i, + lv_col TYPE i, + lt_mapper TYPE TABLE OF zexcel_cell_style, + ls_mapper TYPE zexcel_cell_style. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'angry_birds.xlsx'. + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + + " Creates active sheet + CREATE OBJECT lo_excel. + + CREATE OBJECT lo_border_light. + lo_border_light->border_color-rgb = zcl_excel_style_color=>c_white. + lo_border_light->border_style = zcl_excel_style_border=>c_border_thin. + + " Create color white + lo_style_color0 = lo_excel->add_new_style( ). + lo_style_color0->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color0->fill->fgcolor-rgb = 'FFFFFFFF'. + lo_style_color0->borders->allborders = lo_border_light. + lv_style_color0_guid = lo_style_color0->get_guid( ). + + " Create color black + lo_style_color1 = lo_excel->add_new_style( ). + lo_style_color1->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color1->fill->fgcolor-rgb = 'FF252525'. + lo_style_color1->borders->allborders = lo_border_light. + lv_style_color1_guid = lo_style_color1->get_guid( ). + + " Create color dark green + lo_style_color2 = lo_excel->add_new_style( ). + lo_style_color2->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color2->fill->fgcolor-rgb = 'FF75913A'. + lo_style_color2->borders->allborders = lo_border_light. + lv_style_color2_guid = lo_style_color2->get_guid( ). + + " Create color light green + lo_style_color3 = lo_excel->add_new_style( ). + lo_style_color3->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color3->fill->fgcolor-rgb = 'FF9DFB73'. + lo_style_color3->borders->allborders = lo_border_light. + lv_style_color3_guid = lo_style_color3->get_guid( ). + + " Create color green + lo_style_color4 = lo_excel->add_new_style( ). + lo_style_color4->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color4->fill->fgcolor-rgb = 'FF92CF56'. + lo_style_color4->borders->allborders = lo_border_light. + lv_style_color4_guid = lo_style_color4->get_guid( ). + + " Create color 2dark green + lo_style_color5 = lo_excel->add_new_style( ). + lo_style_color5->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color5->fill->fgcolor-rgb = 'FF506228'. + lo_style_color5->borders->allborders = lo_border_light. + lv_style_color5_guid = lo_style_color5->get_guid( ). + + " Create color yellow + lo_style_color6 = lo_excel->add_new_style( ). + lo_style_color6->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color6->fill->fgcolor-rgb = 'FFC3E224'. + lo_style_color6->borders->allborders = lo_border_light. + lv_style_color6_guid = lo_style_color6->get_guid( ). + + " Create color yellow + lo_style_color7 = lo_excel->add_new_style( ). + lo_style_color7->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_color7->fill->fgcolor-rgb = 'FFB3C14F'. + lo_style_color7->borders->allborders = lo_border_light. + lv_style_color7_guid = lo_style_color7->get_guid( ). + + " Credits + lo_style_credit = lo_excel->add_new_style( ). + lo_style_credit->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_credit->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lo_style_credit->font->size = 20. + lv_style_credit_guid = lo_style_credit->get_guid( ). + + " Link + lo_style_link = lo_excel->add_new_style( ). + lo_style_link->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_link->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. +* lo_style_link->font->size = 20. + lv_style_link_guid = lo_style_link->get_guid( ). + + " Create image map " line 2 + DO 30 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 3 + DO 28 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 4 + DO 27 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 5 + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 15 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 6 + DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 13 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 7 + DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 11 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 8 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 9 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 10 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 11 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 7 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 12 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 13 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 14 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 12 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 15 + DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 16 + DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 7 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 17 + DO 8 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 13 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 18 + DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 23 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 19 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 27 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 20 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 23 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 21 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 19 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 22 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 23 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 24 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 25 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 26 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 27 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 28 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 29 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 30 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 31 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 32 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 33 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 34 + DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 35 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 36 + DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 37 + DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 38 + DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 39 + DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 22 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 40 + DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 41 + DO 8 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 15 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 42 + DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 43 + DO 11 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO. + DO 7 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 44 + DO 13 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 45 + DO 16 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 13 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + " line 46 + DO 18 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO. + DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO. + APPEND INITIAL LINE TO lt_mapper. " escape + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Angry Birds' ). + + lv_row = 1. + lv_col = 1. + + LOOP AT lt_mapper INTO ls_mapper. + lv_col_str = zcl_excel_common=>convert_column2alpha( lv_col ). + IF ls_mapper IS INITIAL. + lo_row_dimension = lo_worksheet->get_row_dimension( ip_row = lv_row ). + lo_row_dimension->set_row_height( ip_row_height = 8 ). + lv_col = 1. + lv_row = lv_row + 1. + CONTINUE. + ENDIF. + lo_worksheet->set_cell( ip_column = lv_col_str + ip_row = lv_row + ip_value = space + ip_style = ls_mapper ). + lv_col = lv_col + 1. + + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = lv_col_str ). + lo_column_dimension->set_width( ip_width = 2 ). + ENDLOOP. + + lo_worksheet->set_show_gridlines( i_show_gridlines = abap_false ). + + lo_worksheet->set_cell( ip_column = 'AP' + ip_row = 15 + ip_value = 'Created with abap2xlsx' + ip_style = lv_style_credit_guid ). + + lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = 'http://www.abap2xlsx.org' ). + lo_worksheet->set_cell( ip_column = 'AP' + ip_row = 24 + ip_value = 'http://www.abap2xlsx.org' + ip_style = lv_style_link_guid + ip_hyperlink = lo_hyperlink ). + + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'AP' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + lo_worksheet->set_merge( ip_row = 15 ip_column_start = 'AP' ip_row_to = 22 ip_column_end = 'AR' ). + lo_worksheet->set_merge( ip_row = 24 ip_column_start = 'AP' ip_row_to = 26 ip_column_end = 'AR' ). + + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. +* " This method is only available on AS ABAP > 6.40 +* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +* lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zangry_birds.prog.xml b/src/zangry_birds.prog.xml new file mode 100644 index 0000000..acc3a26 --- /dev/null +++ b/src/zangry_birds.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZANGRY_BIRDS + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Styles + 25 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_calendar.prog.abap b/src/zdemo_calendar.prog.abap new file mode 100644 index 0000000..c188a3b --- /dev/null +++ b/src/zdemo_calendar.prog.abap @@ -0,0 +1,385 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_CALENDAR +*& abap2xlsx Demo: Create Calendar with Pictures +*&---------------------------------------------------------------------* +*& This report creates a monthly calendar in the specified date range. +*& Each month is put on a seperate worksheet. The pictures for each +*& month can be specified in a tab delimited file called "Calendar.txt" +*& which is saved in the Export Directory. By default this is the SAP +*& Workdir. The file contains 3 fields: +*& +*& Month (with leading 0) +*& Image Filename +*& Image Description +*& URL for the Description +*& +*& The Images should be landscape JPEG's with a 3:2 ratio and min. +*& 450 pixel height. They must also be saved in the Export Directory. +*& In my tests I've discovered a limit of 20 MB in the +*& cl_gui_frontend_services=>gui_download method. So keep your images +*& smaller or change to a server export using OPEN DATASET. +*&---------------------------------------------------------------------* + +REPORT zdemo_calendar. + +TYPE-POOLS: abap. +CONSTANTS: gc_save_file_name TYPE string VALUE 'Calendar.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. +INCLUDE zdemo_calendar_classes. + +DATA: lv_workdir TYPE string. + +PARAMETERS: p_from TYPE dfrom DEFAULT '20130101', + p_to TYPE dto DEFAULT '20131231'. + +SELECTION-SCREEN BEGIN OF BLOCK orientation WITH FRAME TITLE orient. +PARAMETERS: p_portr TYPE flag RADIOBUTTON GROUP orie, + p_lands TYPE flag RADIOBUTTON GROUP orie DEFAULT 'X'. +SELECTION-SCREEN END OF BLOCK orientation. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + orient = 'Orientation'(000). + +START-OF-SELECTION. + + DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_col_dim TYPE REF TO zcl_excel_worksheet_columndime, + lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi, + hyperlink TYPE REF TO zcl_excel_hyperlink, + lo_drawing TYPE REF TO zcl_excel_drawing. + + DATA: lo_style_month TYPE REF TO zcl_excel_style, + lv_style_month_guid TYPE zexcel_cell_style. + DATA: lo_style_border TYPE REF TO zcl_excel_style, + lo_border_dark TYPE REF TO zcl_excel_style_border, + lv_style_border_guid TYPE zexcel_cell_style. + DATA: lo_style_center TYPE REF TO zcl_excel_style, + lv_style_center_guid TYPE zexcel_cell_style. + + DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + + DATA: lv_full_path TYPE string, + image_descr_path TYPE string, + lv_file_separator TYPE c. + DATA: lv_content TYPE xstring, + width TYPE i, + lv_height TYPE i, + lv_from_row TYPE zexcel_cell_row. + + DATA: month TYPE i, + month_nr TYPE fcmnr, + count TYPE i VALUE 1, + title TYPE zexcel_sheet_title, + value TYPE string, + image_path TYPE string, + date_from TYPE datum, + date_to TYPE datum, + row TYPE zexcel_cell_row, + to_row TYPE zexcel_cell_row, + to_col TYPE zexcel_cell_column_alpha, + to_col_end TYPE zexcel_cell_column_alpha, + to_col_int TYPE i. + + DATA: month_names TYPE TABLE OF t247. + FIELD-SYMBOLS: LIKE LINE OF month_names. + + TYPES: BEGIN OF tt_datatab, + month_nr TYPE fcmnr, + filename TYPE string, + descr TYPE string, + url TYPE string, + END OF tt_datatab. + + DATA: image_descriptions TYPE TABLE OF tt_datatab. + FIELD-SYMBOLS: LIKE LINE OF image_descriptions. + + CONSTANTS: lv_default_file_name TYPE string VALUE 'Calendar', "#EC NOTEXT + c_from_row_portrait TYPE zexcel_cell_row VALUE 28, + c_from_row_landscape TYPE zexcel_cell_row VALUE 38, + from_col TYPE zexcel_cell_column_alpha VALUE 'C', + c_height_portrait TYPE i VALUE 450, " Image Height in Portrait Mode + c_height_landscape TYPE i VALUE 670, " Image Height in Landscape Mode + c_factor TYPE f VALUE '1.5'. " Image Ratio, default 3:2 + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name '.xlsx' INTO lv_full_path. "#EC NOTEXT + + " Read Image Names for Month and Description + CONCATENATE p_path lv_file_separator lv_default_file_name '.txt' INTO image_descr_path. "#EC NOTEXT + cl_gui_frontend_services=>gui_upload( + EXPORTING + filename = image_descr_path " Name of file + filetype = 'ASC' " File Type (ASCII, Binary) + has_field_separator = 'X' + read_by_line = 'X' " File Written Line-By-Line to the Internal Table + CHANGING + data_tab = image_descriptions " Transfer table for file contents + 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. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create Styles + " Create an underline double style + lo_style_month = lo_excel->add_new_style( ). + " lo_style_month->font->underline = abap_true. + " lo_style_month->font->underline_mode = zcl_excel_style_font=>c_underline_single. + lo_style_month->font->name = zcl_excel_style_font=>c_name_roman. + lo_style_month->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_month->font->family = zcl_excel_style_font=>c_family_roman. + lo_style_month->font->bold = abap_true. + lo_style_month->font->size = 36. + lv_style_month_guid = lo_style_month->get_guid( ). + " Create border object + CREATE OBJECT lo_border_dark. + lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black. + lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin. + "Create style with border + lo_style_border = lo_excel->add_new_style( ). + lo_style_border->borders->allborders = lo_border_dark. + lo_style_border->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right. + lo_style_border->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top. + lv_style_border_guid = lo_style_border->get_guid( ). + "Create style alignment center + lo_style_center = lo_excel->add_new_style( ). + lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_center->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top. + lv_style_center_guid = lo_style_center->get_guid( ). + + " Get Month Names + CALL FUNCTION 'MONTH_NAMES_GET' + TABLES + month_names = month_names. + + zcl_date_calculation=>months_between_two_dates( + EXPORTING + i_date_from = p_from + i_date_to = p_to + i_incl_to = abap_true + IMPORTING + e_month = month + ). + + date_from = p_from. + + WHILE count <= month. + IF count = 1. + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + ELSE. + lo_worksheet = lo_excel->add_new_worksheet( ). + ENDIF. + + lo_worksheet->zif_excel_sheet_properties~selected = zif_excel_sheet_properties=>c_selected. + + title = count. + value = count. + CONDENSE title. + CONDENSE value. + lo_worksheet->set_title( title ). + lo_worksheet->set_print_gridlines( abap_false ). + lo_worksheet->sheet_setup->paper_size = zcl_excel_sheet_setup=>c_papersize_a4. + lo_worksheet->sheet_setup->horizontal_centered = abap_true. + lo_worksheet->sheet_setup->vertical_centered = abap_true. + lo_col_dim = lo_worksheet->get_column_dimension( 'A' ). + lo_col_dim->set_width( '1.0' ). + lo_col_dim = lo_worksheet->get_column_dimension( 'B' ). + lo_col_dim->set_width( '2.0' ). + IF p_lands = abap_true. + lo_worksheet->sheet_setup->orientation = zcl_excel_sheet_setup=>c_orientation_landscape. + lv_height = c_height_landscape. + lv_from_row = c_from_row_landscape. + lo_worksheet->sheet_setup->margin_top = '0.10'. + lo_worksheet->sheet_setup->margin_left = '0.10'. + lo_worksheet->sheet_setup->margin_right = '0.10'. + lo_worksheet->sheet_setup->margin_bottom = '0.10'. + ELSE. + lo_col_dim = lo_worksheet->get_column_dimension( 'K' ). + lo_col_dim->set_width( '3.0' ). + lo_worksheet->sheet_setup->margin_top = '0.80'. + lo_worksheet->sheet_setup->margin_left = '0.55'. + lo_worksheet->sheet_setup->margin_right = '0.05'. + lo_worksheet->sheet_setup->margin_bottom = '0.30'. + lv_height = c_height_portrait. + lv_from_row = c_from_row_portrait. + ENDIF. + + " Add Month Name + month_nr = date_from+4(2). + IF p_portr = abap_true. + READ TABLE month_names WITH KEY mnr = month_nr ASSIGNING . + CONCATENATE -ltx ` ` date_from(4) INTO value. + row = lv_from_row - 2. + to_col = from_col. + ELSE. + row = lv_from_row - 1. + to_col_int = zcl_excel_common=>convert_column2int( from_col ) + 32. + to_col = zcl_excel_common=>convert_column2alpha( to_col_int ). + to_col_int = to_col_int + 1. + to_col_end = zcl_excel_common=>convert_column2alpha( to_col_int ). + CONCATENATE month_nr '/' date_from+2(2) INTO value. + to_row = row + 2. + lo_worksheet->set_merge( + EXPORTING + ip_column_start = to_col " Cell Column Start + ip_column_end = to_col_end " Cell Column End + ip_row = row " Cell Row + ip_row_to = to_row " Cell Row + ). + ENDIF. + lo_worksheet->set_cell( + EXPORTING + ip_column = to_col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_style = lv_style_month_guid + ). + +* to_col_int = zcl_excel_common=>convert_column2int( from_col ) + 7. +* to_col = zcl_excel_common=>convert_column2alpha( to_col_int ). +* +* lo_worksheet->set_merge( +* EXPORTING +* ip_column_start = from_col " Cell Column Start +* ip_column_end = to_col " Cell Column End +* ip_row = row " Cell Row +* ip_row_to = row " Cell Row +* ). + + " Add drawing from a XSTRING read from a file + UNASSIGN . + READ TABLE image_descriptions WITH KEY month_nr = month_nr ASSIGNING . + IF IS ASSIGNED. + value = -descr. + IF p_portr = abap_true. + row = lv_from_row - 3. + ELSE. + row = lv_from_row - 2. + ENDIF. + IF NOT -url IS INITIAL. + hyperlink = zcl_excel_hyperlink=>create_external_link( -url ). + lo_worksheet->set_cell( + EXPORTING + ip_column = from_col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_hyperlink = hyperlink + ). + ELSE. + lo_worksheet->set_cell( + EXPORTING + ip_column = from_col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ). + ENDIF. + lo_row_dim = lo_worksheet->get_row_dimension( row ). + lo_row_dim->set_row_height( '22.0' ). + + " In Landscape mode the row between the description and the + " dates should be not so high + IF p_lands = abap_true. + row = lv_from_row - 3. + lo_worksheet->set_cell( + EXPORTING + ip_column = from_col " Cell Column + ip_row = row " Cell Row + ip_value = ' ' " Cell Value + ). + lo_row_dim = lo_worksheet->get_row_dimension( row ). + lo_row_dim->set_row_height( '7.0' ). + row = lv_from_row - 1. + lo_row_dim = lo_worksheet->get_row_dimension( row ). + lo_row_dim->set_row_height( '5.0' ). + ENDIF. + + CONCATENATE p_path lv_file_separator -filename INTO image_path. + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 1 + ip_from_col = 'B' ). + + lv_content = zcl_helper=>load_image( image_path ). + width = lv_height * c_factor. + lo_drawing->set_media( ip_media = lv_content + ip_media_type = zcl_excel_drawing=>c_media_type_jpg + ip_width = width + ip_height = lv_height ). + lo_worksheet->add_drawing( lo_drawing ). + ENDIF. + + " Add Calendar +* CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH' +* EXPORTING +* day_in = date_from +* IMPORTING +* last_day_of_month = date_to. + date_to = date_from. + date_to+6(2) = '01'. " First of month + add 31 to date_to. " Somewhere in following month + date_to = date_to - date_to+6(2). " Last of month + IF p_portr = abap_true. + zcl_helper=>add_calendar( + EXPORTING + i_date_from = date_from + i_date_to = date_to + i_from_row = lv_from_row + i_from_col = from_col + i_day_style = lv_style_border_guid + i_cw_style = lv_style_center_guid + CHANGING + c_worksheet = lo_worksheet + ). + ELSE. + zcl_helper=>add_calendar_landscape( + EXPORTING + i_date_from = date_from + i_date_to = date_to + i_from_row = lv_from_row + i_from_col = from_col + i_day_style = lv_style_border_guid + i_cw_style = lv_style_center_guid + CHANGING + c_worksheet = lo_worksheet + ). + ENDIF. + count = count + 1. + date_from = date_to + 1. + ENDWHILE. + + lo_excel->set_active_sheet_index_by_name( '1' ). +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_calendar.prog.xml b/src/zdemo_calendar.prog.xml new file mode 100644 index 0000000..02d7a33 --- /dev/null +++ b/src/zdemo_calendar.prog.xml @@ -0,0 +1,136 @@ + + + + + + ZDEMO_CALENDAR + A + X + 1 + T + E + X + X + + + + + I + 000 + Orientation + 11 + + + I + 001 + CW + 4 + + + I + 002 + Created with abap2xlsx. Find more information at https://ivanfemia.github.io/abap2xlsx/ + 100 + + + R + abap2xlsx Demo: Create Calendar with Pictures + 45 + + + S + P_FROM + . + 17 + D + + + S + P_LANDS + Landscape + 17 + + + S + P_PATH + . + 24 + D + + + S + P_PORTR + Portrait + 16 + + + S + P_TO + . + 15 + D + + + + + D + + + I + 000 + Ausrichtung + 11 + + + I + 001 + KW + 4 + + + I + 002 + Erzeugt mit abap2xlsx. Weitere Informationen unter https://ivanfemia.github.io/abap2xlsx/ + 100 + + + R + abap2xlsx Demo: Erzeugen eines Kalenders mit Bildern + 70 + + + S + P_LANDS + Querformat + 18 + + + S + P_PORTR + Hochformat + 18 + + + S + P_FROM + D . + 17 + + + S + P_PATH + D . + 24 + + + S + P_TO + D . + 15 + + + + + + + diff --git a/src/zdemo_calendar_classes.prog.abap b/src/zdemo_calendar_classes.prog.abap new file mode 100644 index 0000000..fedf291 --- /dev/null +++ b/src/zdemo_calendar_classes.prog.abap @@ -0,0 +1,471 @@ +*&---------------------------------------------------------------------* +*& Include ZDEMO_CALENDAR_CLASSES +*&---------------------------------------------------------------------* + +*&---------------------------------------------------------------------* +*& Class ZCL_DATE_CALCULATION +*&---------------------------------------------------------------------* +* Text +*----------------------------------------------------------------------* +CLASS zcl_date_calculation DEFINITION. + PUBLIC SECTION. + CLASS-METHODS: months_between_two_dates + IMPORTING + i_date_from TYPE datum + i_date_to TYPE datum + i_incl_to TYPE flag + EXPORTING + e_month TYPE i. +ENDCLASS. "ZCL_DATE_CALCULATION + + +*----------------------------------------------------------------------* +* CLASS ZCL_DATE_CALCULATION IMPLEMENTATION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +CLASS zcl_date_calculation IMPLEMENTATION. + METHOD months_between_two_dates. + DATA: date_to TYPE datum. + DATA: BEGIN OF datum_von, + jjjj(4) TYPE n, + mm(2) TYPE n, + tt(2) TYPE n, + END OF datum_von. + + DATA: BEGIN OF datum_bis, + jjjj(4) TYPE n, + mm(2) TYPE n, + tt(2) TYPE n, + END OF datum_bis. + + e_month = 0. + + CHECK NOT ( i_date_from IS INITIAL ) + AND NOT ( i_date_to IS INITIAL ). + + date_to = i_date_to. + IF i_incl_to = abap_true. + date_to = date_to + 1. + ENDIF. + + datum_von = i_date_from. + datum_bis = date_to. + + e_month = ( datum_bis-jjjj - datum_von-jjjj ) * 12 + + ( datum_bis-mm - datum_von-mm ). + ENDMETHOD. "MONTHS_BETWEEN_TWO_DATES +ENDCLASS. "ZCL_DATE_CALCULATION IMPLEMENTATION + +*----------------------------------------------------------------------* +* CLASS zcl_date_calculation_test DEFINITION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +CLASS zcl_date_calculation_test DEFINITION FOR TESTING + " DURATION SHORT + " RISK LEVEL HARMLESS + "#AU Duration Medium + "#AU Risk_Level Harmless + . + PUBLIC SECTION. + METHODS: + months_between_two_dates FOR TESTING. +ENDCLASS. "zcl_date_calculation_test DEFINITION +*----------------------------------------------------------------------* +* CLASS zcl_date_calculation_test IMPLEMENTATION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +CLASS zcl_date_calculation_test IMPLEMENTATION. + METHOD months_between_two_dates. + + DATA: date_from TYPE datum VALUE '20120101', + date_to TYPE datum VALUE '20121231'. + DATA: month TYPE i. + + zcl_date_calculation=>months_between_two_dates( + EXPORTING + i_date_from = date_from + i_date_to = date_to + i_incl_to = abap_true + IMPORTING + e_month = month + ). + + cl_aunit_assert=>assert_equals( + exp = 12 " Data Object with Expected Type + act = month " Data Object with Current Value + msg = 'Calculated date is wrong' " Message in Case of Error + ). + + ENDMETHOD. "months_between_two_dates +ENDCLASS. "zcl_date_calculation_test IMPLEMENTATION +*----------------------------------------------------------------------* +* CLASS zcl_helper DEFINITION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +CLASS zcl_helper DEFINITION. + PUBLIC SECTION. + CLASS-METHODS: + load_image + IMPORTING + filename TYPE string + RETURNING value(r_image) TYPE xstring, + add_calendar + IMPORTING + i_date_from TYPE datum + i_date_to TYPE datum + i_from_row TYPE zexcel_cell_row + i_from_col TYPE zexcel_cell_column_alpha + i_day_style TYPE zexcel_cell_style + i_cw_style TYPE zexcel_cell_style + CHANGING + c_worksheet TYPE REF TO zcl_excel_worksheet, + add_calendar_landscape + IMPORTING + i_date_from TYPE datum + i_date_to TYPE datum + i_from_row TYPE zexcel_cell_row + i_from_col TYPE zexcel_cell_column_alpha + i_day_style TYPE zexcel_cell_style + i_cw_style TYPE zexcel_cell_style + CHANGING + c_worksheet TYPE REF TO zcl_excel_worksheet, + add_a2x_footer + IMPORTING + i_from_row TYPE zexcel_cell_row + i_from_col TYPE zexcel_cell_column_alpha + CHANGING + c_worksheet TYPE REF TO zcl_excel_worksheet, + add_calender_week + IMPORTING + i_date TYPE datum + i_row TYPE zexcel_cell_row + i_col TYPE zexcel_cell_column_alpha + i_style TYPE zexcel_cell_style + CHANGING + c_worksheet TYPE REF TO zcl_excel_worksheet. +ENDCLASS. "zcl_helper DEFINITION + +*----------------------------------------------------------------------* +* CLASS zcl_helper IMPLEMENTATION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +CLASS zcl_helper IMPLEMENTATION. + METHOD load_image. + "Load samle image + DATA: lt_bin TYPE solix_tab, + lv_len TYPE i. + + CALL METHOD cl_gui_frontend_services=>gui_upload + EXPORTING + filename = filename + filetype = 'BIN' + IMPORTING + filelength = lv_len + CHANGING + data_tab = lt_bin + 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. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' + EXPORTING + input_length = lv_len + IMPORTING + buffer = r_image + TABLES + binary_tab = lt_bin + EXCEPTIONS + failed = 1 + OTHERS = 2. + IF sy-subrc <> 0. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. "load_image + METHOD add_calendar. + DATA: day_names TYPE TABLE OF t246. + DATA: row TYPE zexcel_cell_row, + row_max TYPE i, + col_int TYPE zexcel_cell_column, + col_max TYPE i, + from_col_int TYPE zexcel_cell_column, + col TYPE zexcel_cell_column_alpha, + lr_col_dim TYPE REF TO zcl_excel_worksheet_columndime, + lr_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi. + DATA: lv_date TYPE datum, + value TYPE string, + weekday TYPE wotnr, + weekrow TYPE wotnr VALUE 1, + day TYPE i, + width TYPE f, + height TYPE f. + DATA: hyperlink TYPE REF TO zcl_excel_hyperlink. + + FIELD-SYMBOLS: LIKE LINE OF day_names. + + lv_date = i_date_from. + from_col_int = zcl_excel_common=>convert_column2int( i_from_col ). + " Add description for Calendar Week + c_worksheet->set_cell( + EXPORTING + ip_column = i_from_col " Cell Column + ip_row = i_from_row " Cell Row + ip_value = 'CW'(001) " Cell Value + ip_style = i_cw_style + ). + + " Add Days + CALL FUNCTION 'DAY_NAMES_GET' + TABLES + day_names = day_names. + + LOOP AT day_names ASSIGNING . + row = i_from_row. + col_int = from_col_int + -wotnr. + col = zcl_excel_common=>convert_column2alpha( col_int ). + value = -langt. + c_worksheet->set_cell( + EXPORTING + ip_column = col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_style = i_cw_style + ). + ENDLOOP. + + WHILE lv_date <= i_date_to. + day = lv_date+6(2). + CALL FUNCTION 'FIMA_X_DAY_IN_MONTH_COMPUTE' + EXPORTING + i_datum = lv_date + IMPORTING + e_wochentag_nr = weekday. + + row = i_from_row + weekrow. + col_int = from_col_int + weekday. + col = zcl_excel_common=>convert_column2alpha( col_int ). + + value = day. + CONDENSE value. + + c_worksheet->set_cell( + EXPORTING + ip_column = col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_style = i_day_style " Single-Character Indicator + ). + + IF weekday = 7. + " Add Calender Week + zcl_helper=>add_calender_week( + EXPORTING + i_date = lv_date + i_row = row + i_col = i_from_col + i_style = i_cw_style + CHANGING + c_worksheet = c_worksheet + ). + weekrow = weekrow + 1. + ENDIF. + lv_date = lv_date + 1. + ENDWHILE. + " Add Calender Week + zcl_helper=>add_calender_week( + EXPORTING + i_date = lv_date + i_row = row + i_col = i_from_col + i_style = i_cw_style + CHANGING + c_worksheet = c_worksheet + ). + " Add Created with abap2xlsx + row = row + 2. + zcl_helper=>add_a2x_footer( + EXPORTING + i_from_row = row + i_from_col = i_from_col + CHANGING + c_worksheet = c_worksheet + ). + col_int = from_col_int. + col_max = from_col_int + 7. + WHILE col_int <= col_max. + col = zcl_excel_common=>convert_column2alpha( col_int ). + IF sy-index = 1. + width = '5.0'. + ELSE. + width = '11.4'. + ENDIF. + lr_col_dim = c_worksheet->get_column_dimension( col ). + lr_col_dim->set_width( width ). + col_int = col_int + 1. + ENDWHILE. + row = i_from_row + 1. + row_max = i_from_row + 6. + WHILE row <= row_max. + height = 50. + lr_row_dim = c_worksheet->get_row_dimension( row ). + lr_row_dim->set_row_height( height ). + row = row + 1. + ENDWHILE. + ENDMETHOD. "add_calendar + METHOD add_a2x_footer. + DATA: value TYPE string, + hyperlink TYPE REF TO zcl_excel_hyperlink. + + value = 'Created with abap2xlsx. Find more information at http://abap2xlsx.org.'(002). + hyperlink = zcl_excel_hyperlink=>create_external_link( 'http://abap2xlsx.org' ). "#EC NOTEXT + c_worksheet->set_cell( + EXPORTING + ip_column = i_from_col " Cell Column + ip_row = i_from_row " Cell Row + ip_value = value " Cell Value + ip_hyperlink = hyperlink + ). + + ENDMETHOD. "add_a2x_footer + METHOD add_calendar_landscape. + DATA: day_names TYPE TABLE OF t246. + + DATA: lv_date TYPE datum, + day TYPE i, + value TYPE string, + weekday TYPE wotnr. + DATA: row TYPE zexcel_cell_row, + from_col_int TYPE zexcel_cell_column, + col_int TYPE zexcel_cell_column, + col TYPE zexcel_cell_column_alpha. + DATA: lo_col_dim TYPE REF TO zcl_excel_worksheet_columndime, + lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi. + + FIELD-SYMBOLS: LIKE LINE OF day_names. + + lv_date = i_date_from. + " Add Days + CALL FUNCTION 'DAY_NAMES_GET' + TABLES + day_names = day_names. + + WHILE lv_date <= i_date_to. + day = lv_date+6(2). + CALL FUNCTION 'FIMA_X_DAY_IN_MONTH_COMPUTE' + EXPORTING + i_datum = lv_date + IMPORTING + e_wochentag_nr = weekday. + " Day name row + row = i_from_row. + col_int = from_col_int + day + 2. + col = zcl_excel_common=>convert_column2alpha( col_int ). + READ TABLE day_names ASSIGNING + WITH KEY wotnr = weekday. + value = -kurzt. + c_worksheet->set_cell( + EXPORTING + ip_column = col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_style = i_cw_style + ). + + " Day row + row = i_from_row + 1. + value = day. + CONDENSE value. + + c_worksheet->set_cell( + EXPORTING + ip_column = col " Cell Column + ip_row = row " Cell Row + ip_value = value " Cell Value + ip_style = i_day_style " Single-Character Indicator + ). + " width + lo_col_dim = c_worksheet->get_column_dimension( col ). + lo_col_dim->set_width( '3.6' ). + + + lv_date = lv_date + 1. + ENDWHILE. + " Add ABAP2XLSX Footer + row = i_from_row + 2. + c_worksheet->set_cell( + EXPORTING + ip_column = col " Cell Column + ip_row = row " Cell Row + ip_value = ' ' " Cell Value + ). + lo_row_dim = c_worksheet->get_row_dimension( row ). + lo_row_dim->set_row_height( '5.0' ). + row = i_from_row + 3. + zcl_helper=>add_a2x_footer( + EXPORTING + i_from_row = row + i_from_col = i_from_col + CHANGING + c_worksheet = c_worksheet + ). + + " Set with for all 31 coulumns + WHILE day < 32. + day = day + 1. + col_int = from_col_int + day + 2. + col = zcl_excel_common=>convert_column2alpha( col_int ). + " width + lo_col_dim = c_worksheet->get_column_dimension( col ). + lo_col_dim->set_width( '3.6' ). + ENDWHILE. + ENDMETHOD. "ADD_CALENDAR_LANDSCAPE + + METHOD add_calender_week. + DATA: week TYPE kweek, + week_int TYPE i, + value TYPE string. + " Add Calender Week + CALL FUNCTION 'DATE_GET_WEEK' + EXPORTING + date = i_date " Date for which the week should be calculated + IMPORTING + week = week. " Week for date (format:YYYYWW) + value = week+4(2). + week_int = value. + value = week_int. + CONDENSE value. + c_worksheet->set_cell( + EXPORTING + ip_column = i_col " Cell Column + ip_row = i_row " Cell Row + ip_value = value " Cell Value + ip_style = i_style + ). + ENDMETHOD. "add_calender_week +ENDCLASS. "zcl_helper IMPLEMENTATION diff --git a/src/zdemo_calendar_classes.prog.xml b/src/zdemo_calendar_classes.prog.xml new file mode 100644 index 0000000..f6e2501 --- /dev/null +++ b/src/zdemo_calendar_classes.prog.xml @@ -0,0 +1,22 @@ + + + + + + ZDEMO_CALENDAR_CLASSES + A + X + I + E + X + + + + R + Include ZDEMO_CALENDAR_CLASSES + 30 + + + + + diff --git a/src/zdemo_excel.prog.abap b/src/zdemo_excel.prog.abap new file mode 100644 index 0000000..17ade1e --- /dev/null +++ b/src/zdemo_excel.prog.abap @@ -0,0 +1,83 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel. + +DATA: lv_workdir TYPE string, + lv_upfile TYPE string. + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = sy-lisel ). + CONCATENATE p_path sy-lisel '01_HelloWorld.xlsx' INTO lv_upfile. + + 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_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 + SUBMIT zdemo_excel7 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_excel8 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Ranges + SUBMIT zdemo_excel9 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Data validation + SUBMIT zdemo_excel10 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Bind table with field catalog + " zdemo_excel11 is not added because it has a selection screen and + " you also need to have business partners maintained in transaction BP + SUBMIT zdemo_excel12 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Column size + SUBMIT zdemo_excel13 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Merge cell + SUBMIT zdemo_excel14 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Alignment + " zdemo_excel15 added at the end + SUBMIT zdemo_excel16 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Drawing + SUBMIT zdemo_excel17 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Lock sheet + SUBMIT zdemo_excel18 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Lock workbook + SUBMIT zdemo_excel19 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Set active sheet + " zdemo_excel20 is not added because it uses ALV and cannot be processed (OLE2) + SUBMIT zdemo_excel21 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Color Picker + SUBMIT zdemo_excel22 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Bind table with field catalog & sheet style + SUBMIT zdemo_excel23 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multiple sheets with and w/o grid lines, print options + SUBMIT zdemo_excel24 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multiple sheets with different default date formats + SUBMIT zdemo_excel25 AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Create and xlsx on Application Server (could be executed in batch mode) + " zdemo_excel26 is not added because it uses ALV and cannot be processed (Native) + SUBMIT zdemo_excel27 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_excel28 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: CSV writer + " SUBMIT zdemo_excel29 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Macro enabled workbook + SUBMIT zdemo_excel30 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: ABAP Cell data types + leading blanks string + SUBMIT zdemo_excel31 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Autosize Column with different Font sizes + " zdemo_excel32 is not added because it uses ALV and cannot be processed (Native) + SUBMIT zdemo_excel33 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Table autofilter + SUBMIT zdemo_excel34 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Static Styles Chess + SUBMIT zdemo_excel35 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Static Styles + SUBMIT zdemo_excel36 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Style applied to sheet, column and single cell + SUBMIT zdemo_excel37 WITH p_upfile = lv_upfile + WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Simplest call of the reader and writer - passthrough data + SUBMIT zdemo_excel38 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Show off integration of drawings ( here using the SAP-Icons ) + SUBMIT zdemo_excel39 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Charts + SUBMIT zdemo_excel40 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Demo Printsettings + SUBMIT zdemo_excel41 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Inheritance + " + " Reader/Writer Demo must always run at the end + " to make sure all documents where created + " + SUBMIT zdemo_excel15 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT Read Excel and write it back diff --git a/src/zdemo_excel.prog.xml b/src/zdemo_excel.prog.xml new file mode 100644 index 0000000..cfe71a2 --- /dev/null +++ b/src/zdemo_excel.prog.xml @@ -0,0 +1,26 @@ + + + + + + ZDEMO_EXCEL + A + X + 1 + T + E + X + X + + + + + S + P_PATH + Select output path + 26 + + + + + diff --git a/src/zdemo_excel1.prog.abap b/src/zdemo_excel1.prog.abap new file mode 100644 index 0000000..7f393a7 --- /dev/null +++ b/src/zdemo_excel1.prog.abap @@ -0,0 +1,40 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL1 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +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, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + +CONSTANTS: gc_save_file_name TYPE string VALUE '01_HelloWorld.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). +* lo_worksheet->set_title( ip_title = 'Sheet1' ). + 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 ). + + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + column_dimension->set_width( ip_width = 11 ). + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel1.prog.xml b/src/zdemo_excel1.prog.xml new file mode 100644 index 0000000..a7bd554 --- /dev/null +++ b/src/zdemo_excel1.prog.xml @@ -0,0 +1,37 @@ + + + + + + ZDEMO_EXCEL1 + A + X + 1 + T + E + X + X + + + + + S + P_PATH + . + 9 + D + + + S + RB_BACK + 17 + + + R + abap2xlsx Demo: Hello World + 28 + + + + + diff --git a/src/zdemo_excel10.prog.abap b/src/zdemo_excel10.prog.abap new file mode 100644 index 0000000..2aaff40 --- /dev/null +++ b/src/zdemo_excel10.prog.abap @@ -0,0 +1,95 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL10 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel10. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_conditional2 TYPE REF TO zcl_excel_style_conditional, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + +DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog, + ls_table_settings TYPE zexcel_s_table_settings, + ls_iconset TYPE zexcel_conditional_iconset. + +CONSTANTS: gc_save_file_name TYPE string VALUE '10_iTabFieldCatalog.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + FIELD-SYMBOLS: TYPE zexcel_s_fieldcatalog. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Internal table' ). + + ls_iconset-iconset = zcl_excel_style_conditional=>c_iconset_5arrows. + ls_iconset-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo1_value = '0'. + ls_iconset-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo2_value = '20'. + ls_iconset-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo3_value = '40'. + ls_iconset-cfvo4_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo4_value = '60'. + ls_iconset-cfvo5_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo5_value = '80'. + ls_iconset-showvalue = zcl_excel_style_conditional=>c_showvalue_true. + + "Conditional style + lo_style_conditional2 = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional2->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional2->mode_iconset = ls_iconset. + lo_style_conditional2->priority = 1. + + DATA lt_test TYPE TABLE OF sflight. + SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + + lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_test ). + + LOOP AT lt_field_catalog ASSIGNING . + CASE -fieldname. + WHEN 'CARRID'. + -position = 3. + -dynpfld = abap_true. + -totals_function = zcl_excel_table=>totals_function_count. + WHEN 'CONNID'. + -position = 4. + -dynpfld = abap_true. + -abap_type = cl_abap_typedescr=>typekind_int. + "This avoid the excel warning that the number is formatted as a text: abap2xlsx is not able to recognize numc as a number so it formats the number as a text with + "the related warning. You can force the type and the framework will correctly format the number as a number + WHEN 'FLDATE'. + -position = 2. + -dynpfld = abap_true. + WHEN 'PRICE'. + -position = 1. + -dynpfld = abap_true. + -totals_function = zcl_excel_table=>totals_function_sum. + -cond_style = lo_style_conditional2. + WHEN OTHERS. + -dynpfld = abap_false. + ENDCASE. + ENDLOOP. + + ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium5. + + lo_worksheet->bind_table( ip_table = lt_test + is_table_settings = ls_table_settings + it_field_catalog = lt_field_catalog ). + + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'D' ). "make date field a bit wider + column_dimension->set_width( ip_width = 13 ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel10.prog.xml b/src/zdemo_excel10.prog.xml new file mode 100644 index 0000000..b2def7c --- /dev/null +++ b/src/zdemo_excel10.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL10 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Format internal table with field catalog + 57 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel11.prog.abap b/src/zdemo_excel11.prog.abap new file mode 100644 index 0000000..250a940 --- /dev/null +++ b/src/zdemo_excel11.prog.abap @@ -0,0 +1,414 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL11 +*& Export Organisation and Contact Persons using ABAP2XLSX +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel11. + +TYPE-POOLS: abap. + +DATA: central_search TYPE bapibus1006_central_search, + addressdata_search TYPE bapibus1006_addr_search, + others_search TYPE bapibus1006_other_data. +DATA: searchresult TYPE TABLE OF bapibus1006_bp_addr, + return TYPE TABLE OF bapiret2. +DATA: lines TYPE i. +FIELD-SYMBOLS: LIKE LINE OF searchresult. +DATA: centraldata TYPE bapibus1006_central, + centraldataperson TYPE bapibus1006_central_person, + centraldataorganization TYPE bapibus1006_central_organ. +DATA: addressdata TYPE bapibus1006_address. +DATA: relationships TYPE TABLE OF bapibus1006_relations. +FIELD-SYMBOLS: LIKE LINE OF relationships. +DATA: relationship_centraldata TYPE bapibus1006002_central. +DATA: relationship_addresses TYPE TABLE OF bapibus1006002_addresses. +FIELD-SYMBOLS: LIKE LINE OF relationship_addresses. + +DATA: lt_download TYPE TABLE OF zexcel_s_org_rel. +FIELD-SYMBOLS: LIKE LINE OF lt_download. + +CONSTANTS: gc_save_file_name TYPE string VALUE '11_Export_Org_and_Contact.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +PARAMETERS: md TYPE flag RADIOBUTTON GROUP act. + +SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-00a. +PARAMETERS: partnerc TYPE bu_type DEFAULT 2, " Organizations + postlcod TYPE ad_pstcd1 DEFAULT '8334*', + country TYPE land1 DEFAULT 'DE', + maxsel TYPE bu_maxsel DEFAULT 100. +SELECTION-SCREEN END OF BLOCK a. + +PARAMETERS: rel TYPE flag RADIOBUTTON GROUP act DEFAULT 'X'. + +SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-00b. +PARAMETERS: reltyp TYPE bu_reltyp DEFAULT 'BUR011', + partner TYPE bu_partner DEFAULT '191'. +SELECTION-SCREEN END OF BLOCK b. + +START-OF-SELECTION. + IF md = abap_true. + " Read all Companies by Master Data + central_search-partnercategory = partnerc. + addressdata_search-postl_cod1 = postlcod. + addressdata_search-country = country. + others_search-maxsel = maxsel. + others_search-no_search_for_contactperson = 'X'. + + CALL FUNCTION 'BAPI_BUPA_SEARCH_2' + EXPORTING + centraldata = central_search + addressdata = addressdata_search + OTHERS = others_search + TABLES + searchresult = searchresult + return = return. + + SORT searchresult BY partner. + DELETE ADJACENT DUPLICATES FROM searchresult COMPARING partner. + ELSEIF rel = abap_true. + " Read by Relationship + SELECT but050~partner1 AS partner FROM but050 + INNER JOIN but000 ON but000~partner = but050~partner1 AND but000~type = '2' + INTO CORRESPONDING FIELDS OF TABLE searchresult + WHERE but050~partner2 = partner + AND but050~reltyp = reltyp. + ENDIF. + + DESCRIBE TABLE searchresult LINES lines. + WRITE: / 'Number of search results: ', lines. + + LOOP AT searchresult ASSIGNING . + " Read Details of Organization + CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL' + EXPORTING + businesspartner = -partner + IMPORTING + centraldataorganization = centraldataorganization. + " Read Standard Address of Organization + CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL' + EXPORTING + businesspartner = -partner + IMPORTING + addressdata = addressdata. + + " Add Organization to Download + APPEND INITIAL LINE TO lt_download ASSIGNING . + " Fill Organization Partner Numbers + CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' + EXPORTING + businesspartner = -partner + IMPORTING + businesspartnerout = -org_number + businesspartnerguidout = -org_guid. + + MOVE-CORRESPONDING centraldataorganization TO . + MOVE-CORRESPONDING addressdata TO . + CLEAR: addressdata. + + " Read all Relationships + CLEAR: relationships. + CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET' + EXPORTING + businesspartner = -partner + TABLES + relationships = relationships. + DELETE relationships WHERE relationshipcategory <> 'BUR001'. + LOOP AT relationships ASSIGNING . + " Read details of Contact person + CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL' + EXPORTING + businesspartner = -partner2 + IMPORTING + centraldata = centraldata + centraldataperson = centraldataperson. + " Read details of the Relationship + CALL FUNCTION 'BAPI_BUPR_CONTP_GETDETAIL' + EXPORTING + businesspartner = -partner1 + contactperson = -partner2 + IMPORTING + centraldata = relationship_centraldata. + " Read relationship address + CLEAR: relationship_addresses. + + CALL FUNCTION 'BAPI_BUPR_CONTP_ADDRESSES_GET' + EXPORTING + businesspartner = -partner1 + contactperson = -partner2 + TABLES + addresses = relationship_addresses. + + READ TABLE relationship_addresses + ASSIGNING + WITH KEY standardaddress = 'X'. + + IF IS ASSIGNED. + " Read Relationship Address + CLEAR addressdata. + CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL' + EXPORTING + businesspartner = -partner + addressguid = -addressguid + IMPORTING + addressdata = addressdata. + + APPEND INITIAL LINE TO lt_download ASSIGNING . + CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' + EXPORTING + businesspartner = -partner1 + IMPORTING + businesspartnerout = -org_number + businesspartnerguidout = -org_guid. + + CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' + EXPORTING + businesspartner = -partner2 + IMPORTING + businesspartnerout = -contpers_number + businesspartnerguidout = -contpers_guid. + + MOVE-CORRESPONDING centraldataorganization TO . + MOVE-CORRESPONDING addressdata TO . + MOVE-CORRESPONDING centraldataperson TO . + MOVE-CORRESPONDING relationship_centraldata TO . + + WRITE: / -partner1, -partner2. + WRITE: centraldataorganization-name1(20), centraldataorganization-name2(10). + WRITE: centraldataperson-firstname(15), centraldataperson-lastname(15). + WRITE: addressdata-street(25), addressdata-house_no, + addressdata-postl_cod1, addressdata-city(25). + ENDIF. + ENDLOOP. + + ENDLOOP. + + DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_body TYPE REF TO zcl_excel_style, + lo_border_dark TYPE REF TO zcl_excel_style_border, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi. + + DATA: lv_style_body_even_guid TYPE zexcel_cell_style, + lv_style_body_green TYPE zexcel_cell_style. + + DATA: row TYPE zexcel_cell_row. + + DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + + DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog, + ls_table_settings TYPE zexcel_s_table_settings. + + DATA: column TYPE zexcel_cell_column, + column_alpha TYPE zexcel_cell_column_alpha, + value TYPE zexcel_cell_value. + + FIELD-SYMBOLS: TYPE zexcel_s_fieldcatalog. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create border object + CREATE OBJECT lo_border_dark. + lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black. + lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin. + "Create style with border even + lo_style_body = lo_excel->add_new_style( ). + lo_style_body->fill->fgcolor-rgb = zcl_excel_style_color=>c_yellow. + lo_style_body->borders->allborders = lo_border_dark. + lv_style_body_even_guid = lo_style_body->get_guid( ). + "Create style with border and green fill + lo_style_body = lo_excel->add_new_style( ). + lo_style_body->fill->fgcolor-rgb = zcl_excel_style_color=>c_green. + lo_style_body->borders->allborders = lo_border_dark. + lv_style_body_green = lo_style_body->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Internal table' ). + + lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_download ). + + LOOP AT lt_field_catalog ASSIGNING . + CASE -fieldname. + WHEN 'ORG_NUMBER'. + -position = 1. + -dynpfld = abap_true. + WHEN 'CONTPERS_NUMBER'. + -position = 2. + -dynpfld = abap_true. + WHEN 'NAME1'. + -position = 3. + -dynpfld = abap_true. + WHEN 'NAME2'. + -position = 4. + -dynpfld = abap_true. + WHEN 'STREET'. + -position = 5. + -dynpfld = abap_true. + WHEN 'HOUSE_NO'. + -position = 6. + -dynpfld = abap_true. + WHEN 'POSTL_COD1'. + -position = 7. + -dynpfld = abap_true. + WHEN 'CITY'. + -position = 8. + -dynpfld = abap_true. + WHEN 'COUNTRYISO'. + -position = 9. + -dynpfld = abap_true. + WHEN 'FIRSTNAME'. + -position = 10. + -dynpfld = abap_true. + WHEN 'LASTNAME'. + -position = 11. + -dynpfld = abap_true. + WHEN 'FUNCTIONNAME'. + -position = 12. + -dynpfld = abap_true. + WHEN 'DEPARTMENTNAME'. + -position = 13. + -dynpfld = abap_true. + WHEN 'TEL1_NUMBR'. + -position = 14. + -dynpfld = abap_true. + WHEN 'TEL1_EXT'. + -position = 15. + -dynpfld = abap_true. + WHEN 'FAX_NUMBER'. + -position = 16. + -dynpfld = abap_true. + WHEN 'FAX_EXTENS'. + -position = 17. + -dynpfld = abap_true. + WHEN 'E_MAIL'. + -position = 18. + -dynpfld = abap_true. + WHEN OTHERS. + -dynpfld = abap_false. + ENDCASE. + ENDLOOP. + + ls_table_settings-top_left_column = 'A'. + ls_table_settings-top_left_row = '2'. + ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium5. + + lo_worksheet->bind_table( ip_table = lt_download + is_table_settings = ls_table_settings + it_field_catalog = lt_field_catalog ). + LOOP AT lt_download ASSIGNING . + row = sy-tabix + 2. + IF NOT -org_number IS INITIAL + AND -contpers_number IS INITIAL. + " Mark fields of Organization which can be changed green + lo_worksheet->set_cell_style( + ip_column = 'C' + ip_row = row + ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'D' + ip_row = row + ip_style = lv_style_body_green + ). +* CATCH zcx_excel. " Exceptions for ABAP2XLSX + ELSEIF NOT -org_number IS INITIAL + AND NOT -contpers_number IS INITIAL. + " Mark fields of Relationship which can be changed green + lo_worksheet->set_cell_style( + ip_column = 'L' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'M' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'N' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'O' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'P' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'Q' ip_row = row ip_style = lv_style_body_green + ). + lo_worksheet->set_cell_style( + ip_column = 'R' ip_row = row ip_style = lv_style_body_green + ). + ENDIF. + ENDLOOP. + " Add Fieldnames in first row and hide the row + LOOP AT lt_field_catalog ASSIGNING + WHERE position <> '' AND dynpfld = abap_true. + column = -position. + column_alpha = zcl_excel_common=>convert_column2alpha( column ). + value = -fieldname. + lo_worksheet->set_cell( ip_column = column_alpha + ip_row = 1 + ip_value = value + ip_style = lv_style_body_even_guid ). + ENDLOOP. + " Hide first row + row_dimension = lo_worksheet->get_row_dimension( 1 ). + row_dimension->set_visible( abap_false ). + + DATA: highest_column TYPE zexcel_cell_column, + count TYPE int4, + col_alpha TYPE zexcel_cell_column_alpha. + + highest_column = lo_worksheet->get_highest_column( ). + count = 1. + WHILE count <= highest_column. + col_alpha = zcl_excel_common=>convert_column2alpha( ip_column = count ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = col_alpha ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + count = count + 1. + ENDWHILE. +* " Set Column width manuall +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'A' ). +* column_dimension->set_width( ip_width = 11 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). +* column_dimension->set_width( ip_width = 11 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). +* column_dimension->set_width( ip_width = 35 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). +* column_dimension->set_width( ip_width = 18 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'F' ). +* column_dimension->set_width( ip_width = 5 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'G' ). +* column_dimension->set_width( ip_width = 6 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'H' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'I' ). +* column_dimension->set_width( ip_width = 3 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'J' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'K' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'L' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'M' ). +* column_dimension->set_width( ip_width = 13 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'N' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'O' ). +* column_dimension->set_width( ip_width = 9 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'P' ). +* column_dimension->set_width( ip_width = 12 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'Q' ). +* column_dimension->set_width( ip_width = 9 ). +* column_dimension = lo_worksheet->get_column_dimension( ip_column = 'R' ). +* column_dimension->set_width( ip_width = 40 ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel11.prog.xml b/src/zdemo_excel11.prog.xml new file mode 100644 index 0000000..d58a533 --- /dev/null +++ b/src/zdemo_excel11.prog.xml @@ -0,0 +1,98 @@ + + + + + + ZDEMO_EXCEL11 + A + X + 1 + K + E + X + X + + + + + I + 00A + Select by master data + 132 + + + I + 00B + Select by relationship + 132 + + + R + abap2xlsx Demo: Export Organisation and Contact Persons + 55 + + + S + COUNTRY + . + 19 + D + + + S + MAXSEL + . + 27 + D + + + S + MD + Select by master data + 29 + + + S + PARTNER + . + 24 + D + + + S + PARTNERC + . + 19 + D + + + S + POSTLCOD + . + 19 + D + + + S + P_PATH + . + 21 + D + + + S + REL + Select by relationship + 30 + + + S + RELTYP + . + 25 + D + + + + + diff --git a/src/zdemo_excel12.prog.abap b/src/zdemo_excel12.prog.abap new file mode 100644 index 0000000..4041f53 --- /dev/null +++ b/src/zdemo_excel12.prog.abap @@ -0,0 +1,116 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL12 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel12. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: gc_save_file_name TYPE string VALUE '12_HideSizeOutlineRowsAndColumns.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Sheet1' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world in AutoSize column' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Hello world in a column width size 50' ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Hello world (hidden column)' ). + lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'Outline column level 0' ). + lo_worksheet->set_cell( ip_column = 'G' ip_row = 2 ip_value = 'Outline column level 1' ). + lo_worksheet->set_cell( ip_column = 'H' ip_row = 2 ip_value = 'Outline column level 2' ). + lo_worksheet->set_cell( ip_column = 'I' ip_row = 2 ip_value = 'Small' ). + + + lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Hello world (hidden row)' ). + lo_worksheet->set_cell( ip_column = 'E' ip_row = 5 ip_value = 'Hello world in a row height size 20' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Simple outline rows 10-16 ( collapsed )' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 19 ip_value = '3 Outlines - Outlinelevel 1 is collapsed' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 19 ip_value = 'One of the two inner outlines is expanded, one collapsed' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 20 ip_value = 'Inner outline level - expanded' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 24 ip_value = 'Inner outline level - lines 25-28 are collapsed' ). + + lo_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_off. " By default is on + lo_worksheet->zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_off. " By default is on + + " Column Settings + " Auto size + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'I' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + " Manual Width + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + column_dimension->set_width( ip_width = 50 ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'D' ). + column_dimension->set_visible( ip_visible = abap_false ). + " Implementation in the Writer is not working yet ===== TODO ===== + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'F' ). + column_dimension->set_outline_level( ip_outline_level = 0 ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'G' ). + column_dimension->set_outline_level( ip_outline_level = 1 ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'H' ). + column_dimension->set_outline_level( ip_outline_level = 2 ). + + row_dimension = lo_worksheet->get_row_dimension( ip_row = 1 ). + row_dimension->set_visible( ip_visible = abap_false ). + row_dimension = lo_worksheet->get_row_dimension( ip_row = 5 ). + row_dimension->set_row_height( ip_row_height = 20 ). +* obsolete, not intuitive. Use new method shown below +* " Implementation in the Writer is not working yet ===== TODO ===== +* row_dimension = lo_worksheet->get_row_dimension( ip_row = 6 ). +* row_dimension->set_outline_level( ip_outline_level = 0 ). +* row_dimension = lo_worksheet->get_row_dimension( ip_row = 7 ). +* row_dimension->set_outline_level( ip_outline_level = 1 ). +* row_dimension = lo_worksheet->get_row_dimension( ip_row = 8 ). +* row_dimension->set_outline_level( ip_outline_level = 2 ). + +* Define an outline rows 10-16, collapsed on startup + lo_worksheet->set_row_outline( iv_row_from = 10 + iv_row_to = 16 + iv_collapsed = abap_true ). " collapsed + +* Define an inner outline rows 21-22, expanded when outer outline becomes extended + lo_worksheet->set_row_outline( iv_row_from = 21 + iv_row_to = 22 + iv_collapsed = abap_false ). " expanded + +* Define an inner outline rows 25-28, collapsed on startup + lo_worksheet->set_row_outline( iv_row_from = 25 + iv_row_to = 28 + iv_collapsed = abap_true ). " collapsed + +* Define an outer outline rows 20-30, collapsed on startup + lo_worksheet->set_row_outline( iv_row_from = 20 + iv_row_to = 30 + iv_collapsed = abap_true ). " collapsed + +* Hint: the order you create the outlines can be arbitrary +* You can start with inner outlines or with outer outlines + +*--------------------------------------------------------------------* +* Hide columns right of column M +*--------------------------------------------------------------------* + lo_worksheet->zif_excel_sheet_properties~hide_columns_from = 'M'. + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel12.prog.xml b/src/zdemo_excel12.prog.xml new file mode 100644 index 0000000..0aa461e --- /dev/null +++ b/src/zdemo_excel12.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL12 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hide Columns + 29 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel13.prog.abap b/src/zdemo_excel13.prog.abap new file mode 100644 index 0000000..28afbea --- /dev/null +++ b/src/zdemo_excel13.prog.abap @@ -0,0 +1,83 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL13 +*& +*&---------------------------------------------------------------------* +*& Example by: Alvaro "Blag" Tejada Galindo. +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel13. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lv_style_bold_border_guid TYPE zexcel_cell_style, + lo_style_bold_border TYPE REF TO zcl_excel_style, + lo_border_dark TYPE REF TO zcl_excel_style_border. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '13_MergedCells.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'sheet1' ). + + CREATE OBJECT lo_border_dark. + lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black. + lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin. + + lo_style_bold_border = lo_excel->add_new_style( ). + lo_style_bold_border->font->bold = abap_true. + lo_style_bold_border->font->italic = abap_false. + lo_style_bold_border->font->color-rgb = zcl_excel_style_color=>c_black. + lo_style_bold_border->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_bold_border->borders->allborders = lo_border_dark. + lv_style_bold_border_guid = lo_style_bold_border->get_guid( ). + + lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = 'Test' ). + + lo_worksheet->set_cell( ip_row = 2 ip_column = 'B' ip_value = 'Banana' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'C' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'E' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'G' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'Apple' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'E' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'G' ip_value = '' ip_style = lv_style_bold_border_guid ). + + lo_worksheet->set_merge( ip_row = 4 ip_column_start = 'B' ip_column_end = 'G' ). + + " Test also if merge works when oher merged chells are empty + lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 'Tomato' ). + lo_worksheet->set_merge( ip_row = 6 ip_column_start = 'B' ip_column_end = 'G' ). + + " Test the patch provided by Victor Alekhin to merge cells in one column + lo_worksheet->set_cell( ip_row = 8 ip_column = 'B' ip_value = 'Merge cells also over multiple rows by Victor Alekhin' ). + lo_worksheet->set_merge( ip_row = 8 ip_column_start = 'B' ip_column_end = 'G' ip_row_to = 10 ). + + " Test the patch provided by Alexander Budeyev with different column merges + lo_worksheet->set_cell( ip_row = 12 ip_column = 'B' ip_value = 'Merge cells with different merges by Alexander Budeyev' ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'B' ip_value = 'Test' ). + + lo_worksheet->set_cell( ip_row = 13 ip_column = 'D' ip_value = 'Banana' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'E' ip_value = 'Apple' ip_style = lv_style_bold_border_guid ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ). + + " Test merge (issue) + lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'B' ip_column_end = 'C' ip_row_to = 15 ). + lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'D' ip_column_end = 'D' ip_row_to = 14 ). + lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'E' ip_column_end = 'F' ). + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel13.prog.xml b/src/zdemo_excel13.prog.xml new file mode 100644 index 0000000..22b680b --- /dev/null +++ b/src/zdemo_excel13.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL13 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Merge cells + 28 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel14.prog.abap b/src/zdemo_excel14.prog.abap new file mode 100644 index 0000000..162cafc --- /dev/null +++ b/src/zdemo_excel14.prog.abap @@ -0,0 +1,160 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL14 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel14. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_center TYPE REF TO zcl_excel_style, + lo_style_right TYPE REF TO zcl_excel_style, + lo_style_left TYPE REF TO zcl_excel_style, + lo_style_general TYPE REF TO zcl_excel_style, + lo_style_bottom TYPE REF TO zcl_excel_style, + lo_style_middle TYPE REF TO zcl_excel_style, + lo_style_top TYPE REF TO zcl_excel_style, + lo_style_justify TYPE REF TO zcl_excel_style, + lo_style_mixed TYPE REF TO zcl_excel_style, + lo_style_mixed_wrap TYPE REF TO zcl_excel_style, + lo_style_rotated TYPE REF TO zcl_excel_style, + lo_style_shrink TYPE REF TO zcl_excel_style, + lo_style_indent TYPE REF TO zcl_excel_style, + lv_style_center_guid TYPE zexcel_cell_style, + lv_style_right_guid TYPE zexcel_cell_style, + lv_style_left_guid TYPE zexcel_cell_style, + lv_style_general_guid TYPE zexcel_cell_style, + lv_style_bottom_guid TYPE zexcel_cell_style, + lv_style_middle_guid TYPE zexcel_cell_style, + lv_style_top_guid TYPE zexcel_cell_style, + lv_style_justify_guid TYPE zexcel_cell_style, + lv_style_mixed_guid TYPE zexcel_cell_style, + lv_style_mixed_wrap_guid TYPE zexcel_cell_style, + lv_style_rotated_guid TYPE zexcel_cell_style, + lv_style_shrink_guid TYPE zexcel_cell_style, + lv_style_indent_guid TYPE zexcel_cell_style. + +DATA: lo_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi. + +CONSTANTS: gc_save_file_name TYPE string VALUE '14_Alignment.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'sheet1' ). + + "Center + lo_style_center = lo_excel->add_new_style( ). + lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lv_style_center_guid = lo_style_center->get_guid( ). + "Right + lo_style_right = lo_excel->add_new_style( ). + lo_style_right->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right. + lv_style_right_guid = lo_style_right->get_guid( ). + "Left + lo_style_left = lo_excel->add_new_style( ). + lo_style_left->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_left. + lv_style_left_guid = lo_style_left->get_guid( ). + "General + lo_style_general = lo_excel->add_new_style( ). + lo_style_general->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_general. + lv_style_general_guid = lo_style_general->get_guid( ). + "Bottom + lo_style_bottom = lo_excel->add_new_style( ). + lo_style_bottom->alignment->vertical = zcl_excel_style_alignment=>c_vertical_bottom. + lv_style_bottom_guid = lo_style_bottom->get_guid( ). + "Middle + lo_style_middle = lo_excel->add_new_style( ). + lo_style_middle->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lv_style_middle_guid = lo_style_middle->get_guid( ). + "Top + lo_style_top = lo_excel->add_new_style( ). + lo_style_top->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top. + lv_style_top_guid = lo_style_top->get_guid( ). + "Justify + lo_style_justify = lo_excel->add_new_style( ). + lo_style_justify->alignment->vertical = zcl_excel_style_alignment=>c_vertical_justify. + lv_style_justify_guid = lo_style_justify->get_guid( ). + + "Shrink + lo_style_shrink = lo_excel->add_new_style( ). + lo_style_shrink->alignment->shrinktofit = abap_true. + lv_style_shrink_guid = lo_style_shrink->get_guid( ). + + "Indent + lo_style_indent = lo_excel->add_new_style( ). + lo_style_indent->alignment->indent = 5. + lv_style_indent_guid = lo_style_indent->get_guid( ). + + "Middle / Centered / Wrap + lo_style_mixed_wrap = lo_excel->add_new_style( ). + lo_style_mixed_wrap->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_mixed_wrap->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lo_style_mixed_wrap->alignment->wraptext = abap_true. + lv_style_mixed_wrap_guid = lo_style_mixed_wrap->get_guid( ). + + "Middle / Centered / Wrap + lo_style_mixed = lo_excel->add_new_style( ). + lo_style_mixed->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_mixed->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lv_style_mixed_guid = lo_style_mixed->get_guid( ). + + "Center + lo_style_rotated = lo_excel->add_new_style( ). + lo_style_rotated->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. + lo_style_rotated->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center. + lo_style_rotated->alignment->textrotation = 165. " -75° == 90° + 75° + lv_style_rotated_guid = lo_style_rotated->get_guid( ). + + + " Set row size for first 7 rows to 40 + DO 7 TIMES. + lo_row_dimension = lo_worksheet->get_row_dimension( sy-index ). + lo_row_dimension->set_row_height( 40 ). + ENDDO. + + "Horizontal alignment + lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'Centered Text' ip_style = lv_style_center_guid ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'B' ip_value = 'Right Text' ip_style = lv_style_right_guid ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 'Left Text' ip_style = lv_style_left_guid ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'B' ip_value = 'General Text' ip_style = lv_style_general_guid ). + + " Shrink & indent + lo_worksheet->set_cell( ip_row = 4 ip_column = 'F' ip_value = 'Text shrinked' ip_style = lv_style_shrink_guid ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'F' ip_value = 'Text indented' ip_style = lv_style_indent_guid ). + + "Vertical alignment + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = 'Bottom Text' ip_style = lv_style_bottom_guid ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'D' ip_value = 'Middle Text' ip_style = lv_style_middle_guid ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'D' ip_value = 'Top Text' ip_style = lv_style_top_guid ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'D' ip_value = 'Justify Text' ip_style = lv_style_justify_guid ). + + " Wrapped + lo_worksheet->set_cell( ip_row = 10 ip_column = 'B' + ip_value = 'This is a wrapped text centered in the middle' + ip_style = lv_style_mixed_wrap_guid ). + + " Rotated + lo_worksheet->set_cell( ip_row = 10 ip_column = 'D' + ip_value = 'This is a centered text rotated by -75°' + ip_style = lv_style_rotated_guid ). + + " forced line break + DATA: lv_value TYPE string. + CONCATENATE 'This is a wrapped text centered in the middle' cl_abap_char_utilities=>cr_lf + 'and a manuall line break.' INTO lv_value. + lo_worksheet->set_cell( ip_row = 11 ip_column = 'B' + ip_value = lv_value + ip_style = lv_style_mixed_guid ). + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel14.prog.xml b/src/zdemo_excel14.prog.xml new file mode 100644 index 0000000..0a9a2bc --- /dev/null +++ b/src/zdemo_excel14.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL14 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Alignment + 26 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel15.prog.abap b/src/zdemo_excel15.prog.abap new file mode 100644 index 0000000..6d2a35f --- /dev/null +++ b/src/zdemo_excel15.prog.abap @@ -0,0 +1,146 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL15 +*& +*&---------------------------------------------------------------------* +*& 2010-10-30, Gregor Wolf: +*& Added the functionality to ouput the read table content +*& 2011-12-19, Shahrin Shahrulzaman: +*& Added the functionality to have multiple input and output files +*&---------------------------------------------------------------------* + +REPORT zdemo_excel15. + +TYPE-POOLS: abap. + +TYPES: + BEGIN OF t_demo_excel15, + input TYPE string, + END OF t_demo_excel15. + +DATA: excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + reader TYPE REF TO zif_excel_reader. + +DATA: ex TYPE REF TO zcx_excel, + msg TYPE string. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_workdir TYPE string, + output_file_path TYPE string, + input_file_path TYPE string, + lv_file_separator TYPE c. + +DATA: worksheet TYPE REF TO zcl_excel_worksheet, + highest_column TYPE zexcel_cell_column, + highest_row TYPE int4, + column TYPE zexcel_cell_column VALUE 1, + col_str TYPE zexcel_cell_column_alpha, + row TYPE int4 VALUE 1, + value TYPE zexcel_cell_value. + +DATA: + lt_files TYPE TABLE OF t_demo_excel15. +FIELD-SYMBOLS: TYPE t_demo_excel15. + +PARAMETERS: p_path TYPE zexcel_export_dir, + p_noout TYPE xfeld DEFAULT abap_true. + + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '01_HelloWorld.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '02_Styles.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '03_iTab.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '04_Sheets.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '08_Range.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '13_MergedCells.xlsx'. + APPEND INITIAL LINE TO lt_files ASSIGNING . + -input = '31_AutosizeWithDifferentFontSizes.xlsx'. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + + LOOP AT lt_files ASSIGNING . + CONCATENATE p_path lv_file_separator -input INTO input_file_path. + CONCATENATE p_path lv_file_separator '15_' -input INTO output_file_path. + REPLACE '.xlsx' IN output_file_path WITH 'FromReader.xlsx'. + + TRY. + CREATE OBJECT reader TYPE zcl_excel_reader_2007. + excel = reader->load_file( input_file_path ). + + IF p_noout EQ abap_false. + worksheet = excel->get_active_worksheet( ). + highest_column = worksheet->get_highest_column( ). + highest_row = worksheet->get_highest_row( ). + + WRITE: 'Highest column: ', highest_column, 'Highest row: ', highest_row. + WRITE: /. + + WHILE row <= highest_row. + WHILE column <= highest_column. + col_str = zcl_excel_common=>convert_column2alpha( column ). + worksheet->get_cell( + EXPORTING + ip_column = col_str + ip_row = row + IMPORTING + ep_value = value + ). + WRITE: value. + column = column + 1. + ENDWHILE. + WRITE: /. + column = 1. + row = row + 1. + ENDWHILE. + ENDIF. + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( excel ). + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. +* " This method is only available on AS ABAP > 6.40 +* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +* lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = output_file_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). + + + CATCH zcx_excel INTO ex. " Exceptions for ABAP2XLSX + msg = ex->get_text( ). + WRITE: / msg. + ENDTRY. + ENDLOOP. diff --git a/src/zdemo_excel15.prog.xml b/src/zdemo_excel15.prog.xml new file mode 100644 index 0000000..b525478 --- /dev/null +++ b/src/zdemo_excel15.prog.xml @@ -0,0 +1,38 @@ + + + + + + ZDEMO_EXCEL15 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Reader + 22 + + + S + P_NOOUT + Hide output + 19 + + + S + P_PATH + . + 24 + D + + + + + diff --git a/src/zdemo_excel16.prog.abap b/src/zdemo_excel16.prog.abap new file mode 100644 index 0000000..ac80150 --- /dev/null +++ b/src/zdemo_excel16.prog.abap @@ -0,0 +1,136 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL16 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel16. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_drawing TYPE REF TO zcl_excel_drawing. + + +DATA: ls_io TYPE skwf_io. + +CONSTANTS: gc_save_file_name TYPE string VALUE '16_Drawings.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +PARAMETERS: p_objid TYPE sdok_docid DEFAULT '456694429165174BE10000000A1550C0', " Question mark in standard Web Dynpro WDT_QUIZ + p_class TYPE sdok_class DEFAULT 'M_IMAGE_P', + pobjtype TYPE skwf_ioty DEFAULT 'P'. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + "Load samle image + DATA: lt_bin TYPE solix_tab, + lv_len TYPE i, + lv_content TYPE xstring, + ls_key TYPE wwwdatatab. + + CALL METHOD cl_gui_frontend_services=>gui_upload + EXPORTING + filename = 'c:\Program Files\SAP\FrontEnd\SAPgui\wwi\graphics\W_bio.bmp' + filetype = 'BIN' + IMPORTING + filelength = lv_len + CHANGING + data_tab = lt_bin + 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. +* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno +* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' + EXPORTING + input_length = lv_len + IMPORTING + buffer = lv_content + TABLES + binary_tab = lt_bin + EXCEPTIONS + failed = 1 + OTHERS = 2. + IF sy-subrc <> 0. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Sheet1' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Image from web repository (SMW0)' ). + + " create global drawing, set position and media from web repository + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 3 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'SAPLOGO.GIF'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 166 + ip_height = 75 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " another drawing from a XSTRING read from a file + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Image from a file (c:\Program Files\SAP\FrontEnd\SAPgui\wwi\graphics\W_bio.bmp)' ). + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 9 + ip_from_col = 'B' ). + lo_drawing->set_media( ip_media = lv_content + ip_media_type = zcl_excel_drawing=>c_media_type_bmp + ip_width = 83 + ip_height = 160 ). + + lo_worksheet->add_drawing( lo_drawing ). + + ls_io-objid = p_objid. + ls_io-class = p_class. + ls_io-objtype = pobjtype. + IF ls_io IS NOT INITIAL. + " another drawing from a XSTRING read from a file + lo_worksheet->set_cell( ip_column = 'B' ip_row = 18 ip_value = 'Mime repository (by default Question mark in standard Web Dynpro WDT_QUIZ)' ). + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 19 + ip_from_col = 'B' ). + lo_drawing->set_media_mime( ip_io = ls_io + ip_width = 126 + ip_height = 145 ). + + lo_worksheet->add_drawing( lo_drawing ). + ENDIF. + + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel16.prog.xml b/src/zdemo_excel16.prog.xml new file mode 100644 index 0000000..b69f82d --- /dev/null +++ b/src/zdemo_excel16.prog.xml @@ -0,0 +1,53 @@ + + + + + + ZDEMO_EXCEL16 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Drawings + 25 + + + S + POBJTYPE + . + 9 + D + + + S + P_CLASS + . + 9 + D + + + S + P_OBJID + . + 9 + D + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel17.prog.abap b/src/zdemo_excel17.prog.abap new file mode 100644 index 0000000..36ed2f2 --- /dev/null +++ b/src/zdemo_excel17.prog.abap @@ -0,0 +1,56 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL17 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel17. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_protection TYPE REF TO zcl_excel_style, + lv_style_protection_guid TYPE zexcel_cell_style, + lo_style TYPE REF TO zcl_excel_style, + lv_style TYPE zexcel_cell_style. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '17_SheetProtection.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +PARAMETERS: p_pwd TYPE zexcel_aes_password LOWER CASE DEFAULT 'secret'. + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. +* lo_worksheet->zif_excel_sheet_protection~password = 'DAA7'. "it is the encoded word "secret" + lo_worksheet->zif_excel_sheet_protection~password = zcl_excel_common=>encrypt_password( p_pwd ). + lo_worksheet->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_active. + lo_worksheet->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_active. + lo_worksheet->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_active. + " First style to unlock a cell + lo_style_protection = lo_excel->add_new_style( ). + lo_style_protection->protection->locked = zcl_excel_style_protection=>c_protection_unlocked. + lv_style_protection_guid = lo_style_protection->get_guid( ). + " Another style which should not affect the unlock style + lo_style = lo_excel->add_new_style( ). + lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style->fill->fgcolor-rgb = 'FFCC3333'. + lv_style = lo_style->get_guid( ). + lo_worksheet->set_cell( ip_row = 3 ip_column = 'C' ip_value = 'This cell is locked locked and has the second formating' ip_style = lv_style ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 'This cell is locked as all the others empty cell' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'This cell is locked as all the others empty cell' ). + + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel17.prog.xml b/src/zdemo_excel17.prog.xml new file mode 100644 index 0000000..8e6b408 --- /dev/null +++ b/src/zdemo_excel17.prog.xml @@ -0,0 +1,39 @@ + + + + + + ZDEMO_EXCEL17 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Sheet Protection + 33 + + + S + P_PATH + . + 24 + D + + + S + P_PWD + . + 9 + D + + + + + diff --git a/src/zdemo_excel18.prog.abap b/src/zdemo_excel18.prog.abap new file mode 100644 index 0000000..9f44bee --- /dev/null +++ b/src/zdemo_excel18.prog.abap @@ -0,0 +1,37 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL18 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel18. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lv_style_protection_guid TYPE zexcel_cell_style. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '18_BookProtection.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_excel->zif_excel_book_protection~protected = zif_excel_book_protection=>c_protected. + lo_excel->zif_excel_book_protection~lockrevision = zif_excel_book_protection=>c_locked. + lo_excel->zif_excel_book_protection~lockstructure = zif_excel_book_protection=>c_locked. + lo_excel->zif_excel_book_protection~lockwindows = zif_excel_book_protection=>c_locked. + + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ). + + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel18.prog.xml b/src/zdemo_excel18.prog.xml new file mode 100644 index 0000000..759eed8 --- /dev/null +++ b/src/zdemo_excel18.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL18 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Book protection + 32 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel19.prog.abap b/src/zdemo_excel19.prog.abap new file mode 100644 index 0000000..9a913b8 --- /dev/null +++ b/src/zdemo_excel19.prog.abap @@ -0,0 +1,56 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL19 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel19. + +TYPE-POOLS: abap. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '19_SetActiveSheet.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +PARAMETERS: p_noout TYPE xfeld DEFAULT abap_true. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " First Worksheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'First' ). + lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 1' ). + + " Second Worksheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( 'Second' ). + lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 2' ). + + " Third Worksheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( 'Third' ). + lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 3' ). + + IF p_noout EQ abap_false. + " lo_excel->set_active_sheet_index_by_name( data_sheet_name ). + DATA: active_sheet_index TYPE zexcel_active_worksheet. + active_sheet_index = lo_excel->get_active_sheet_index( ). + WRITE: 'Sheet Index before: ', active_sheet_index. + ENDIF. + lo_excel->set_active_sheet_index( '2' ). + IF p_noout EQ abap_false. + active_sheet_index = lo_excel->get_active_sheet_index( ). + WRITE: 'Sheet Index after: ', active_sheet_index. + ENDIF. + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel19.prog.xml b/src/zdemo_excel19.prog.xml new file mode 100644 index 0000000..031127d --- /dev/null +++ b/src/zdemo_excel19.prog.xml @@ -0,0 +1,57 @@ + + + + + + ZDEMO_EXCEL19 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Set active sheet + 33 + + + S + P_NOOUT + Hide output + 19 + + + S + P_PATH + . + 26 + D + + + + + D + + + S + P_NOOUT + Hide output + 19 + + + S + P_PATH + D . + 26 + + + + + + + diff --git a/src/zdemo_excel2.prog.abap b/src/zdemo_excel2.prog.abap new file mode 100644 index 0000000..be733fa --- /dev/null +++ b/src/zdemo_excel2.prog.abap @@ -0,0 +1,330 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL2 +*& Test Styles for ABAP2XLSX +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel2. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_bold TYPE REF TO zcl_excel_style, + lo_style_underline TYPE REF TO zcl_excel_style, + lo_style_filled TYPE REF TO zcl_excel_style, + lo_style_border TYPE REF TO zcl_excel_style, + lo_style_button TYPE REF TO zcl_excel_style, + lo_border_dark TYPE REF TO zcl_excel_style_border, + lo_border_light TYPE REF TO zcl_excel_style_border. + +DATA: lv_style_bold_guid TYPE zexcel_cell_style, + lv_style_underline_guid TYPE zexcel_cell_style, + lv_style_filled_guid TYPE zexcel_cell_style, + lv_style_filled_green_guid TYPE zexcel_cell_style, + lv_style_border_guid TYPE zexcel_cell_style, + lv_style_button_guid TYPE zexcel_cell_style, + lv_style_filled_turquoise_guid TYPE zexcel_cell_style, + lv_style_gr_cornerlb_guid TYPE zexcel_cell_style, + lv_style_gr_cornerlt_guid TYPE zexcel_cell_style, + lv_style_gr_cornerrb_guid TYPE zexcel_cell_style, + lv_style_gr_cornerrt_guid TYPE zexcel_cell_style, + lv_style_gr_horizontal90_guid TYPE zexcel_cell_style, + lv_style_gr_horizontal270_guid TYPE zexcel_cell_style, + lv_style_gr_horizontalb_guid TYPE zexcel_cell_style, + lv_style_gr_vertical_guid TYPE zexcel_cell_style, + lv_style_gr_vertical2_guid TYPE zexcel_cell_style, + lv_style_gr_fromcenter_guid TYPE zexcel_cell_style, + lv_style_gr_diagonal45_guid TYPE zexcel_cell_style, + lv_style_gr_diagonal45b_guid TYPE zexcel_cell_style, + lv_style_gr_diagonal135_guid TYPE zexcel_cell_style, + lv_style_gr_diagonal135b_guid TYPE zexcel_cell_style . + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. +DATA: lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi. + +CONSTANTS: gc_save_file_name TYPE string VALUE '02_Styles.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + + +START-OF-SELECTION. + + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create border object + CREATE OBJECT lo_border_dark. + lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black. + lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin. + CREATE OBJECT lo_border_light. + lo_border_light->border_color-rgb = zcl_excel_style_color=>c_gray. + lo_border_light->border_style = zcl_excel_style_border=>c_border_thin. + " Create a bold / italic style + lo_style_bold = lo_excel->add_new_style( ). + lo_style_bold->font->bold = abap_true. + lo_style_bold->font->italic = abap_true. + lo_style_bold->font->name = zcl_excel_style_font=>c_name_arial. + lo_style_bold->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_bold->font->color-rgb = zcl_excel_style_color=>c_red. + lv_style_bold_guid = lo_style_bold->get_guid( ). + " Create an underline double style + lo_style_underline = lo_excel->add_new_style( ). + lo_style_underline->font->underline = abap_true. + lo_style_underline->font->underline_mode = zcl_excel_style_font=>c_underline_double. + lo_style_underline->font->name = zcl_excel_style_font=>c_name_roman. + lo_style_underline->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_underline->font->family = zcl_excel_style_font=>c_family_roman. + lv_style_underline_guid = lo_style_underline->get_guid( ). + " Create filled style yellow + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-theme = zcl_excel_style_color=>c_theme_accent6. + lv_style_filled_guid = lo_style_filled->get_guid( ). + " Create border with button effects + lo_style_button = lo_excel->add_new_style( ). + lo_style_button->borders->right = lo_border_dark. + lo_style_button->borders->down = lo_border_dark. + lo_style_button->borders->left = lo_border_light. + lo_style_button->borders->top = lo_border_light. + lv_style_button_guid = lo_style_button->get_guid( ). + "Create style with border + lo_style_border = lo_excel->add_new_style( ). + lo_style_border->borders->allborders = lo_border_dark. + lo_style_border->borders->diagonal = lo_border_dark. + lo_style_border->borders->diagonal_mode = zcl_excel_style_borders=>c_diagonal_both. + lv_style_border_guid = lo_style_border->get_guid( ). + " Create filled style green + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_green. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_filled_green_guid = lo_style_filled->get_guid( ). + + " Create filled with gradients + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerlb. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_cornerlb_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerlt. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_cornerlt_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerrb. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_cornerrb_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerrt. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_cornerrt_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontal90. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_horizontal90_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontal270. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_horizontal270_guid = lo_style_filled->get_guid( ). + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontalb. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_horizontalb_guid = lo_style_filled->get_guid( ). + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_vertical. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_vertical_guid = lo_style_filled->get_guid( ). + + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_vertical. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_vertical2_guid = lo_style_filled->get_guid( ). + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_fromcenter. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_fromcenter_guid = lo_style_filled->get_guid( ). + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal45. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_diagonal45_guid = lo_style_filled->get_guid( ). + + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal45b. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_diagonal45b_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal135. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_diagonal135_guid = lo_style_filled->get_guid( ). + + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal135b. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue. + lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_gr_diagonal135b_guid = lo_style_filled->get_guid( ). + + + + " Create filled style turquoise using legacy excel ver <= 2003 palette. (https://code.sdn.sap.com/spaces/abap2xlsx/tickets/92) + lo_style_filled = lo_excel->add_new_style( ). + lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise + ip_index = 16 + ip_color = '0040E0D0' ). + + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-indexed = 16. + lv_style_filled_turquoise_guid = lo_style_filled->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Styles' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_bold_guid ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ip_style = lv_style_underline_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ip_style = lv_style_filled_guid ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ip_style = lv_style_border_guid ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ip_style = lv_style_button_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ip_style = lv_style_filled_turquoise_guid ). + " Fill the cell and apply one style + lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ip_style = lv_style_filled_guid ). + " Change the style + lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ip_style = lv_style_filled_green_guid ). + " Add Style to an empty cell to test Fix for Issue + "#44 Exception ZCX_EXCEL thrown when style is set for an empty cell + " https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell + lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ip_style = lv_style_filled_green_guid ). + + + lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_style = lv_style_gr_cornerlb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerlb ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 10 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 11 ip_style = lv_style_gr_cornerlt_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerlt ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 11 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 12 ip_style = lv_style_gr_cornerrb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerrb ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 12 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 13 ip_style = lv_style_gr_cornerrt_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerrt ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 13 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 14 ip_style = lv_style_gr_horizontal90_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontal90 ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 14 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 15 ip_style = lv_style_gr_horizontal270_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontal270 ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 15 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 16 ip_style = lv_style_gr_horizontalb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontalb ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 16 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 17 ip_style = lv_style_gr_vertical_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_vertical ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 17 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 18 ip_style = lv_style_gr_vertical2_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_vertical ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 18 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 19 ip_style = lv_style_gr_fromcenter_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_fromcenter ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 19 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 20 ip_style = lv_style_gr_diagonal45_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal45 ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 20 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 21 ip_style = lv_style_gr_diagonal45b_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal45b ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 21 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 22 ip_style = lv_style_gr_diagonal135_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal135 ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 22 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 23 ip_style = lv_style_gr_diagonal135b_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal135b ). + lo_row_dim = lo_worksheet->get_row_dimension( ip_row = 23 ). + lo_row_dim->set_row_height( ip_row_height = 30 ). + + + +* CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. +* lv_file = lo_excel_writer->write_file( lo_excel ). +* +* " Convert to binary +* CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' +* EXPORTING +* buffer = lv_file +* IMPORTING +* output_length = lv_bytecount +* TABLES +* binary_tab = lt_file_tab. +** " This method is only available on AS ABAP > 6.40 +** lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +** lv_bytecount = xstrlen( lv_file ). +* +* " Save the file +* cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount +* filename = lv_full_path +* filetype = 'BIN' +* CHANGING data_tab = lt_file_tab ). + + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel2.prog.xml b/src/zdemo_excel2.prog.xml new file mode 100644 index 0000000..fc2a2fc --- /dev/null +++ b/src/zdemo_excel2.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL2 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Styles + 25 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel21.prog.abap b/src/zdemo_excel21.prog.abap new file mode 100644 index 0000000..9ab65c2 --- /dev/null +++ b/src/zdemo_excel21.prog.abap @@ -0,0 +1,123 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL21 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel21. + +TYPES: + BEGIN OF t_color_style, + color TYPE zexcel_style_color_argb, + style TYPE zexcel_cell_style, + END OF t_color_style. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_filled TYPE REF TO zcl_excel_style. + +DATA: color_styles TYPE TABLE OF t_color_style. + +FIELD-SYMBOLS: LIKE LINE OF color_styles. + +CONSTANTS: max TYPE i VALUE 255, + step TYPE i VALUE 51. + +DATA: red TYPE i, + green TYPE i, + blue TYPE i, + red_hex(1) TYPE x, + green_hex(1) TYPE x, + blue_hex(1) TYPE x, + red_str TYPE string, + green_str TYPE string, + blue_str TYPE string. + +DATA: color TYPE zexcel_style_color_argb, + tint TYPE zexcel_style_color_tint. + +DATA: row TYPE i, + row_tmp TYPE i, + column TYPE zexcel_cell_column VALUE 1, + col_str TYPE zexcel_cell_column_alpha. + +CONSTANTS: gc_save_file_name TYPE string VALUE '21_BackgroundColorPicker.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + WHILE red <= max. + green = 0. + WHILE green <= max. + blue = 0. + WHILE blue <= max. + red_hex = red. + red_str = red_hex. + green_hex = green. + green_str = green_hex. + blue_hex = blue. + blue_str = blue_hex. + " Create filled + CONCATENATE 'FF' red_str green_str blue_str INTO color. + APPEND INITIAL LINE TO color_styles ASSIGNING . + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-rgb = color. + -color = color. + -style = lo_style_filled->get_guid( ). + blue = blue + step. + ENDWHILE. + green = green + step. + ENDWHILE. + red = red + step. + ENDWHILE. + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Color Picker' ). + LOOP AT color_styles ASSIGNING . + row_tmp = ( max / step + 1 ) * 3. + IF row = row_tmp. + row = 0. + column = column + 1. + ENDIF. + row = row + 1. + col_str = zcl_excel_common=>convert_column2alpha( column ). + + " Fill the cell and apply one style + lo_worksheet->set_cell( ip_column = col_str + ip_row = row + ip_value = -color + ip_style = -style ). + ENDLOOP. + + row = row + 2. + tint = '-0.5'. + DO 10 TIMES. + column = 1. + DO 10 TIMES. + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-theme = sy-index - 1. + lo_style_filled->fill->fgcolor-tint = tint. + -style = lo_style_filled->get_guid( ). + col_str = zcl_excel_common=>convert_column2alpha( column ). + lo_worksheet->set_cell_style( ip_column = col_str + ip_row = row + ip_style = -style ). + + ADD 1 TO column. + ENDDO. + ADD '0.1' TO tint. + ADD 1 TO row. + ENDDO. + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel21.prog.xml b/src/zdemo_excel21.prog.xml new file mode 100644 index 0000000..e5df636 --- /dev/null +++ b/src/zdemo_excel21.prog.xml @@ -0,0 +1,31 @@ + + + + + + ZDEMO_EXCEL21 + A + X + 1 + T + E + X + X + + + + + R + 38 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel22.prog.abap b/src/zdemo_excel22.prog.abap new file mode 100644 index 0000000..1817cef --- /dev/null +++ b/src/zdemo_excel22.prog.abap @@ -0,0 +1,126 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL22 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel22. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style TYPE REF TO zcl_excel_style, + lo_style_date TYPE REF TO zcl_excel_style, + lo_style_editable TYPE REF TO zcl_excel_style, + lo_data_validation TYPE REF TO zcl_excel_data_validation. + +DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog, + ls_table_settings TYPE zexcel_s_table_settings, + ls_table_settings_out TYPE zexcel_s_table_settings. + +DATA: lv_style_guid TYPE zexcel_cell_style. + +DATA: lv_row TYPE char10. + +FIELD-SYMBOLS: TYPE zexcel_s_fieldcatalog. + +CONSTANTS: gc_save_file_name TYPE string VALUE '22_itab_fieldcatalog.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + 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 + + " sheet style (white background) + lo_style = lo_excel->add_new_style( ). + lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style->fill->fgcolor-rgb = zcl_excel_style_color=>c_white. + lv_style_guid = lo_style->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->zif_excel_sheet_properties~set_style( lv_style_guid ). + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. + lo_worksheet->zif_excel_sheet_protection~password = zcl_excel_common=>encrypt_password( 'test' ). + lo_worksheet->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_active. + lo_worksheet->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_active. + lo_worksheet->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_active. + + " Create cell style for display only fields + lo_style = lo_excel->add_new_style( ). + lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style->fill->fgcolor-rgb = zcl_excel_style_color=>c_gray. + lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_text. + + " Create cell style for display only date field + lo_style_date = lo_excel->add_new_style( ). + lo_style_date->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_date->fill->fgcolor-rgb = zcl_excel_style_color=>c_gray. + lo_style_date->number_format->format_code = zcl_excel_style_number_format=>c_format_date_ddmmyyyy. + + " Create cell style for editable fields + lo_style_editable = lo_excel->add_new_style( ). + lo_style_editable->protection->locked = zcl_excel_style_protection=>c_protection_unlocked. + + lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_test ). + + LOOP AT lt_field_catalog ASSIGNING . + CASE -fieldname. + WHEN 'CARRID'. + -position = 3. + -dynpfld = abap_true. + -style = lo_style->get_guid( ). + WHEN 'CONNID'. + -position = 1. + -dynpfld = abap_true. + -style = lo_style->get_guid( ). + WHEN 'FLDATE'. + -position = 2. + -dynpfld = abap_true. + -style = lo_style_date->get_guid( ). + WHEN 'PRICE'. + -position = 4. + -dynpfld = abap_true. + -style = lo_style_editable->get_guid( ). + -totals_function = zcl_excel_table=>totals_function_sum. + WHEN OTHERS. + -dynpfld = abap_false. + ENDCASE. + ENDLOOP. + + ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2. + ls_table_settings-show_row_stripes = abap_true. + + lo_worksheet->bind_table( EXPORTING + ip_table = lt_test + it_field_catalog = lt_field_catalog + is_table_settings = ls_table_settings + IMPORTING + es_table_settings = ls_table_settings_out ). + + lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_custom. + lv_row = ls_table_settings_out-top_left_row. + CONDENSE lv_row. + CONCATENATE 'ISNUMBER(' ls_table_settings_out-top_left_column lv_row ')' INTO lo_data_validation->formula1. + lo_data_validation->cell_row = ls_table_settings_out-top_left_row. + lo_data_validation->cell_column = ls_table_settings_out-top_left_column. + lo_data_validation->cell_row_to = ls_table_settings_out-bottom_right_row. + lo_data_validation->cell_column_to = ls_table_settings_out-bottom_right_column. + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel22.prog.xml b/src/zdemo_excel22.prog.xml new file mode 100644 index 0000000..067eecf --- /dev/null +++ b/src/zdemo_excel22.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL22 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Export internal table + 38 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel23.prog.abap b/src/zdemo_excel23.prog.abap new file mode 100644 index 0000000..1d5008a --- /dev/null +++ b/src/zdemo_excel23.prog.abap @@ -0,0 +1,91 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL23 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel23. + +TYPE-POOLS: abap. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '23_Sheets_with_and_without_grid_lines.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet1' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the first sheet with grid lines and print centered horizontal & vertical' ). + lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ). + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet2!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is a link to the second sheet' ip_hyperlink = lo_hyperlink ). + + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. + lo_worksheet->zif_excel_sheet_properties~zoomscale = 150. + lo_worksheet->ZIF_EXCEL_SHEET_PROPERTIES~ZOOMSCALE_NORMAL = 150. + + lo_worksheet->sheet_setup->vertical_centered = abap_true. + lo_worksheet->sheet_setup->horizontal_centered = abap_true. + + " Second sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the second sheet with grid lines in display and print' ). + lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ). + lo_worksheet->set_print_gridlines( i_print_gridlines = abap_true ). + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet3!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the third sheet' ip_hyperlink = lo_hyperlink ). + + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. + lo_worksheet->zif_excel_sheet_properties~zoomscale = 160. + lo_worksheet->ZIF_EXCEL_SHEET_PROPERTIES~ZOOMSCALE_PAGELAYOUTVIEW = 200. + + " Third sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet3' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the third sheet without grid lines in display and print' ). + lo_worksheet->set_show_gridlines( i_show_gridlines = abap_false ). + lo_worksheet->set_print_gridlines( i_print_gridlines = abap_false ). + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet4!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the fourth sheet' ip_hyperlink = lo_hyperlink ). + + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. + lo_worksheet->zif_excel_sheet_properties~zoomscale = 170. + lo_worksheet->ZIF_EXCEL_SHEET_PROPERTIES~ZOOMSCALE_SHEETLAYOUTVIEW = 150. + + " Fourth sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet4' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the fourth sheet with grid lines and print centered ONLY horizontal' ). + lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ). + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet1!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the first sheet' ip_hyperlink = lo_hyperlink ). + + lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected. + lo_worksheet->zif_excel_sheet_properties~zoomscale = 150. + lo_worksheet->ZIF_EXCEL_SHEET_PROPERTIES~ZOOMSCALE_NORMAL = 150. + +" lo_worksheet->sheet_setup->vertical_centered = abap_true. + lo_worksheet->sheet_setup->horizontal_centered = abap_true. + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel23.prog.xml b/src/zdemo_excel23.prog.xml new file mode 100644 index 0000000..0040584 --- /dev/null +++ b/src/zdemo_excel23.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZDEMO_EXCEL23 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Multiple sheets with and w/o grid lines, print options + 70 + + + + + diff --git a/src/zdemo_excel24.prog.abap b/src/zdemo_excel24.prog.abap new file mode 100644 index 0000000..1104942 --- /dev/null +++ b/src/zdemo_excel24.prog.abap @@ -0,0 +1,111 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL23 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel24. + +TYPE-POOLS: abap. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +DATA: lv_value TYPE string. + +CONSTANTS: gc_save_file_name TYPE string VALUE '24_Sheets_with_different_default_date_formats.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + 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 ). + + 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 ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'A' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + + + " 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 ). + + " Third sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + " TODO: It seems that the zcl_excel_style_number_format=>c_format_date_yyyymmddslash + " does not produce a valid output + lo_worksheet->set_default_excel_date_format( zcl_excel_style_number_format=>c_format_date_yyyymmddslash ). + 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_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 ). + + " 4th sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + " Illustrate the Problem caused by: + " Excel 2000 incorrectly assumes that the year 1900 is a leap year. + " http://support.microsoft.com/kb/214326/en-us + lo_worksheet->set_title( ip_title = 'Sheet4' ). + " 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' ). + + lv_row = 4. + WHILE lv_date < lv_max. + lo_worksheet->set_cell( ip_column = 'B' ip_row = lv_row ip_value = lv_date ). + lv_value = zcl_excel_common=>date_to_excel_string( lv_date ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = lv_row ip_value = lv_value ). + lv_value = lv_date. + lo_worksheet->set_cell( ip_column = 'D' ip_row = lv_row ip_value = lv_value ). + lv_date = lv_date + 1. + lv_row = lv_row + 1. + ENDWHILE. + + lv_row = lv_row + 1. + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet1!B2' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = lv_row ip_value = 'This is link to the first sheet' ip_hyperlink = lo_hyperlink ). + + lo_excel->set_active_sheet_index_by_name( 'Sheet1' ). + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel24.prog.xml b/src/zdemo_excel24.prog.xml new file mode 100644 index 0000000..6d9908f --- /dev/null +++ b/src/zdemo_excel24.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZDEMO_EXCEL24 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Multiple sheets with different default date formats + 70 + + + + + diff --git a/src/zdemo_excel25.prog.abap b/src/zdemo_excel25.prog.abap new file mode 100644 index 0000000..b18f3ea --- /dev/null +++ b/src/zdemo_excel25.prog.abap @@ -0,0 +1,46 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL25 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel25. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_exception TYPE REF TO cx_root. + +DATA: lv_file TYPE xstring. + +CONSTANTS: lv_file_name TYPE string VALUE '25_HelloWorld.xlsx'. +DATA: lv_default_file_name TYPE string. +DATA: lv_error TYPE string. + +CALL FUNCTION 'FILE_GET_NAME_USING_PATH' + EXPORTING + logical_path = 'LOCAL_TEMPORARY_FILES' " Logical path' + file_name = lv_file_name " File name + IMPORTING + file_name_with_path = lv_default_file_name. " File name with path +" Creates active sheet +CREATE OBJECT lo_excel. + +" Get active sheet +lo_worksheet = lo_excel->get_active_worksheet( ). +lo_worksheet->set_title( ip_title = 'Sheet1' ). +lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). + +CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. +lv_file = lo_excel_writer->write_file( lo_excel ). + +TRY. + OPEN DATASET lv_default_file_name FOR OUTPUT IN BINARY MODE. + TRANSFER lv_file TO lv_default_file_name. + CLOSE DATASET lv_default_file_name. + CATCH cx_root INTO lo_exception. + lv_error = lo_exception->get_text( ). + MESSAGE lv_error TYPE 'I'. +ENDTRY. diff --git a/src/zdemo_excel25.prog.xml b/src/zdemo_excel25.prog.xml new file mode 100644 index 0000000..8d4629a --- /dev/null +++ b/src/zdemo_excel25.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL25 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Write Hello World using Logical Path on the App Server + 70 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel27.prog.abap b/src/zdemo_excel27.prog.abap new file mode 100644 index 0000000..20bce0f --- /dev/null +++ b/src/zdemo_excel27.prog.abap @@ -0,0 +1,103 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL27 +*& Test Styles for ABAP2XLSX +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel27. + +CONSTANTS: c_fish TYPE string VALUE 'Fish'. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lo_style_conditional TYPE REF TO zcl_excel_style_conditional, + lo_style_1 TYPE REF TO zcl_excel_style, + lo_style_2 TYPE REF TO zcl_excel_style, + lv_style_1_guid TYPE zexcel_cell_style, + lv_style_2_guid TYPE zexcel_cell_style, + ls_cellis TYPE zexcel_conditional_cellis. + + +DATA: lv_title TYPE zexcel_sheet_title. + +CONSTANTS: gc_save_file_name TYPE string VALUE '27_ConditionalFormatting.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + + " Creates active sheet + CREATE OBJECT lo_excel. + + lo_style_1 = lo_excel->add_new_style( ). + lo_style_1->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_1->fill->bgcolor-rgb = zcl_excel_style_color=>c_green. + lv_style_1_guid = lo_style_1->get_guid( ). + + lo_style_2 = lo_excel->add_new_style( ). + lo_style_2->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_2->fill->bgcolor-rgb = zcl_excel_style_color=>c_red. + lv_style_2_guid = lo_style_2->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lv_title = 'Data Validation'. + lo_worksheet->set_title( lv_title ). + " Set values for dropdown + lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = c_fish ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 'Anchovy' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 'Carp' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 'Catfish' ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 'Cod' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 'Eel' ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'A' ip_value = 'Haddock' ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_fish. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 9 ). + + " 1st validation + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_fish. + lo_data_validation->cell_row = 2. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 2 ip_column = 'C' ip_value = 'Select a value' ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '"Anchovy"'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_equal. + ls_cellis-cell_style = lv_style_1_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 1. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 2 + ip_stop_column = 'C' + ip_stop_row = 2 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '"Carp"'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_equal. + ls_cellis-cell_style = lv_style_2_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 2. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 2 + ip_stop_column = 'C' + ip_stop_row = 2 ). + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel27.prog.xml b/src/zdemo_excel27.prog.xml new file mode 100644 index 0000000..39d47d6 --- /dev/null +++ b/src/zdemo_excel27.prog.xml @@ -0,0 +1,38 @@ + + + + + + ZDEMO_EXCEL27 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Data conditional formatting with styles + 56 + + + S + P_PATH + . + 24 + D + + + S + P_READER + Write back after using Reader + 37 + + + + + diff --git a/src/zdemo_excel28.prog.abap b/src/zdemo_excel28.prog.abap new file mode 100644 index 0000000..88c7cb8 --- /dev/null +++ b/src/zdemo_excel28.prog.abap @@ -0,0 +1,116 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL28 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel28. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_file_name TYPE string, + lv_file_path TYPE string, + lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE '28_HelloWorld.csv'. + +PARAMETERS: p_path TYPE string. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = p_path + CHANGING selected_folder = p_path ). + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet1' ). + 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 ). + + column_dimension = lo_worksheet->get_column_dimension( 'B' ). + column_dimension->set_width( 11 ). + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the second sheet' ). + + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_csv. + zcl_excel_writer_csv=>set_delimiter( ip_value = cl_abap_char_utilities=>horizontal_tab ). + zcl_excel_writer_csv=>set_enclosure( ip_value = '''' ). + zcl_excel_writer_csv=>set_endofline( ip_value = cl_abap_char_utilities=>cr_lf ). + + zcl_excel_writer_csv=>set_active_sheet_index( i_active_worksheet = 2 ). +* zcl_excel_writer_csv=>set_active_sheet_index_by_name( I_WORKSHEET_NAME = 'Sheet2' ). + + lv_file = lo_excel_writer->write_file( lo_excel ). + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. +* " This method is only available on AS ABAP > 6.40 +* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +* lv_bytecount = xstrlen( lv_file ). + + " Save the file + REPLACE FIRST OCCURRENCE OF '.csv' IN lv_full_path WITH '_Sheet2.csv'. + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). + +* zcl_excel_writer_csv=>set_active_sheet_index( i_active_worksheet = 2 ). + zcl_excel_writer_csv=>set_active_sheet_index_by_name( I_WORKSHEET_NAME = 'Sheet1' ). + lv_file = lo_excel_writer->write_file( lo_excel ). + REPLACE FIRST OCCURRENCE OF '_Sheet2.csv' IN lv_full_path WITH '_Sheet1.csv'. + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. +* " This method is only available on AS ABAP > 6.40 +* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +* lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_excel28.prog.xml b/src/zdemo_excel28.prog.xml new file mode 100644 index 0000000..cff483f --- /dev/null +++ b/src/zdemo_excel28.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZDEMO_EXCEL28 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: export in CSV + 29 + + + + + diff --git a/src/zdemo_excel29.prog.abap b/src/zdemo_excel29.prog.abap new file mode 100644 index 0000000..a65ba98 --- /dev/null +++ b/src/zdemo_excel29.prog.abap @@ -0,0 +1,80 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL26 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel29. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_excel_reader TYPE REF TO zif_excel_reader. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_filename TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +PARAMETERS: p_path TYPE zexcel_export_dir OBLIGATORY. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + + DATA: lt_filetable TYPE filetable, + lv_rc TYPE i. + + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + + CALL METHOD cl_gui_frontend_services=>file_open_dialog + EXPORTING + window_title = 'Select Macro-Enabled Workbook template' + default_extension = '*.xlsm' + file_filter = 'Excel Macro-Enabled Workbook (*.xlsm)|*.xlsm' + initial_directory = lv_workdir + CHANGING + file_table = lt_filetable + rc = lv_rc + EXCEPTIONS + file_open_dialog_failed = 1 + cntl_error = 2 + error_no_gui = 3 + not_supported_by_gui = 4 + OTHERS = 5. + IF sy-subrc <> 0. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + READ TABLE lt_filetable INTO lv_filename INDEX 1. + p_path = lv_filename. + +START-OF-SELECTION. + + lv_full_path = p_path. + + CREATE OBJECT lo_excel_reader TYPE zcl_excel_reader_xlsm. + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_xlsm. + lo_excel = lo_excel_reader->load_file( lv_full_path ). + lv_file = lo_excel_writer->write_file( lo_excel ). + REPLACE '.xlsm' IN lv_full_path WITH 'FromReader.xlsm'. + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_excel29.prog.xml b/src/zdemo_excel29.prog.xml new file mode 100644 index 0000000..30e34c5 --- /dev/null +++ b/src/zdemo_excel29.prog.xml @@ -0,0 +1,31 @@ + + + + + + ZDEMO_EXCEL29 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Marco-Enabled workbook + 38 + + + S + P_PATH + Macro-enabled Workbook + 30 + + + + + diff --git a/src/zdemo_excel3.prog.abap b/src/zdemo_excel3.prog.abap new file mode 100644 index 0000000..53584bf --- /dev/null +++ b/src/zdemo_excel3.prog.abap @@ -0,0 +1,89 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel3. + +TYPE-POOLS: abap. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + +DATA: ls_table_settings TYPE zexcel_s_table_settings. + + +DATA: lv_title TYPE zexcel_sheet_title, + lt_carr TYPE TABLE OF scarr, + row TYPE zexcel_cell_row VALUE 2, + lo_range TYPE REF TO zcl_excel_range. +DATA: lo_data_validation TYPE REF TO zcl_excel_data_validation. +FIELD-SYMBOLS: LIKE LINE OF lt_carr. + +CONSTANTS: c_airlines TYPE string VALUE 'Airlines'. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '03_iTab.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +PARAMETERS: p_empty TYPE flag. + +START-OF-SELECTION. + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Internal table'). + + DATA lt_test TYPE TABLE OF sflight. + + IF p_empty <> abap_true. + SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE + ENDIF. + + ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2. + ls_table_settings-show_row_stripes = abap_true. + ls_table_settings-nofilters = abap_true. + + lo_worksheet->bind_table( ip_table = lt_test + is_table_settings = ls_table_settings ). + + lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling + + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). "make date field a bit wider + column_dimension->set_width( ip_width = 11 ). + " Add another table for data validations + lo_worksheet = lo_excel->add_new_worksheet( ). + lv_title = 'Data Validation'. + lo_worksheet->set_title( lv_title ). + lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = c_airlines ). + SELECT * FROM scarr INTO TABLE lt_carr. "#EC CI_NOWHERE + LOOP AT lt_carr ASSIGNING . + lo_worksheet->set_cell( ip_row = row ip_column = 'A' ip_value = -carrid ). + row = row + 1. + ENDLOOP. + row = row - 1. + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_airlines. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'A' + ip_start_row = 2 + ip_stop_column = 'A' + ip_stop_row = row ). + " Set Data Validation + lo_excel->set_active_sheet_index( 1 ). + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_airlines. + lo_data_validation->cell_row = 4. + lo_data_validation->cell_column = 'C'. + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel3.prog.xml b/src/zdemo_excel3.prog.xml new file mode 100644 index 0000000..82bfe92 --- /dev/null +++ b/src/zdemo_excel3.prog.xml @@ -0,0 +1,38 @@ + + + + + + ZDEMO_EXCEL3 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Export internal table + 38 + + + S + P_EMPTY + Leave Table Empty + 25 + + + S + P_PATH + . + 24 + D + + + + + diff --git a/src/zdemo_excel30.prog.abap b/src/zdemo_excel30.prog.abap new file mode 100644 index 0000000..836df2b --- /dev/null +++ b/src/zdemo_excel30.prog.abap @@ -0,0 +1,99 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL1 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel30. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + + +DATA: lv_value TYPE string, + lv_count TYPE i VALUE 10, + lv_packed TYPE p LENGTH 16 DECIMALS 1 VALUE '1234567890.5'. + +CONSTANTS: lc_typekind_string TYPE abap_typekind VALUE cl_abap_typedescr=>typekind_string, + lc_typekind_packed TYPE abap_typekind VALUE cl_abap_typedescr=>typekind_packed, + lc_typekind_num TYPE abap_typekind VALUE cl_abap_typedescr=>typekind_num, + lc_typekind_date TYPE abap_typekind VALUE cl_abap_typedescr=>typekind_date, + lc_typekind_s_ls TYPE string VALUE 's_leading_blanks'. + +CONSTANTS: gc_save_file_name TYPE string VALUE '30_CellDataTypes.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Cell data types' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Number as String' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 2 ip_value = '11' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 1 ip_value = 'String' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = ' String with leading spaces' + ip_data_type = lc_typekind_s_ls ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = ' Negative Value' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 1 ip_value = 'Packed' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 2 ip_value = '50000.01-' + ip_abap_type = lc_typekind_packed ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 1 ip_value = 'Number with Percentage' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 2 ip_value = '0 %' + ip_abap_type = lc_typekind_num ). + lo_worksheet->set_cell( ip_column = 'E' ip_row = 1 ip_value = 'Date' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'E' ip_row = 2 ip_value = '20110831' + ip_abap_type = lc_typekind_date ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'Positive Value' + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = '5000.02' + ip_abap_type = lc_typekind_packed ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = '50 %' + ip_abap_type = lc_typekind_num ). + + WHILE lv_count <= 15. + lv_value = lv_count. + CONCATENATE 'Positive Value with' lv_value 'Digits' INTO lv_value SEPARATED BY space. + lo_worksheet->set_cell( ip_column = 'B' ip_row = lv_count ip_value = lv_value + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = lv_count ip_value = lv_packed + ip_abap_type = lc_typekind_packed ). + CONCATENATE 'Positive Value with' lv_value 'Digits formated as string' INTO lv_value SEPARATED BY space. + lo_worksheet->set_cell( ip_column = 'D' ip_row = lv_count ip_value = lv_value + ip_abap_type = lc_typekind_string ). + lo_worksheet->set_cell( ip_column = 'E' ip_row = lv_count ip_value = lv_packed + ip_abap_type = lc_typekind_string ). + lv_packed = lv_packed * 10. + lv_count = lv_count + 1. + ENDWHILE. + + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'A' ). + column_dimension->set_auto_size( abap_true ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + column_dimension->set_auto_size( abap_true ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + column_dimension->set_auto_size( abap_true ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'D' ). + column_dimension->set_auto_size( abap_true ). + column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). + column_dimension->set_auto_size( abap_true ). + + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel30.prog.xml b/src/zdemo_excel30.prog.xml new file mode 100644 index 0000000..55cdda3 --- /dev/null +++ b/src/zdemo_excel30.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL30 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: ABAP Cell data types + 37 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel31.prog.abap b/src/zdemo_excel31.prog.abap new file mode 100644 index 0000000..081003b --- /dev/null +++ b/src/zdemo_excel31.prog.abap @@ -0,0 +1,157 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL1 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel31. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_hyperlink TYPE REF TO zcl_excel_hyperlink, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime. + + +DATA: fieldval TYPE text80, + row TYPE i, + style_column_a TYPE REF TO zcl_excel_style, + style_column_a_guid TYPE zexcel_cell_style, + style_column_b TYPE REF TO zcl_excel_style, + style_column_b_guid TYPE zexcel_cell_style, + style_column_c TYPE REF TO zcl_excel_style, + style_column_c_guid TYPE zexcel_cell_style, + style_font TYPE REF TO zcl_excel_style_font. + +CONSTANTS: gc_save_file_name TYPE string VALUE '31_AutosizeWithDifferentFontSizes.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + " Use active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Regular Font' ). + + style_column_a = lo_excel->add_new_style( ). + style_column_a->font->size = 32. " quite large + style_column_a_guid = style_column_a->get_guid( ). + + style_column_c = lo_excel->add_new_style( ). + style_column_c->font->size = 16. " not so large + style_column_c_guid = style_column_c->get_guid( ). + + + DO 20 TIMES. + row = sy-index. + CLEAR fieldval. + DO sy-index TIMES. + CONCATENATE fieldval 'X' INTO fieldval. + ENDDO. + lo_worksheet->set_cell( ip_column = 'A' ip_row = row ip_value = fieldval ip_style = style_column_a_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = row ip_value = fieldval ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = row ip_value = fieldval ip_style = style_column_c_guid ). + ENDDO. + + column_dimension = lo_worksheet->get_column_dimension( 'A' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'B' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'C' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " Add sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Bold Font' ). + + style_column_a = lo_excel->add_new_style( ). + style_column_a->font->size = 32. " quite large + style_column_a->font->bold = abap_true. + style_column_a_guid = style_column_a->get_guid( ). + + style_column_b = lo_excel->add_new_style( ). + style_column_b->font->bold = abap_true. + style_column_b_guid = style_column_b->get_guid( ). + + style_column_c = lo_excel->add_new_style( ). + style_column_c->font->size = 16. " not so large + style_column_c->font->bold = abap_true. + style_column_c_guid = style_column_c->get_guid( ). + + DO 20 TIMES. + row = sy-index. + CLEAR fieldval. + DO sy-index TIMES. + CONCATENATE fieldval 'X' INTO fieldval. + ENDDO. + lo_worksheet->set_cell( ip_column = 'A' ip_row = row ip_value = fieldval ip_style = style_column_a_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = row ip_value = fieldval ip_style = style_column_b_guid ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = row ip_value = fieldval ip_style = style_column_c_guid ). + ENDDO. + + column_dimension = lo_worksheet->get_column_dimension( 'A' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'B' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'C' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " Add sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Italic Font' ). + + style_column_a = lo_excel->add_new_style( ). + style_column_a->font->size = 32. " quite large + style_column_a->font->italic = abap_true. + style_column_a_guid = style_column_a->get_guid( ). + + style_column_b = lo_excel->add_new_style( ). + style_column_b->font->italic = abap_true. + style_column_b_guid = style_column_b->get_guid( ). + + style_column_c = lo_excel->add_new_style( ). + style_column_c->font->size = 16. " not so large + style_column_c->font->italic = abap_true. + style_column_c_guid = style_column_c->get_guid( ). + + DO 20 TIMES. + row = sy-index. + CLEAR fieldval. + DO sy-index TIMES. + CONCATENATE fieldval 'X' INTO fieldval. + ENDDO. + lo_worksheet->set_cell( ip_column = 'A' ip_row = row ip_value = fieldval ip_style = style_column_a_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = row ip_value = fieldval ip_style = style_column_b_guid ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = row ip_value = fieldval ip_style = style_column_c_guid ). + ENDDO. + + column_dimension = lo_worksheet->get_column_dimension( 'A' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'B' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'C' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " Add sheet for merged cells + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Merged cells' ). + + lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'This is a very long header text' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 2 ip_value = 'Some data' ). + lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = 'Some more data' ). + + lo_worksheet->set_merge( + EXPORTING + ip_column_start = 'A' + ip_column_end = 'C' + ip_row = 1 ). + + column_dimension = lo_worksheet->get_column_dimension( 'A' ). + column_dimension->set_auto_size( ip_auto_size = abap_true ). + + lo_excel->set_active_sheet_index( i_active_worksheet = 1 ). + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel31.prog.xml b/src/zdemo_excel31.prog.xml new file mode 100644 index 0000000..64fbcd7 --- /dev/null +++ b/src/zdemo_excel31.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL31 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Autosize Column with different Font sizes + 58 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel33.prog.abap b/src/zdemo_excel33.prog.abap new file mode 100644 index 0000000..e27af3c --- /dev/null +++ b/src/zdemo_excel33.prog.abap @@ -0,0 +1,69 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel33. + +TYPE-POOLS: abap. + +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: l_cell_value TYPE zexcel_cell_value, + ls_area TYPE zexcel_s_autofilter_area. + +CONSTANTS: c_airlines TYPE string VALUE 'Airlines'. + +CONSTANTS: gc_save_file_name TYPE string VALUE '33_autofilter.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + 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 + + CREATE OBJECT lo_converter. + + lo_converter->convert( EXPORTING + it_table = lt_test + i_row_int = 1 + i_column_int = 1 + io_worksheet = lo_worksheet + CHANGING + co_excel = lo_excel ) . + + lo_autofilter = lo_excel->add_new_autofilter( io_sheet = lo_worksheet ) . + + ls_area-row_start = 1. + ls_area-col_start = 1. + ls_area-row_end = lo_worksheet->get_highest_row( ). + ls_area-col_end = lo_worksheet->get_highest_column( ). + + lo_autofilter->set_filter_area( is_area = ls_area ). + + lo_worksheet->get_cell( EXPORTING + ip_column = 'C' + ip_row = 2 + IMPORTING + ep_value = l_cell_value ). + lo_autofilter->set_value( i_column = 3 + i_value = l_cell_value ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel33.prog.xml b/src/zdemo_excel33.prog.xml new file mode 100644 index 0000000..ef66178 --- /dev/null +++ b/src/zdemo_excel33.prog.xml @@ -0,0 +1,38 @@ + + + + + + ZDEMO_EXCEL33 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Autofilter + 27 + + + S + P_EMPTY + Leave Table Empty + 25 + + + S + P_PATH + . + 24 + D + + + + + diff --git a/src/zdemo_excel34.prog.abap b/src/zdemo_excel34.prog.abap new file mode 100644 index 0000000..1334d8d --- /dev/null +++ b/src/zdemo_excel34.prog.abap @@ -0,0 +1,217 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL2 +*& Test Styles for ABAP2XLSX +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel34. + +CONSTANTS: width TYPE f VALUE '10.14'. +CONSTANTS: height TYPE f VALUE '57.75'. + +DATA: current_row TYPE i, + col TYPE i, + col_alpha TYPE zexcel_cell_column_alpha, + row TYPE i, + row_board TYPE i, + colorflag TYPE i, + color TYPE zexcel_style_color_argb, + + column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, + + writing1 TYPE string, + writing2 TYPE string. + + + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +CONSTANTS: gc_save_file_name TYPE string VALUE '34_Static Styles_Chess.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Spassky_vs_Bronstein' ). + +* Header + current_row = 1. + + ADD 1 TO current_row. + lo_worksheet->set_cell( ip_row = current_row ip_column = 'B' ip_value = 'White' ). + lo_worksheet->set_cell( ip_row = current_row ip_column = 'C' ip_value = 'Spassky, Boris V -- wins in turn 23' ). + + ADD 1 TO current_row. + lo_worksheet->set_cell( ip_row = current_row ip_column = 'B' ip_value = 'Black' ). + lo_worksheet->set_cell( ip_row = current_row ip_column = 'C' ip_value = 'Bronstein, David I' ). + + ADD 1 TO current_row. +* Set size of column + Writing above chessboard + DO 8 TIMES. + + writing1 = zcl_excel_common=>convert_column2alpha( sy-index ). + writing2 = sy-index . + row = current_row + sy-index. + + col = sy-index + 1. + col_alpha = zcl_excel_common=>convert_column2alpha( col ). + +* Set size of column + column_dimension = lo_worksheet->get_column_dimension( col_alpha ). + column_dimension->set_width( width ). + +* Set size of row + row_dimension = lo_worksheet->get_row_dimension( row ). + row_dimension->set_row_height( height ). + +* Set writing on chessboard + lo_worksheet->set_cell( ip_row = row + ip_column = 'A' + ip_value = writing2 ). + lo_worksheet->change_cell_style( ip_column = 'A' + ip_row = row + ip_alignment_vertical = zcl_excel_style_alignment=>c_vertical_center ). + lo_worksheet->set_cell( ip_row = row + ip_column = 'J' + ip_value = writing2 ). + lo_worksheet->change_cell_style( ip_column = 'J' + ip_row = row + ip_alignment_vertical = zcl_excel_style_alignment=>c_vertical_center ). + + row = current_row + 9. + lo_worksheet->set_cell( ip_row = current_row + ip_column = col_alpha + ip_value = writing1 ). + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = current_row + ip_alignment_horizontal = zcl_excel_style_alignment=>c_horizontal_center ). + lo_worksheet->set_cell( ip_row = row + ip_column = col_alpha + ip_value = writing1 ). + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_alignment_horizontal = zcl_excel_style_alignment=>c_horizontal_center ). + ENDDO. + column_dimension = lo_worksheet->get_column_dimension( 'A' ). + column_dimension->set_auto_size( abap_true ). + column_dimension = lo_worksheet->get_column_dimension( 'J' ). + column_dimension->set_auto_size( abap_true ). + +* Set win-position + CONSTANTS: c_pawn TYPE string VALUE 'Pawn'. + CONSTANTS: c_rook TYPE string VALUE 'Rook'. + CONSTANTS: c_knight TYPE string VALUE 'Knight'. + CONSTANTS: c_bishop TYPE string VALUE 'Bishop'. + CONSTANTS: c_queen TYPE string VALUE 'Queen'. + CONSTANTS: c_king TYPE string VALUE 'King'. + + row = current_row + 1. + lo_worksheet->set_cell( ip_row = row ip_column = 'B' ip_value = c_rook ). + lo_worksheet->set_cell( ip_row = row ip_column = 'F' ip_value = c_rook ). + lo_worksheet->set_cell( ip_row = row ip_column = 'G' ip_value = c_knight ). + row = current_row + 2. + lo_worksheet->set_cell( ip_row = row ip_column = 'B' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'C' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'D' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'F' ip_value = c_queen ). + lo_worksheet->set_cell( ip_row = row ip_column = 'H' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'I' ip_value = c_king ). + row = current_row + 3. + lo_worksheet->set_cell( ip_row = row ip_column = 'I' ip_value = c_pawn ). + row = current_row + 4. + lo_worksheet->set_cell( ip_row = row ip_column = 'D' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'F' ip_value = c_knight ). + row = current_row + 5. + lo_worksheet->set_cell( ip_row = row ip_column = 'E' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'F' ip_value = c_queen ). + row = current_row + 6. + lo_worksheet->set_cell( ip_row = row ip_column = 'C' ip_value = c_bishop ). + row = current_row + 7. + lo_worksheet->set_cell( ip_row = row ip_column = 'B' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'C' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'H' ip_value = c_pawn ). + lo_worksheet->set_cell( ip_row = row ip_column = 'I' ip_value = c_pawn ). + row = current_row + 8. + lo_worksheet->set_cell( ip_row = row ip_column = 'G' ip_value = c_rook ). + lo_worksheet->set_cell( ip_row = row ip_column = 'H' ip_value = c_king ). + +* Set Chessboard + DO 8 TIMES. + IF sy-index <= 3. " Black + color = zcl_excel_style_color=>c_black. + ELSE. + color = zcl_excel_style_color=>c_white. + ENDIF. + row_board = sy-index. + row = current_row + sy-index. + DO 8 TIMES. + col = sy-index + 1. + col_alpha = zcl_excel_common=>convert_column2alpha( col ). + TRY. +* Borders around outer limits + IF row_board = 1. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_borders_top_style = zcl_excel_style_border=>c_border_thick + ip_borders_top_color_rgb = zcl_excel_style_color=>c_black ). + ENDIF. + IF row_board = 8. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_borders_down_style = zcl_excel_style_border=>c_border_thick + ip_borders_down_color_rgb = zcl_excel_style_color=>c_black ). + ENDIF. + IF col = 2. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_borders_left_style = zcl_excel_style_border=>c_border_thick + ip_borders_left_color_rgb = zcl_excel_style_color=>c_black ). + ENDIF. + IF col = 9. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_borders_right_style = zcl_excel_style_border=>c_border_thick + ip_borders_right_color_rgb = zcl_excel_style_color=>c_black ). + ENDIF. +* Style for writing + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_font_color_rgb = color + ip_font_bold = 'X' + ip_font_size = 16 + ip_alignment_horizontal = zcl_excel_style_alignment=>c_horizontal_center + ip_alignment_vertical = zcl_excel_style_alignment=>c_vertical_center + ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid ). +* Color of field + colorflag = ( row + col ) MOD 2. + IF colorflag = 0. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_fill_fgcolor_rgb = 'FFB5866A' + ip_fill_filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal135 ). + ELSE. + lo_worksheet->change_cell_style( ip_column = col_alpha + ip_row = row + ip_fill_fgcolor_rgb = 'FFF5DEBF' + ip_fill_filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal45 ). + ENDIF. + + + + CATCH zcx_excel . + ENDTRY. + + ENDDO. + ENDDO. + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel34.prog.xml b/src/zdemo_excel34.prog.xml new file mode 100644 index 0000000..889417b --- /dev/null +++ b/src/zdemo_excel34.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL34 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Static Styles (Chess) + 37 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel35.prog.abap b/src/zdemo_excel35.prog.abap new file mode 100644 index 0000000..0fa58d9 --- /dev/null +++ b/src/zdemo_excel35.prog.abap @@ -0,0 +1,176 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL2 +*& Test Styles for ABAP2XLSX +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel35. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_bold TYPE REF TO zcl_excel_style, + lo_style_underline TYPE REF TO zcl_excel_style, + lo_style_filled TYPE REF TO zcl_excel_style, + lo_style_border TYPE REF TO zcl_excel_style, + lo_style_button TYPE REF TO zcl_excel_style, + lo_border_dark TYPE REF TO zcl_excel_style_border, + lo_border_light TYPE REF TO zcl_excel_style_border. + +DATA: lv_style_bold_guid TYPE zexcel_cell_style, + lv_style_underline_guid TYPE zexcel_cell_style, + lv_style_filled_guid TYPE zexcel_cell_style, + lv_style_filled_green_guid TYPE zexcel_cell_style, + lv_style_border_guid TYPE zexcel_cell_style, + lv_style_button_guid TYPE zexcel_cell_style, + lv_style_filled_turquoise_guid TYPE zexcel_cell_style. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE '35_Static_Styles.xlsx'. + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>GET_DESKTOP_DIRECTORY( CHANGING DESKTOP_DIRECTORY = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + + sy-title = 'ZDEMO_EXCEL2;Issue 139: Change cellstyle retroactivly'. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create border object + CREATE OBJECT lo_border_dark. + lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black. + lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin. + CREATE OBJECT lo_border_light. + lo_border_light->border_color-rgb = zcl_excel_style_color=>c_gray. + lo_border_light->border_style = zcl_excel_style_border=>c_border_thin. + " Create a bold / italic style + lo_style_bold = lo_excel->add_new_style( ). + lo_style_bold->font->bold = abap_true. + lo_style_bold->font->italic = abap_true. + lo_style_bold->font->name = zcl_excel_style_font=>c_name_arial. + lo_style_bold->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_bold->font->color-rgb = zcl_excel_style_color=>c_red. + lv_style_bold_guid = lo_style_bold->get_guid( ). + " Create an underline double style + lo_style_underline = lo_excel->add_new_style( ). + lo_style_underline->font->underline = abap_true. + lo_style_underline->font->underline_mode = zcl_excel_style_font=>c_underline_double. + lo_style_underline->font->name = zcl_excel_style_font=>c_name_roman. + lo_style_underline->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_underline->font->family = zcl_excel_style_font=>c_family_roman. + lv_style_underline_guid = lo_style_underline->get_guid( ). + " Create filled style yellow + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-theme = zcl_excel_style_color=>c_theme_accent6. + lv_style_filled_guid = lo_style_filled->get_guid( ). + " Create border with button effects + lo_style_button = lo_excel->add_new_style( ). + lo_style_button->borders->right = lo_border_dark. + lo_style_button->borders->down = lo_border_dark. + lo_style_button->borders->left = lo_border_light. + lo_style_button->borders->top = lo_border_light. + lv_style_button_guid = lo_style_button->get_guid( ). + "Create style with border + lo_style_border = lo_excel->add_new_style( ). + lo_style_border->borders->allborders = lo_border_dark. + lo_style_border->borders->diagonal = lo_border_dark. + lo_style_border->borders->diagonal_mode = zcl_excel_style_borders=>c_diagonal_both. + lv_style_border_guid = lo_style_border->get_guid( ). + " Create filled style green + lo_style_filled = lo_excel->add_new_style( ). + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_green. + lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major. + lv_style_filled_green_guid = lo_style_filled->get_guid( ). + + " Create filled style turquoise using legacy excel ver <= 2003 palette. (https://code.sdn.sap.com/spaces/abap2xlsx/tickets/92) + lo_style_filled = lo_excel->add_new_style( ). + lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise + ip_index = 16 + ip_color = '0040E0D0' ). + + lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_filled->fill->fgcolor-indexed = 16. + lv_style_filled_turquoise_guid = lo_style_filled->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Styles' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_bold_guid ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ip_style = lv_style_underline_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ip_style = lv_style_filled_guid ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ip_style = lv_style_border_guid ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ip_style = lv_style_button_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ip_style = lv_style_filled_turquoise_guid ). + " Fill the cell and apply one style + lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ip_style = lv_style_filled_guid ). + " Change the style + lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ip_style = lv_style_filled_green_guid ). + " Add Style to an empty cell to test Fix for Issue + "#44 Exception ZCX_EXCEL thrown when style is set for an empty cell + " https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell + lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ip_style = lv_style_filled_green_guid ). + + +* Demonstrate how to retroactivly change the cellstyle +*Filled text and underlinded text + lo_worksheet->change_cell_style( ip_column = 'B' + ip_row = 5 + ip_font_bold = abap_true + ip_font_italic = abap_true ). + + lo_worksheet->change_cell_style( ip_column = 'D' + ip_row = 4 + ip_font_bold = abap_true + ip_font_italic = abap_true ). + + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + + " Convert to binary + CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' + EXPORTING + buffer = lv_file + IMPORTING + output_length = lv_bytecount + TABLES + binary_tab = lt_file_tab. +* " This method is only available on AS ABAP > 6.40 +* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). +* lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_excel35.prog.xml b/src/zdemo_excel35.prog.xml new file mode 100644 index 0000000..2075ad1 --- /dev/null +++ b/src/zdemo_excel35.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL35 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: static styles + 33 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel36.prog.abap b/src/zdemo_excel36.prog.abap new file mode 100644 index 0000000..74f2258 --- /dev/null +++ b/src/zdemo_excel36.prog.abap @@ -0,0 +1,111 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL36 +REPORT zdemo_excel36. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + col TYPE i. + +DATA: lo_style_arial20 TYPE REF TO zcl_excel_style, + lo_style_times11 TYPE REF TO zcl_excel_style, + lo_style_cambria8red TYPE REF TO zcl_excel_style. + +DATA: lv_style_arial20_guid TYPE zexcel_cell_style, + lv_style_times11_guid TYPE zexcel_cell_style, + lv_style_cambria8red_guid TYPE zexcel_cell_style. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '36_DefaultStyles.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create a bold / italic style + lo_style_arial20 = lo_excel->add_new_style( ). + lo_style_arial20->font->name = zcl_excel_style_font=>c_name_arial. + lo_style_arial20->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_arial20->font->size = 20. + lv_style_arial20_guid = lo_style_arial20->get_guid( ). + + lo_style_times11 = lo_excel->add_new_style( ). + lo_style_times11->font->name = zcl_excel_style_font=>c_name_roman. + lo_style_times11->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_times11->font->size = 11. + lv_style_times11_guid = lo_style_times11->get_guid( ). + + lo_style_cambria8red = lo_excel->add_new_style( ). + lo_style_cambria8red->font->name = zcl_excel_style_font=>c_name_cambria. + lo_style_cambria8red->font->scheme = zcl_excel_style_font=>c_scheme_none. + lo_style_cambria8red->font->size = 8. + lo_style_cambria8red->font->color-rgb = zcl_excel_style_color=>c_red. + lv_style_cambria8red_guid = lo_style_cambria8red->get_guid( ). + + lo_excel->set_default_style( lv_style_arial20_guid ). " Default for all new worksheets + +* 1st sheet - do not change anything --> defaultstyle from lo_excel should apply + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'Style for complete document' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 4 ip_value = 'All cells in this sheet are set to font Arial, fontsize 20' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 5 ip_value = 'because no separate style was passed for this sheet' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 6 ip_value = 'but a default style was set for the complete instance of zcl_excel' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 1 ip_value = space ). " Missing feature "set active cell - use this to simulate that + + +* 2nd sheet - defaultstyle for this sheet set explicitly ( set to Times New Roman 11 ) + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( 'Style for this sheet' ). + lo_worksheet->zif_excel_sheet_properties~set_style( lv_style_times11_guid ). + + lo_worksheet->set_cell( ip_column = 2 ip_row = 4 ip_value = 'All cells in this sheet are set to font Times New Roman, fontsize 11' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 5 ip_value = 'because this style was passed for this sheet' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 6 ip_value = 'thus the default style from zcl_excel does not apply to this sheet' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 1 ip_value = space ). " Missing feature "set active cell - use this to simulate that + + +* 3rd sheet - defaultstyle for columns ( set to Times New Roman 11 ) + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( 'Style for 3 columns' ). + column_dimension = lo_worksheet->get_column_dimension( 'B' ). + column_dimension->set_column_style_by_guid( ip_style_guid = lv_style_times11_guid ). + column_dimension = lo_worksheet->get_column_dimension( 'C' ). + column_dimension->set_column_style_by_guid( ip_style_guid = lv_style_times11_guid ). + column_dimension = lo_worksheet->get_column_dimension( 'F' ). + column_dimension->set_column_style_by_guid( ip_style_guid = lv_style_times11_guid ). + + lo_worksheet->set_cell( ip_column = 2 ip_row = 4 ip_value = 'The columns B,C and F are set to Times New Roman' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 10 ip_value = 'All other cells in this sheet are set to font Arial, fontsize 20' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 11 ip_value = 'because no separate style was passed for this sheet' ). + lo_worksheet->set_cell( ip_column = 2 ip_row = 12 ip_value = 'but a default style was set for the complete instance of zcl_excel' ). + + lo_worksheet->set_cell( ip_column = 8 ip_row = 1 ip_value = 'Of course' ip_style = lv_style_cambria8red_guid ). + lo_worksheet->set_cell( ip_column = 8 ip_row = 2 ip_value = 'setting a specific style to a cell' ip_style = lv_style_cambria8red_guid ). + lo_worksheet->set_cell( ip_column = 8 ip_row = 3 ip_value = 'takes precedence over all defaults' ip_style = lv_style_cambria8red_guid ). + lo_worksheet->set_cell( ip_column = 8 ip_row = 4 ip_value = 'Here: Cambria 8 in red' ip_style = lv_style_cambria8red_guid ). + + +* Set entry into each of the first 10 columns + DO 20 TIMES. + col = sy-index. + CASE col. + WHEN 2 " B + OR 3 " C + OR 6." F + lo_worksheet->set_cell( ip_column = col ip_row = 6 ip_value = 'Times 11' ). + WHEN OTHERS. + lo_worksheet->set_cell( ip_column = col ip_row = 6 ip_value = 'Arial 20' ). + ENDCASE. + ENDDO. + + lo_worksheet->set_cell( ip_column = 2 ip_row = 1 ip_value = space ). " Missing feature "set active cell - use this to simulate that + + + + lo_excel->set_active_sheet_index( 1 ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel36.prog.xml b/src/zdemo_excel36.prog.xml new file mode 100644 index 0000000..3489258 --- /dev/null +++ b/src/zdemo_excel36.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZDEMO_EXCEL36 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Default Styles + 31 + + + + + diff --git a/src/zdemo_excel37.prog.abap b/src/zdemo_excel37.prog.abap new file mode 100644 index 0000000..94dce0b --- /dev/null +++ b/src/zdemo_excel37.prog.abap @@ -0,0 +1,301 @@ +REPORT zdemo_excel37. + +TYPE-POOLS: vrm. + +DATA: excel TYPE REF TO zcl_excel, + reader TYPE REF TO zif_excel_reader, + go_error TYPE REF TO cx_root, + gv_memid_gr8 TYPE text255, + gv_message TYPE string, + lv_extension TYPE string, + gv_error_program_name TYPE syrepid, + gv_error_include_name TYPE syrepid, + gv_error_line TYPE i. + +DATA: gc_save_file_name TYPE string VALUE '37- Read template and output.&'. + +SELECTION-SCREEN BEGIN OF BLOCK blx WITH FRAME. +PARAMETERS: p_upfile TYPE string LOWER CASE MEMORY ID gr8. +SELECTION-SCREEN END OF BLOCK blx. + +INCLUDE zdemo_excel_outputopt_incl. + +SELECTION-SCREEN BEGIN OF BLOCK cls WITH FRAME TITLE text-cls. +PARAMETERS: lb_read TYPE seoclsname AS LISTBOX VISIBLE LENGTH 40 LOWER CASE OBLIGATORY DEFAULT 'Autodetect'(001). +PARAMETERS: lb_write TYPE seoclsname AS LISTBOX VISIBLE LENGTH 40 LOWER CASE OBLIGATORY DEFAULT 'Autodetect'(001). +SELECTION-SCREEN END OF BLOCK cls. + +SELECTION-SCREEN BEGIN OF BLOCK bl_err WITH FRAME TITLE text-err. +PARAMETERS: cb_errl AS CHECKBOX DEFAULT 'X'. +SELECTION-SCREEN BEGIN OF LINE. +PARAMETERS: cb_dump AS CHECKBOX DEFAULT space. +SELECTION-SCREEN COMMENT (60) cmt_dump FOR FIELD cb_dump. +SELECTION-SCREEN END OF LINE. +SELECTION-SCREEN END OF BLOCK bl_err. + +INITIALIZATION. + PERFORM setup_listboxes. + cmt_dump = text-dum. + GET PARAMETER ID 'GR8' FIELD gv_memid_gr8. + p_upfile = gv_memid_gr8. + + IF p_upfile IS INITIAL. + p_upfile = 'c:\temp\whatever.xlsx'. + ENDIF. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_upfile. + PERFORM f4_p_upfile CHANGING p_upfile. + + +START-OF-SELECTION. + IF cb_dump IS INITIAL. + TRY. + PERFORM read_template. + PERFORM write_template. +*** Create output + CATCH cx_root INTO go_error. + MESSAGE 'Error reading excelfile' TYPE 'I'. + gv_message = go_error->get_text( ). + IF cb_errl = ' '. + IF gv_message IS NOT INITIAL. + MESSAGE gv_message TYPE 'I'. + ENDIF. + ELSE. + go_error->get_source_position( IMPORTING program_name = gv_error_program_name + include_name = gv_error_include_name + source_line = gv_error_line ). + WRITE:/ 'Errormessage:' ,gv_message. + WRITE:/ 'Errorposition:', + AT /10 'Program:' ,gv_error_program_name, + AT /10 'include_name:' ,gv_error_include_name, + AT /10 'source_line:' ,gv_error_line. + ENDIF. + ENDTRY. + ELSE. " This will dump if an error occurs. In some cases the information given in cx_root is not helpful - this will show exactly where the problem is + PERFORM read_template. + PERFORM write_template. + ENDIF. + + + +*&---------------------------------------------------------------------* +*& Form F4_P_UPFILE +*&---------------------------------------------------------------------* +FORM f4_p_upfile CHANGING p_upfile TYPE string. + + DATA: lv_repid TYPE syrepid, + lt_fields TYPE dynpread_tabtype, + ls_field LIKE LINE OF lt_fields, + lt_files TYPE filetable, + lv_file_filter TYPE string. + + lv_repid = sy-repid. + + CALL FUNCTION 'DYNP_VALUES_READ' + EXPORTING + dyname = lv_repid + dynumb = '1000' + request = 'A' + TABLES + dynpfields = lt_fields + EXCEPTIONS + invalid_abapworkarea = 01 + invalid_dynprofield = 02 + invalid_dynproname = 03 + invalid_dynpronummer = 04 + invalid_request = 05 + no_fielddescription = 06 + undefind_error = 07. + READ TABLE lt_fields INTO ls_field WITH KEY fieldname = 'P_UPFILE'. + p_upfile = ls_field-fieldvalue. + + lv_file_filter = 'Excel Files (*.XLSX;*.XLSM)|*.XLSX;*.XLSM'. + cl_gui_frontend_services=>file_open_dialog( EXPORTING + default_filename = p_upfile + file_filter = lv_file_filter + CHANGING + file_table = lt_files + rc = sy-tabix + EXCEPTIONS + OTHERS = 1 ). + READ TABLE lt_files INDEX 1 INTO p_upfile. + +ENDFORM. " F4_P_UPFILE + + +*&---------------------------------------------------------------------* +*& Form SETUP_LISTBOXES +*&---------------------------------------------------------------------* +FORM setup_listboxes . + + DATA: lv_id TYPE vrm_id, + lt_values TYPE vrm_values, + lt_implementing_classes TYPE seo_relkeys. + + FIELD-SYMBOLS: LIKE LINE OF lt_implementing_classes, + LIKE LINE OF lt_values. + +*--------------------------------------------------------------------* +* Possible READER-Classes +*--------------------------------------------------------------------* + lv_id = 'LB_READ'. + APPEND INITIAL LINE TO lt_values ASSIGNING . + -key = 'Autodetect'(001). + -text = 'Autodetect'(001). + + + PERFORM get_implementing_classds USING 'ZIF_EXCEL_READER' + CHANGING lt_implementing_classes. + CLEAR lt_values. + LOOP AT lt_implementing_classes ASSIGNING . + + APPEND INITIAL LINE TO lt_values ASSIGNING . + -key = -clsname. + -text = -clsname. + + ENDLOOP. + + CALL FUNCTION 'VRM_SET_VALUES' + EXPORTING + id = lv_id + values = lt_values + EXCEPTIONS + id_illegal_name = 1 + OTHERS = 2. + +*--------------------------------------------------------------------* +* Possible WRITER-Classes +*--------------------------------------------------------------------* + lv_id = 'LB_WRITE'. + APPEND INITIAL LINE TO lt_values ASSIGNING . + -key = 'Autodetect'(001). + -text = 'Autodetect'(001). + + + PERFORM get_implementing_classds USING 'ZIF_EXCEL_WRITER' + CHANGING lt_implementing_classes. + CLEAR lt_values. + LOOP AT lt_implementing_classes ASSIGNING . + + APPEND INITIAL LINE TO lt_values ASSIGNING . + -key = -clsname. + -text = -clsname. + + ENDLOOP. + + CALL FUNCTION 'VRM_SET_VALUES' + EXPORTING + id = lv_id + values = lt_values + EXCEPTIONS + id_illegal_name = 1 + OTHERS = 2. + +ENDFORM. " SETUP_LISTBOXES + + +*&---------------------------------------------------------------------* +*& Form GET_IMPLEMENTING_CLASSDS +*&---------------------------------------------------------------------* +FORM get_implementing_classds USING iv_interface_name TYPE clike + CHANGING ct_implementing_classes TYPE seo_relkeys. + + DATA: lo_oo_interface TYPE REF TO cl_oo_interface, + lo_oo_class TYPE REF TO cl_oo_class, + lt_implementing_subclasses TYPE seo_relkeys. + + FIELD-SYMBOLS: LIKE LINE OF ct_implementing_classes. + + TRY. + lo_oo_interface ?= cl_oo_interface=>get_instance( iv_interface_name ). + CATCH cx_class_not_existent. + RETURN. + ENDTRY. + ct_implementing_classes = lo_oo_interface->get_implementing_classes( ). + + LOOP AT ct_implementing_classes ASSIGNING . + TRY. + lo_oo_class ?= cl_oo_class=>get_instance( -clsname ). + lt_implementing_subclasses = lo_oo_class->get_subclasses( ). + APPEND LINES OF lt_implementing_subclasses TO ct_implementing_classes. + CATCH cx_class_not_existent. + ENDTRY. + ENDLOOP. + + +ENDFORM. " GET_IMPLEMENTING_CLASSDS + + +*&---------------------------------------------------------------------* +*& Form READ_TEMPLATE +*&---------------------------------------------------------------------* +FORM read_template RAISING zcx_excel . + + CASE lb_read. + WHEN 'Autodetect'(001). + FIND REGEX '(\.xlsx|\.xlsm)\s*$' IN p_upfile SUBMATCHES lv_extension. + TRANSLATE lv_extension TO UPPER CASE. + CASE lv_extension. + + WHEN '.XLSX'. + CREATE OBJECT reader TYPE zcl_excel_reader_2007. + excel = reader->load_file( p_upfile ). + "Use template for charts + excel->use_template = abap_true. + + WHEN '.XLSM'. + CREATE OBJECT reader TYPE zcl_excel_reader_xlsm. + excel = reader->load_file( p_upfile ). + "Use template for charts + excel->use_template = abap_true. + + WHEN OTHERS. + MESSAGE 'Unsupported filetype' TYPE 'I'. + RETURN. + + ENDCASE. + + WHEN OTHERS. + CREATE OBJECT reader TYPE (lb_read). + excel = reader->load_file( p_upfile ). + "Use template for charts + excel->use_template = abap_true. + + ENDCASE. + +ENDFORM. " READ_TEMPLATE + + +*&---------------------------------------------------------------------* +*& Form WRITE_TEMPLATE +*&---------------------------------------------------------------------* +FORM write_template RAISING zcx_excel. + + CASE lb_write. + + WHEN 'Autodetect'(001). + FIND REGEX '(\.xlsx|\.xlsm)\s*$' IN p_upfile SUBMATCHES lv_extension. + TRANSLATE lv_extension TO UPPER CASE. + CASE lv_extension. + + WHEN '.XLSX'. + REPLACE '&' IN gc_save_file_name WITH 'xlsx'. " Pass extension for standard writer + lcl_output=>output( excel ). + + WHEN '.XLSM'. + REPLACE '&' IN gc_save_file_name WITH 'xlsm'. " Pass extension for macro-writer + lcl_output=>output( cl_excel = excel + iv_writerclass_name = 'ZCL_EXCEL_WRITER_XLSM' ). + + WHEN OTHERS. + MESSAGE 'Unsupported filetype' TYPE 'I'. + RETURN. + + ENDCASE. + + WHEN OTHERS. + lcl_output=>output( cl_excel = excel + iv_writerclass_name = lb_write ). + ENDCASE. + +ENDFORM. " WRITE_TEMPLATE diff --git a/src/zdemo_excel37.prog.xml b/src/zdemo_excel37.prog.xml new file mode 100644 index 0000000..ce42f65 --- /dev/null +++ b/src/zdemo_excel37.prog.xml @@ -0,0 +1,133 @@ + + + + + + ZDEMO_EXCEL37 + A + X + 1 + T + E + X + X + + + + + I + CLS + Choose reader- and writerclass to use + 70 + + + I + DUM + Dump on uncaught exception - you'll know when you need this + 60 + + + I + ERR + Special switches + 60 + + + R + Read xlsx-file and output = using templates + 43 + + + S + CB_DUMP + Dump for uncaught exceptions + 36 + + + S + CB_ERRL + Show position of exception + 34 + + + S + LB_READ + Reader-class + 20 + + + S + LB_WRITE + Writer-class + 20 + + + S + P_UPFILE + File to upload + 22 + + + + + D + + + I + CLS + Auswahl der Reader- und Writerklasse + 70 + + + I + DUM + Dump bei unbeh. Exception. Man weiß wenn man das braucht + 60 + + + I + ERR + Besondere Schalter + 60 + + + R + Xlsx-Datei lesen und dann wieder ausgeben = Arbeiten mit Templates + 70 + + + S + CB_DUMP + Dump bei unbeh. Exceptions + 36 + + + S + CB_ERRL + Exceptionposition anzeigen + 34 + + + S + LB_READ + Reader-Klasse + 21 + + + S + LB_WRITE + Writer-Klasse + 21 + + + S + P_UPFILE + Hochzuladende Datei + 27 + + + + + + + diff --git a/src/zdemo_excel38.prog.abap b/src/zdemo_excel38.prog.abap new file mode 100644 index 0000000..553f151 --- /dev/null +++ b/src/zdemo_excel38.prog.abap @@ -0,0 +1,106 @@ +REPORT. + + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lo_drawing TYPE REF TO zcl_excel_drawing. + +TYPES: BEGIN OF gty_icon, +* name TYPE icon_name, "Fix #228 + name TYPE iconname, "Fix #228 + objid TYPE w3objid, + END OF gty_icon, + gtyt_icon TYPE STANDARD TABLE OF gty_icon WITH NON-UNIQUE DEFAULT KEY. + +DATA: lt_icon TYPE gtyt_icon, + lv_row TYPE sytabix, + ls_wwwdatatab TYPE wwwdatatab, + lt_mimedata TYPE STANDARD TABLE OF w3mime WITH NON-UNIQUE DEFAULT KEY, + lv_xstring TYPE xstring. + +FIELD-SYMBOLS: LIKE LINE OF lt_icon, + LIKE LINE OF lt_mimedata. + +CONSTANTS: gc_save_file_name TYPE string VALUE '38_SAP-Icons.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +TABLES: icon. +SELECT-OPTIONS: s_icon FOR icon-name DEFAULT 'ICON_LED_*' OPTION CP. + +START-OF-SELECTION. + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo Icons' ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'A' ). + lo_column_dimension->set_auto_size( 'X' ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + lo_column_dimension->set_auto_size( 'X' ). + +* Get all icons + SELECT name + INTO TABLE lt_icon + FROM icon + WHERE name IN s_icon + ORDER BY name. + LOOP AT lt_icon ASSIGNING . + + lv_row = sy-tabix. +*--------------------------------------------------------------------* +* Set name of icon +*--------------------------------------------------------------------* + lo_worksheet->set_cell( ip_row = lv_row + ip_column = 'A' + ip_value = -name ). +*--------------------------------------------------------------------* +* Check whether the mime-repository holds some icondata for us +*--------------------------------------------------------------------* + +* Get key + SELECT SINGLE objid + INTO -objid + FROM wwwdata + WHERE text = -name. + CHECK sy-subrc = 0. " :o( + lo_worksheet->set_cell( ip_row = lv_row + ip_column = 'B' + ip_value = -objid ). + +* Load mimedata + CLEAR lt_mimedata. + CLEAR ls_wwwdatatab. + ls_wwwdatatab-relid = 'MI' . + ls_wwwdatatab-objid = -objid. + CALL FUNCTION 'WWWDATA_IMPORT' + EXPORTING + key = ls_wwwdatatab + TABLES + mime = lt_mimedata + EXCEPTIONS + wrong_object_type = 1 + import_error = 2 + OTHERS = 3. + CHECK sy-subrc = 0. " :o( + + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = lv_row + ip_from_col = 'C' ). + CLEAR lv_xstring. + LOOP AT lt_mimedata ASSIGNING . + CONCATENATE lv_xstring -line INTO lv_xstring IN BYTE MODE. + ENDLOOP. + + lo_drawing->set_media( ip_media = lv_xstring + ip_media_type = zcl_excel_drawing=>c_media_type_jpg + ip_width = 16 + ip_height = 14 ). + lo_worksheet->add_drawing( lo_drawing ). + + ENDLOOP. + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel38.prog.xml b/src/zdemo_excel38.prog.xml new file mode 100644 index 0000000..607a5c2 --- /dev/null +++ b/src/zdemo_excel38.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL38 + A + X + 1 + T + E + X + X + + + + + R + Read file and output + 20 + + + S + S_ICON + . + 9 + D + + + + + diff --git a/src/zdemo_excel39.prog.abap b/src/zdemo_excel39.prog.abap new file mode 100644 index 0000000..758584e --- /dev/null +++ b/src/zdemo_excel39.prog.abap @@ -0,0 +1,473 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL16 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel39. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_drawing TYPE REF TO zcl_excel_drawing. + +DATA lv_value TYPE i. + +DATA: ls_io TYPE skwf_io. + +DATA: ls_upper TYPE zexcel_drawing_location, + ls_lower TYPE zexcel_drawing_location. + +DATA: lo_bar1 TYPE REF TO zcl_excel_graph_bars, + lo_bar1_stacked TYPE REF TO zcl_excel_graph_bars, + lo_bar2 TYPE REF TO zcl_excel_graph_bars, + lo_pie TYPE REF TO zcl_excel_graph_pie, + lo_line TYPE REF TO zcl_excel_graph_line. + +CONSTANTS: gc_save_file_name TYPE string VALUE '39_Charts.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +START-OF-SELECTION. + + " Create a pie chart and series + CREATE OBJECT lo_pie. + + CALL METHOD lo_pie->create_serie + EXPORTING + ip_order = 0 + ip_sheet = 'Values' + ip_lbl_from_col = 'B' + ip_lbl_from_row = '1' + ip_lbl_to_col = 'B' + ip_lbl_to_row = '3' + ip_ref_from_col = 'A' + ip_ref_from_row = '1' + ip_ref_to_col = 'A' + ip_ref_to_row = '3' + ip_sername = 'My serie 1'. + + " Set style + lo_pie->set_style( zcl_excel_graph=>c_style_15 ). + + " Create a bar chart, series and axes + CREATE OBJECT lo_bar1. + + CALL METHOD lo_bar1->create_serie + EXPORTING + ip_order = 0 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_bar1->create_serie + EXPORTING + ip_order = 1 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$B$1:$B$3' + ip_ref = 'Values!$A$1:$A$3' + ip_sername = 'My serie 2'. + + CALL METHOD lo_bar1->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_bar1->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + " Set style + lo_bar1->set_style( zcl_excel_graph=>c_style_default ). + + " Set label to none + lo_bar1->set_print_lbl( zcl_excel_graph_bars=>c_show_false ). + +* Same barchart - but this time stacked + CREATE OBJECT lo_bar1_stacked. + + CALL METHOD lo_bar1_stacked->create_serie + EXPORTING + ip_order = 0 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_bar1_stacked->create_serie + EXPORTING + ip_order = 1 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no + ip_lbl = 'Values!$B$1:$B$3' + ip_ref = 'Values!$A$1:$A$3' + ip_sername = 'My serie 2'. + + CALL METHOD lo_bar1_stacked->create_ax + EXPORTING + ip_type = zcl_excel_graph_bars=>c_catax . + + CALL METHOD lo_bar1_stacked->create_ax + EXPORTING + ip_type = zcl_excel_graph_bars=>c_valax. + + " Set style + lo_bar1_stacked->set_style( zcl_excel_graph=>c_style_default ). + + " Set label to none + lo_bar1_stacked->set_print_lbl( zcl_excel_graph_bars=>c_show_false ). + + " Make it stacked + lo_bar1_stacked->ns_groupingval = zcl_excel_graph_bars=>c_groupingval_stacked. + + + " Create a bar chart, series and axes + CREATE OBJECT lo_bar2. + + CALL METHOD lo_bar2->create_serie + EXPORTING + ip_order = 0 + ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_yes + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_bar2->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_bar2->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_bars=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + " Set layout + lo_bar2->set_show_legend_key( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_values( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_cat_name( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_ser_name( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_show_percent( zcl_excel_graph_bars=>c_show_true ). + lo_bar2->set_varycolor( zcl_excel_graph_bars=>c_show_true ). + + " Create a line chart, series and axes + CREATE OBJECT lo_line. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 0 + ip_symbol = zcl_excel_graph_line=>c_symbol_auto + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$D$1:$D$3' + ip_ref = 'Values!$C$1:$C$3' + ip_sername = 'My serie 1'. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 1 + ip_symbol = zcl_excel_graph_line=>c_symbol_none + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$B$1:$B$3' + ip_ref = 'Values!$A$1:$A$3' + ip_sername = 'My serie 2'. + + CALL METHOD lo_line->create_serie + EXPORTING + ip_order = 2 + ip_symbol = zcl_excel_graph_line=>c_symbol_auto + ip_smooth = zcl_excel_graph_line=>c_show_false + ip_lbl = 'Values!$F$1:$F$3' + ip_ref = 'Values!$E$1:$E$3' + ip_sername = 'My serie 3'. + + CALL METHOD lo_line->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_line=>c_catax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + CALL METHOD lo_line->create_ax + EXPORTING +* ip_axid = + ip_type = zcl_excel_graph_line=>c_valax +* ip_orientation = +* ip_delete = +* ip_axpos = +* ip_formatcode = +* ip_sourcelinked = +* ip_majortickmark = +* ip_minortickmark = +* ip_ticklblpos = +* ip_crossax = +* ip_crosses = +* ip_auto = +* ip_lblalgn = +* ip_lbloffset = +* ip_nomultilvllbl = +* ip_crossbetween = + . + + + + + + + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet (Pie sheet) + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( 'PieChart' ). + + " Create global drawing, set type as pie chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART PIE' ). + lo_drawing->graph = lo_pie. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie. + + "Set chart position (anchor 2 cells) + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " BarChart1 sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'BarChart1' ). + + " Create global drawing, set type as bar chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART BARS WITH 2 SERIES' ). + lo_drawing->graph = lo_bar1. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 11. + ls_lower-row = 22. + ls_lower-col = 21. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'Stacked CHART BARS WITH 2 SER.' ). + lo_drawing->graph = lo_bar1_stacked. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 1. + ls_lower-row = 22. + ls_lower-col = 10. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " BarChart2 sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'BarChart2' ). + + " Create global drawing, set type as bar chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART BARS WITH 1 SERIE' ). + lo_drawing->graph = lo_bar2. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 0. + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " LineChart sheet + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'LineChart' ). + + " Create global drawing, set type as line chart, assign chart, set position and media type + lo_drawing = lo_worksheet->excel->add_new_drawing( + ip_type = zcl_excel_drawing=>type_chart + ip_title = 'CHART LINES' ). + lo_drawing->graph = lo_line. + lo_drawing->graph_type = zcl_excel_drawing=>c_graph_line. + + "Set chart position (anchor 2 cells) + ls_upper-row = 0. + ls_upper-col = 0. + ls_lower-row = 30. + ls_lower-col = 20. + lo_drawing->set_position2( + EXPORTING + ip_from = ls_upper + ip_to = ls_lower ). + + lo_drawing->set_media( + EXPORTING + ip_media_type = zcl_excel_drawing=>c_media_type_xml ). + + lo_worksheet->add_drawing( lo_drawing ). + + " Values sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for chart + lv_value = 1. + lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = lv_value ). + lv_value = 2. + lo_worksheet->set_cell( ip_column = 'A' ip_row = 2 ip_value = lv_value ). + lv_value = 3. + lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = lv_value ). + + " Set labels for chart + lo_worksheet->set_cell( ip_column = 'B' ip_row = 1 ip_value = 'One' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Two' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'Three' ). + + " Set values for chart + lv_value = 3. + lo_worksheet->set_cell( ip_column = 'C' ip_row = 1 ip_value = lv_value ). + lv_value = 2. + lo_worksheet->set_cell( ip_column = 'C' ip_row = 2 ip_value = lv_value ). + lv_value = -1. + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = lv_value ). + + " Set labels for chart + lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = 'One (Minus)' ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 2 ip_value = 'Two' ). + lo_worksheet->set_cell( ip_column = 'D' ip_row = 1 ip_value = 'Three' ). + + " Set values for chart + lv_value = 3. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 1 ip_value = lv_value ). + lv_value = 1. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 2 ip_value = lv_value ). + lv_value = 2. + lo_worksheet->set_cell( ip_column = 'E' ip_row = 3 ip_value = lv_value ). + + " Set labels for chart + lo_worksheet->set_cell( ip_column = 'F' ip_row = 3 ip_value = 'Two' ). + lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'One' ). + lo_worksheet->set_cell( ip_column = 'F' ip_row = 1 ip_value = 'Three' ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel39.prog.xml b/src/zdemo_excel39.prog.xml new file mode 100644 index 0000000..8218ed3 --- /dev/null +++ b/src/zdemo_excel39.prog.xml @@ -0,0 +1,53 @@ + + + + + + ZDEMO_EXCEL39 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Drawings + 25 + + + S + POBJTYPE + . + 9 + D + + + S + P_CLASS + . + 9 + D + + + S + P_OBJID + . + 9 + D + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel4.prog.abap b/src/zdemo_excel4.prog.abap new file mode 100644 index 0000000..133120e --- /dev/null +++ b/src/zdemo_excel4.prog.abap @@ -0,0 +1,115 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL4 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel4. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + + lo_hyperlink TYPE REF TO zcl_excel_hyperlink, + + lv_tabcolor TYPE zexcel_s_tabcolor, + + ls_header TYPE zexcel_s_worksheet_head_foot, + ls_footer TYPE zexcel_s_worksheet_head_foot. + +CONSTANTS: gc_save_file_name TYPE string VALUE '04_Sheets.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet1' ). + lo_worksheet->zif_excel_sheet_properties~selected = zif_excel_sheet_properties=>c_selected. + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the first sheet' ). +* Set color to tab with sheetname - Red + lv_tabcolor-rgb = zcl_excel_style_color=>create_new_argb( ip_red = 'FF' + ip_green = '00' + ip_blu = '00' ). + lo_worksheet->set_tabcolor( lv_tabcolor ). + + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet2!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to second sheet' ip_hyperlink = lo_hyperlink ). + + " Page printing settings + lo_worksheet->sheet_setup->set_page_margins( ip_header = '1' ip_footer = '1' ip_unit = 'cm' ). + lo_worksheet->sheet_setup->black_and_white = 'X'. + lo_worksheet->sheet_setup->fit_to_page = 'X'. " you should turn this on to activate fit_to_height and fit_to_width + lo_worksheet->sheet_setup->fit_to_height = 0. " used only if ip_fit_to_page = 'X' + lo_worksheet->sheet_setup->fit_to_width = 2. " used only if ip_fit_to_page = 'X' + lo_worksheet->sheet_setup->orientation = zcl_excel_sheet_setup=>c_orientation_landscape. + lo_worksheet->sheet_setup->page_order = zcl_excel_sheet_setup=>c_ord_downthenover. + lo_worksheet->sheet_setup->paper_size = zcl_excel_sheet_setup=>c_papersize_a4. + lo_worksheet->sheet_setup->scale = 80. " used only if ip_fit_to_page = SPACE + + " Header and Footer + ls_header-right_value = 'print date &D'. + ls_header-right_font-size = 8. + ls_header-right_font-name = zcl_excel_style_font=>c_name_arial. + + ls_footer-left_value = '&Z&F'. "Path / Filename + ls_footer-left_font = ls_header-right_font. + ls_footer-right_value = 'page &P of &N'. "page x of y + ls_footer-right_font = ls_header-right_font. + + lo_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_header + ip_odd_footer = ls_footer ). + + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet2' ). +* Set color to tab with sheetname - Green + lv_tabcolor-rgb = zcl_excel_style_color=>create_new_argb( ip_red = '00' + ip_green = 'FF' + ip_blu = '00' ). + lo_worksheet->set_tabcolor( lv_tabcolor ). + lo_worksheet->zif_excel_sheet_properties~selected = zif_excel_sheet_properties=>c_selected. + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the second sheet' ). + lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet1!B2' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to first sheet' ip_hyperlink = lo_hyperlink ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 4 ip_value = 'Sheet3 is hidden' ). + + lo_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_header + ip_odd_footer = ls_footer ). + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet3' ). +* Set color to tab with sheetname - Blue + lv_tabcolor-rgb = zcl_excel_style_color=>create_new_argb( ip_red = '00' + ip_green = '00' + ip_blu = 'FF' ). + lo_worksheet->set_tabcolor( lv_tabcolor ). + lo_worksheet->zif_excel_sheet_properties~hidden = zif_excel_sheet_properties=>c_hidden. + + lo_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_header + ip_odd_footer = ls_footer ). + + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Sheet4' ). +* Set color to tab with sheetname - other color + lv_tabcolor-rgb = zcl_excel_style_color=>create_new_argb( ip_red = '00' + ip_green = 'FF' + ip_blu = 'FF' ). + lo_worksheet->set_tabcolor( lv_tabcolor ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Cell B3 has value 0' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 0 ). + lo_worksheet->zif_excel_sheet_properties~show_zeros = zif_excel_sheet_properties=>c_hidezero. + + lo_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_header + ip_odd_footer = ls_footer ). + + lo_excel->set_active_sheet_index_by_name( 'Sheet1' ). + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel4.prog.xml b/src/zdemo_excel4.prog.xml new file mode 100644 index 0000000..a9658ad --- /dev/null +++ b/src/zdemo_excel4.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL4 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Create XLXS with multiple sheets + 49 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel40.prog.abap b/src/zdemo_excel40.prog.abap new file mode 100644 index 0000000..b80a2c0 --- /dev/null +++ b/src/zdemo_excel40.prog.abap @@ -0,0 +1,83 @@ +REPORT. + + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lv_row TYPE zexcel_cell_row, + lv_col TYPE i, + lv_row_char TYPE char10, + lv_value TYPE string, + ls_fontcolor TYPE zexcel_style_color_argb. + +CONSTANTS: gc_save_file_name TYPE string VALUE '40_Printsettings.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + + +START-OF-SELECTION. + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo Printsettings' ). + +*--------------------------------------------------------------------* +* Prepare sheet with trivial data +* - first 4 columns will have fontocolor set +* - first 3 rows will have fontcolor set +* These marked cells will be used for repeatable rows/columns on printpages +*--------------------------------------------------------------------* + DO 100 TIMES. " Rows + + lv_row = sy-index . + WRITE lv_row TO lv_row_char. + + DO 20 TIMES. + + lv_col = sy-index - 1. + CONCATENATE sy-abcde+lv_col(1) lv_row_char INTO lv_value. + lv_col = sy-index. + lo_worksheet->set_cell( ip_row = lv_row + ip_column = lv_col + ip_value = lv_value ). + + TRY. + IF lv_row <= 3. + lo_worksheet->change_cell_style( ip_column = lv_col + ip_row = lv_row + ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid + ip_fill_fgcolor_rgb = zcl_excel_style_color=>c_yellow ). + ENDIF. + IF lv_col <= 4. + lo_worksheet->change_cell_style( ip_column = lv_col + ip_row = lv_row + ip_font_color_rgb = zcl_excel_style_color=>c_red ). + ENDIF. + CATCH zcx_excel . + ENDTRY. + + ENDDO. + + + + ENDDO. + + +*--------------------------------------------------------------------* +* Printsettings +*--------------------------------------------------------------------* + TRY. + lo_worksheet->zif_excel_sheet_printsettings~set_print_repeat_columns( iv_columns_from = 'A' + iv_columns_to = 'D' ). + lo_worksheet->zif_excel_sheet_printsettings~set_print_repeat_rows( iv_rows_from = 1 + iv_rows_to = 3 ). + CATCH zcx_excel . + ENDTRY. + + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel40.prog.xml b/src/zdemo_excel40.prog.xml new file mode 100644 index 0000000..77cd660 --- /dev/null +++ b/src/zdemo_excel40.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL40 + A + X + 1 + T + E + X + X + + + + + R + Print settings + 20 + + + S + S_ICON + . + 9 + D + + + + + diff --git a/src/zdemo_excel42.prog.abap b/src/zdemo_excel42.prog.abap new file mode 100644 index 0000000..07f1b79 --- /dev/null +++ b/src/zdemo_excel42.prog.abap @@ -0,0 +1,102 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL42 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT ZDEMO_EXCEL42. +type-POOLS: vrm. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_theme TYPE REF TO zcl_excel_theme, + lo_style type ref to zcl_excel_style, + lv_style_guid type ZEXCEL_CELL_STYLE. +DATA: gc_save_file_name TYPE string VALUE '42 Theme Manipulation demo.&'. +include zdemo_excel_outputopt_incl. + +initialization. + + +START-OF-SELECTION. + + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Create a bold / italic style with usage of major font + lo_style = lo_excel->add_new_style( ). + lo_style->font->bold = abap_true. + lo_style->font->italic = abap_true. + lo_style->font->scheme = zcl_excel_style_font=>c_scheme_major. + lo_style->font->color-rgb = zcl_excel_style_color=>c_red. + lv_style_guid = lo_style->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Styles' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_guid ). + + "create theme + create object lo_theme. + lo_theme->set_theme_name( iv_name = 'Theme Demo 42 A2X' ). + lo_theme->set_color_scheme_name( iv_name = 'Demo 42 A2X' ). + + "set theme colors + lo_theme->set_color( + exporting + iv_type = zcl_excel_theme_color_scheme=>c_dark1 + iv_srgb = '5F9EA0' +* iv_syscolorname = +* iv_syscolorlast = + ). + lo_theme->set_color( + exporting + iv_type = zcl_excel_theme_color_scheme=>c_dark2 + iv_srgb = 'FFA500' +* iv_syscolorname = +* iv_syscolorlast = + ). + lo_theme->set_color( + exporting + iv_type = zcl_excel_theme_color_scheme=>c_light1 + iv_srgb = '778899' +* iv_syscolorname = +* iv_syscolorlast = + ). + + lo_theme->set_color( + exporting + iv_type = zcl_excel_theme_color_scheme=>c_light1 + iv_srgb = '9932CC' +* iv_syscolorname = +* iv_syscolorlast = + ). + lo_theme->set_font_scheme_name( iv_name = 'Demo 42 A2X' ). + + + "set theme latin fonts - major and minor + lo_theme->set_latin_font( + exporting + iv_type = zcl_excel_theme_font_scheme=>c_major + iv_typeface = 'Britannic Bold' +* iv_panose = +* iv_pitchfamily = +* iv_charset = + ). + lo_theme->set_latin_font( + exporting + iv_type = zcl_excel_theme_font_scheme=>c_minor + iv_typeface = 'Broadway' +* iv_panose = +* iv_pitchfamily = +* iv_charset = + ). + "push theme to file + lo_excel->set_theme( io_theme = lo_theme ). + + "output + lcl_output=>output( cl_excel = lo_excel ). diff --git a/src/zdemo_excel42.prog.xml b/src/zdemo_excel42.prog.xml new file mode 100644 index 0000000..c3a0c24 --- /dev/null +++ b/src/zdemo_excel42.prog.xml @@ -0,0 +1,26 @@ + + + + + + ZDEMO_EXCEL42 + A + X + 1 + * + K + E + X + X + + + + + R + Theme manipulation demo + 23 + + + + + diff --git a/src/zdemo_excel5.prog.abap b/src/zdemo_excel5.prog.abap new file mode 100644 index 0000000..d2ac970 --- /dev/null +++ b/src/zdemo_excel5.prog.abap @@ -0,0 +1,79 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL5 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel5. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_conditional TYPE REF TO zcl_excel_style_conditional. + +DATA: ls_iconset TYPE zexcel_conditional_iconset. + + + +CONSTANTS: gc_save_file_name TYPE string VALUE '05_Conditional.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + + + ls_iconset-iconset = zcl_excel_style_conditional=>c_iconset_3trafficlights2. + ls_iconset-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo1_value = '0'. + ls_iconset-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo2_value = '33'. + ls_iconset-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset-cfvo3_value = '66'. + ls_iconset-showvalue = zcl_excel_style_conditional=>c_showvalue_true. + + lo_style_conditional->mode_iconset = ls_iconset. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 4 + ip_stop_column = 'C' + ip_stop_row = 8 ). + + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 100 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 1000 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 150 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 500 ). + + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset-iconset = zcl_excel_style_conditional=>c_iconset_3trafficlights2. + ls_iconset-showvalue = zcl_excel_style_conditional=>c_showvalue_false. + lo_style_conditional->mode_iconset = ls_iconset. + lo_style_conditional->set_range( ip_start_column = 'E' + ip_start_row = 4 + ip_stop_column = 'E' + ip_stop_row = 8 ). + + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'E' ip_value = 100 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'E' ip_value = 1000 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'E' ip_value = 150 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'E' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'E' ip_value = 500 ). + + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel5.prog.xml b/src/zdemo_excel5.prog.xml new file mode 100644 index 0000000..9d7f17b --- /dev/null +++ b/src/zdemo_excel5.prog.xml @@ -0,0 +1,25 @@ + + + + + + ZDEMO_EXCEL5 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Conditinal formating + 37 + + + + + diff --git a/src/zdemo_excel6.prog.abap b/src/zdemo_excel6.prog.abap new file mode 100644 index 0000000..26c4065 --- /dev/null +++ b/src/zdemo_excel6.prog.abap @@ -0,0 +1,61 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL6 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel6. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lv_row TYPE syindex, + lv_formula TYPE string. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '06_Formulas.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + +*--------------------------------------------------------------------* +* Get some testdata +*--------------------------------------------------------------------* + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 100 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 1000 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 150 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = -10 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 500 ). + + +*--------------------------------------------------------------------* +* Demonstrate using formulas +*--------------------------------------------------------------------* + lo_worksheet->set_cell( ip_row = 9 ip_column = 'C' ip_formula = 'SUM(C4:C8)' ). + + +*--------------------------------------------------------------------* +* Demonstrate standard EXCEL-behaviour when copying a formula to another cell +* by calculating the resulting formula to put into another cell +*--------------------------------------------------------------------* + DO 10 TIMES. + + lv_formula = zcl_excel_common=>shift_formula( iv_reference_formula = 'SUM(C4:C8)' + iv_shift_cols = 0 " Offset in Columns - here we copy in same column --> 0 + iv_shift_rows = sy-index ). " Offset in Row - here we copy downward --> sy-index + lv_row = 9 + sy-index. " Absolute row = sy-index rows below reference cell + lo_worksheet->set_cell( ip_row = lv_row ip_column = 'C' ip_formula = lv_formula ). + + ENDDO. + +*--------------------------------------------------------------------* +*** Create output +*--------------------------------------------------------------------* + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel6.prog.xml b/src/zdemo_excel6.prog.xml new file mode 100644 index 0000000..d8bf778 --- /dev/null +++ b/src/zdemo_excel6.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL6 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Formulas + 25 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel7.prog.abap b/src/zdemo_excel7.prog.abap new file mode 100644 index 0000000..bcff7ae --- /dev/null +++ b/src/zdemo_excel7.prog.abap @@ -0,0 +1,425 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL7 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel7. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_style_conditional TYPE REF TO zcl_excel_style_conditional. + +DATA: ls_iconset3 TYPE zexcel_conditional_iconset, + ls_iconset4 TYPE zexcel_conditional_iconset, + ls_iconset5 TYPE zexcel_conditional_iconset, + ls_databar TYPE zexcel_conditional_databar, + ls_colorscale2 TYPE zexcel_conditional_colorscale, + ls_colorscale3 TYPE zexcel_conditional_colorscale. + +CONSTANTS: gc_save_file_name TYPE string VALUE '07_ConditionalAll.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + ls_iconset3-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset3-cfvo1_value = '0'. + ls_iconset3-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset3-cfvo2_value = '33'. + ls_iconset3-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset3-cfvo3_value = '66'. + ls_iconset3-showvalue = zcl_excel_style_conditional=>c_showvalue_true. + + ls_iconset4-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset4-cfvo1_value = '0'. + ls_iconset4-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset4-cfvo2_value = '25'. + ls_iconset4-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset4-cfvo3_value = '50'. + ls_iconset4-cfvo4_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset4-cfvo4_value = '75'. + ls_iconset4-showvalue = zcl_excel_style_conditional=>c_showvalue_true. + + ls_iconset5-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset5-cfvo1_value = '0'. + ls_iconset5-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset5-cfvo2_value = '20'. + ls_iconset5-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset5-cfvo3_value = '40'. + ls_iconset5-cfvo4_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset5-cfvo4_value = '60'. + ls_iconset5-cfvo5_type = zcl_excel_style_conditional=>c_cfvo_type_percent. + ls_iconset5-cfvo5_value = '80'. + ls_iconset5-showvalue = zcl_excel_style_conditional=>c_showvalue_true. + + ls_databar-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_min. + ls_databar-cfvo1_value = '0'. + ls_databar-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_max. + ls_databar-cfvo2_value = '0'. + ls_databar-colorrgb = 'FF638EC6'. + + ls_colorscale2-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_min. + ls_colorscale2-cfvo1_value = '0'. + ls_colorscale2-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percentile. + ls_colorscale2-cfvo2_value = '50'. + ls_colorscale2-colorrgb1 = 'FFF8696B'. + ls_colorscale2-colorrgb2 = 'FF63BE7B'. + + ls_colorscale3-cfvo1_type = zcl_excel_style_conditional=>c_cfvo_type_min. + ls_colorscale3-cfvo1_value = '0'. + ls_colorscale3-cfvo2_type = zcl_excel_style_conditional=>c_cfvo_type_percentile. + ls_colorscale3-cfvo2_value = '50'. + ls_colorscale3-cfvo3_type = zcl_excel_style_conditional=>c_cfvo_type_max. + ls_colorscale3-cfvo3_value = '0'. + ls_colorscale3-colorrgb1 = 'FFF8696B'. + ls_colorscale3-colorrgb2 = 'FFFFEB84'. + ls_colorscale3-colorrgb3 = 'FF63BE7B'. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + +* ICONSET + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3arrows. + + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'B' + ip_start_row = 5 + ip_stop_column = 'B' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'C_ICONSET_3ARROWS' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'B' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'B' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'B' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'B' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3arrowsgray. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 5 + ip_stop_column = 'C' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'C_ICONSET_3ARROWSGRAY' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'C' ip_value = 50 ). + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3flags. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'D' + ip_start_row = 5 + ip_stop_column = 'D' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = 'C_ICONSET_3FLAGS' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'D' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'D' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'D' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'D' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'D' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3trafficlights. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'E' + ip_start_row = 5 + ip_stop_column = 'E' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'E' ip_value = 'C_ICONSET_3TRAFFICLIGHTS' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'E' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'E' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'E' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'E' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'E' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3trafficlights2. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'F' + ip_start_row = 5 + ip_stop_column = 'F' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'F' ip_value = 'C_ICONSET_3TRAFFICLIGHTS2' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'F' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'F' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'F' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'F' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'F' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3signs. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'G' + ip_start_row = 5 + ip_stop_column = 'G' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'G' ip_value = 'C_ICONSET_3SIGNS' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'G' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'G' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'G' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'G' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'G' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3symbols. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'H' + ip_start_row = 5 + ip_stop_column = 'H' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'H' ip_value = 'C_ICONSET_3SYMBOLS' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'H' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'H' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'H' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'H' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'H' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset3-iconset = zcl_excel_style_conditional=>c_iconset_3symbols2. + lo_style_conditional->mode_iconset = ls_iconset3. + lo_style_conditional->set_range( ip_start_column = 'I' + ip_start_row = 5 + ip_stop_column = 'I' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'I' ip_value = 'C_ICONSET_3SYMBOLS2' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'I' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'I' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'I' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'I' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'I' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset4-iconset = zcl_excel_style_conditional=>c_iconset_4arrows. + lo_style_conditional->mode_iconset = ls_iconset4. + lo_style_conditional->set_range( ip_start_column = 'B' + ip_start_row = 12 + ip_stop_column = 'B' + ip_stop_row = 16 ). + + lo_worksheet->set_cell( ip_row = 11 ip_column = 'B' ip_value = 'C_ICONSET_4ARROWS' ). + lo_worksheet->set_cell( ip_row = 12 ip_column = 'B' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'B' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'B' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 15 ip_column = 'B' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 16 ip_column = 'B' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset4-iconset = zcl_excel_style_conditional=>c_iconset_4arrowsgray. + lo_style_conditional->mode_iconset = ls_iconset4. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 12 + ip_stop_column = 'C' + ip_stop_row = 16 ). + + lo_worksheet->set_cell( ip_row = 11 ip_column = 'C' ip_value = 'C_ICONSET_4ARROWSGRAY' ). + lo_worksheet->set_cell( ip_row = 12 ip_column = 'C' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'C' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'C' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 15 ip_column = 'C' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 16 ip_column = 'C' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset4-iconset = zcl_excel_style_conditional=>c_iconset_4redtoblack. + lo_style_conditional->mode_iconset = ls_iconset4. + lo_style_conditional->set_range( ip_start_column = 'D' + ip_start_row = 12 + ip_stop_column = 'D' + ip_stop_row = 16 ). + + lo_worksheet->set_cell( ip_row = 11 ip_column = 'D' ip_value = 'C_ICONSET_4REDTOBLACK' ). + lo_worksheet->set_cell( ip_row = 12 ip_column = 'D' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'D' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'D' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 15 ip_column = 'D' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 16 ip_column = 'D' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset4-iconset = zcl_excel_style_conditional=>c_iconset_4rating. + lo_style_conditional->mode_iconset = ls_iconset4. + lo_style_conditional->set_range( ip_start_column = 'E' + ip_start_row = 12 + ip_stop_column = 'E' + ip_stop_row = 16 ). + + lo_worksheet->set_cell( ip_row = 11 ip_column = 'E' ip_value = 'C_ICONSET_4RATING' ). + lo_worksheet->set_cell( ip_row = 12 ip_column = 'E' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'E' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'E' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 15 ip_column = 'E' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 16 ip_column = 'E' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset4-iconset = zcl_excel_style_conditional=>c_iconset_4trafficlights. + lo_style_conditional->mode_iconset = ls_iconset4. + lo_style_conditional->set_range( ip_start_column = 'F' + ip_start_row = 12 + ip_stop_column = 'F' + ip_stop_row = 16 ). + + lo_worksheet->set_cell( ip_row = 11 ip_column = 'F' ip_value = 'C_ICONSET_4TRAFFICLIGHTS' ). + lo_worksheet->set_cell( ip_row = 12 ip_column = 'F' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 13 ip_column = 'F' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 14 ip_column = 'F' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 15 ip_column = 'F' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 16 ip_column = 'F' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset5-iconset = zcl_excel_style_conditional=>c_iconset_5arrows. + lo_style_conditional->mode_iconset = ls_iconset5. + lo_style_conditional->set_range( ip_start_column = 'B' + ip_start_row = 19 + ip_stop_column = 'B' + ip_stop_row = 23 ). + + lo_worksheet->set_cell( ip_row = 18 ip_column = 'B' ip_value = 'C_ICONSET_5ARROWS' ). + lo_worksheet->set_cell( ip_row = 19 ip_column = 'B' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 20 ip_column = 'B' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 21 ip_column = 'B' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 22 ip_column = 'B' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 23 ip_column = 'B' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset5-iconset = zcl_excel_style_conditional=>c_iconset_5arrowsgray. + lo_style_conditional->mode_iconset = ls_iconset5. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 19 + ip_stop_column = 'C' + ip_stop_row = 23 ). + + lo_worksheet->set_cell( ip_row = 18 ip_column = 'C' ip_value = 'C_ICONSET_5ARROWSGRAY' ). + lo_worksheet->set_cell( ip_row = 19 ip_column = 'C' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 20 ip_column = 'C' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 21 ip_column = 'C' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 22 ip_column = 'C' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 23 ip_column = 'C' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset5-iconset = zcl_excel_style_conditional=>c_iconset_5rating. + lo_style_conditional->mode_iconset = ls_iconset5. + lo_style_conditional->set_range( ip_start_column = 'D' + ip_start_row = 19 + ip_stop_column = 'D' + ip_stop_row = 23 ). + + lo_worksheet->set_cell( ip_row = 18 ip_column = 'D' ip_value = 'C_ICONSET_5RATING' ). + lo_worksheet->set_cell( ip_row = 19 ip_column = 'D' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 20 ip_column = 'D' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 21 ip_column = 'D' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 22 ip_column = 'D' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 23 ip_column = 'D' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_iconset. + lo_style_conditional->priority = 1. + ls_iconset5-iconset = zcl_excel_style_conditional=>c_iconset_5quarters. + lo_style_conditional->mode_iconset = ls_iconset5. + lo_style_conditional->set_range( ip_start_column = 'E' + ip_start_row = 19 + ip_stop_column = 'E' + ip_stop_row = 23 ). + +* DATABAR + + lo_worksheet->set_cell( ip_row = 25 ip_column = 'B' ip_value = 'DATABAR' ). + lo_worksheet->set_cell( ip_row = 26 ip_column = 'B' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 27 ip_column = 'B' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 28 ip_column = 'B' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 29 ip_column = 'B' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 30 ip_column = 'B' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_databar. + lo_style_conditional->priority = 1. + lo_style_conditional->mode_databar = ls_databar. + lo_style_conditional->set_range( ip_start_column = 'B' + ip_start_row = 26 + ip_stop_column = 'B' + ip_stop_row = 30 ). + +* COLORSCALE + + lo_worksheet->set_cell( ip_row = 25 ip_column = 'C' ip_value = 'COLORSCALE 2 COLORS' ). + lo_worksheet->set_cell( ip_row = 26 ip_column = 'C' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 27 ip_column = 'C' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 28 ip_column = 'C' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 29 ip_column = 'C' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 30 ip_column = 'C' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_colorscale. + lo_style_conditional->priority = 1. + lo_style_conditional->mode_colorscale = ls_colorscale2. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 26 + ip_stop_column = 'C' + ip_stop_row = 30 ). + + + lo_worksheet->set_cell( ip_row = 25 ip_column = 'D' ip_value = 'COLORSCALE 3 COLORS' ). + lo_worksheet->set_cell( ip_row = 26 ip_column = 'D' ip_value = 10 ). + lo_worksheet->set_cell( ip_row = 27 ip_column = 'D' ip_value = 20 ). + lo_worksheet->set_cell( ip_row = 28 ip_column = 'D' ip_value = 30 ). + lo_worksheet->set_cell( ip_row = 29 ip_column = 'D' ip_value = 40 ). + lo_worksheet->set_cell( ip_row = 30 ip_column = 'D' ip_value = 50 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_colorscale. + lo_style_conditional->priority = 1. + lo_style_conditional->mode_colorscale = ls_colorscale3. + lo_style_conditional->set_range( ip_start_column = 'D' + ip_start_row = 26 + ip_stop_column = 'D' + ip_stop_row = 30 ). + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel7.prog.xml b/src/zdemo_excel7.prog.xml new file mode 100644 index 0000000..66c8cd1 --- /dev/null +++ b/src/zdemo_excel7.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL7 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: All conditional formating possibilities + 56 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel8.prog.abap b/src/zdemo_excel8.prog.abap new file mode 100644 index 0000000..9ed6528 --- /dev/null +++ b/src/zdemo_excel8.prog.abap @@ -0,0 +1,71 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL8 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel8. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_range TYPE REF TO zcl_excel_range. + +DATA: lv_title TYPE zexcel_sheet_title. + +CONSTANTS: gc_save_file_name TYPE string VALUE '08_Range.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + + +START-OF-SELECTION. + + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lv_title = 'Sheet1'. + lo_worksheet->set_title( lv_title ). + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'range'. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'C' + ip_start_row = 4 + ip_stop_column = 'C' + ip_stop_row = 8 ). + + + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'Apple' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 'Banana' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 'Blueberry' ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Ananas' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Grapes' ). + + " Define another Range with a name longer than 40 characters that + " tests the fix of issue #168 ranges namescan be only up to 20 chars + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'A_range_with_a_name_that_is_longer_than_20_characters'. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'D' + ip_start_row = 4 + ip_stop_column = 'D' + ip_stop_row = 5 ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = 'Range Value 1' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'D' ip_value = 'Range Value 2' ). + + " issue #163 + " Define another Range with sheet visibility + lo_range = lo_worksheet->add_new_range( ). + lo_range->name = 'A_range_with_sheet_visibility'. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'E' + ip_start_row = 4 + ip_stop_column = 'E' + ip_stop_row = 5 ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'E' ip_value = 'Range Value 3' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'E' ip_value = 'Range Value 4' ). + " issue #163 + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel8.prog.xml b/src/zdemo_excel8.prog.xml new file mode 100644 index 0000000..82c3c20 --- /dev/null +++ b/src/zdemo_excel8.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_EXCEL8 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Define a range + 31 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_excel9.prog.abap b/src/zdemo_excel9.prog.abap new file mode 100644 index 0000000..19dfe3a --- /dev/null +++ b/src/zdemo_excel9.prog.abap @@ -0,0 +1,203 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_EXCEL9 +*& +*&---------------------------------------------------------------------* +*& abap2xlsx Demo: Data validations +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_excel9. + +CONSTANTS: c_fruits TYPE string VALUE 'Fruits', + c_vegetables TYPE string VALUE 'Vegetables', + c_meat TYPE string VALUE 'Meat', + c_fish TYPE string VALUE 'Fish'. + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation. + +DATA: row TYPE zexcel_cell_row. + + +DATA: lv_title TYPE zexcel_sheet_title. + + +CONSTANTS: gc_save_file_name TYPE string VALUE '09_DataValidation.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +PARAMETERS: p_sbook TYPE flag. + + +START-OF-SELECTION. + + " Creates active sheet + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lv_title = 'Data Validation'. + lo_worksheet->set_title( lv_title ). + " Set values for dropdown + lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = c_fish ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 'Anchovy' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 'Carp' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 'Catfish' ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 'Cod' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 'Eel' ). + lo_worksheet->set_cell( ip_row = 9 ip_column = 'A' ip_value = 'Haddock' ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_fish. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 9 ). + + lo_worksheet->set_cell( ip_row = 2 ip_column = 'B' ip_value = c_meat ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'Pork' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'B' ip_value = 'Beef' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 'Chicken' ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'B' ip_value = 'Turkey' ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_meat. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'B' + ip_start_row = 4 + ip_stop_column = 'B' + ip_stop_row = 7 ). + + lo_worksheet->set_cell( ip_row = 2 ip_column = 'C' ip_value = c_fruits ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'Apple' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 'Banana' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 'Blueberry' ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Ananas' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Grapes' ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_fruits. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'C' + ip_start_row = 4 + ip_stop_column = 'C' + ip_stop_row = 8 ). + + lo_worksheet->set_cell( ip_row = 2 ip_column = 'D' ip_value = c_vegetables ). + lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = 'Cucumber' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'D' ip_value = 'Sweet pepper ' ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'D' ip_value = 'Lettuce' ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = c_vegetables. + lo_range->set_value( ip_sheet_name = lv_title + ip_start_column = 'D' + ip_start_row = 4 + ip_stop_column = 'D' + ip_stop_row = 6 ). + + lo_worksheet = lo_excel->add_new_worksheet( ). + lv_title = 'Table with Data Validation'. + lo_worksheet->set_title( lv_title ). + + " Maximum Text length + lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'Validate Maximum Text length of <= 10 in Cell A2:' ). + lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = 'abcdefghij' ). + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_textlength. + lo_data_validation->operator = zcl_excel_data_validation=>c_operator_lessthanorequal. + lo_data_validation->formula1 = 10. + lo_data_validation->cell_row = 2. + lo_data_validation->cell_column = 'A'. + + " Integer Value between 1 and 10 + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 'Validate Integer Value between 1 and 10 in Cell A5:' ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = '5' ). + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_whole. + lo_data_validation->operator = zcl_excel_data_validation=>c_operator_between. + lo_data_validation->formula1 = 1. + lo_data_validation->formula2 = 10. + lo_data_validation->prompttitle = 'Range'. + lo_data_validation->prompt = 'Enter a value between 1 and 10'. + lo_data_validation->errortitle = 'Error'. + lo_data_validation->error = 'You have entered a wrong value. Please use only numbers between 1 and 10.'. + lo_data_validation->cell_row = 5. + lo_data_validation->cell_column = 'A'. + + " Evaluation by Formula from issue #161 + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 'Validate if B8 contains a "-":' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 'Text' ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'B' ip_value = '-' ). + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_custom. + lo_data_validation->formula1 = '"IF(B8<>"""";INDIRECT(LEFT(B8;SEARCH(""-"";B8;1)));EMPTY)"'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'A'. + + " There was an error when data validation was combined with cell merges this should test that: + lo_worksheet->set_cell( ip_row = 10 ip_column = 'A' ip_value = 'Demo for data validation with a dropdown list' ). + lo_worksheet->set_merge( ip_row = 10 ip_column_start = 'A' ip_column_end = 'F' ). + + " Headlines + lo_worksheet->set_cell( ip_row = 11 ip_column = 'A' ip_value = c_fruits ). + lo_worksheet->set_cell( ip_row = 11 ip_column = 'B' ip_value = c_vegetables ). + + row = 12. + WHILE row < 20. " Starting with 14500 the data validation is dropped 14000 are still ok + " 1st validation + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_fruits. + lo_data_validation->cell_row = row. + lo_data_validation->cell_column = 'A'. + lo_worksheet->set_cell( ip_row = row ip_column = 'A' ip_value = 'Select a value' ). + " 2nd + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_vegetables. + lo_data_validation->cell_row = row. + lo_data_validation->cell_column = 'B'. + lo_worksheet->set_cell( ip_row = row ip_column = 'B' ip_value = 'Select a value' ). + " 3rd + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_meat. + lo_data_validation->cell_row = row. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = row ip_column = 'C' ip_value = 'Select a value' ). + " 4th + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = c_fish. + lo_data_validation->cell_row = row. + lo_data_validation->cell_column = 'D'. + lo_worksheet->set_cell( ip_row = row ip_column = 'D' ip_value = 'Select a value' ). + " Increment row + row = row + 1. + ENDWHILE. + + IF p_sbook = abap_true. + DATA: bookings type TABLE OF sbook. + + lo_worksheet = lo_excel->add_new_worksheet( ). + lv_title = 'SBOOK'. + lo_worksheet->set_title( lv_title ). + + SELECT * from sbook INTO TABLE bookings UP TO 4000 ROWS. + + lo_worksheet->bind_table( + EXPORTING + ip_table = bookings +* it_field_catalog = " Table binding field catalog +* is_table_settings = " Excel table binding settings +* IMPORTING +* es_table_settings = " Excel table binding settings + ). + ENDIF. + + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_excel9.prog.xml b/src/zdemo_excel9.prog.xml new file mode 100644 index 0000000..fa7b1a5 --- /dev/null +++ b/src/zdemo_excel9.prog.xml @@ -0,0 +1,38 @@ + + + + + + ZDEMO_EXCEL9 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Data validations + 33 + + + S + P_PATH + . + 24 + D + + + S + P_SBOOK + Export SBOOK to Excel? + 30 + + + + + diff --git a/src/zdemo_excel_outputopt_incl.prog.abap b/src/zdemo_excel_outputopt_incl.prog.abap new file mode 100644 index 0000000..b632cc6 --- /dev/null +++ b/src/zdemo_excel_outputopt_incl.prog.abap @@ -0,0 +1,372 @@ +*&---------------------------------------------------------------------* +*& Include ZDEMO_EXCEL_OUTPUTOPT_INCL +*&---------------------------------------------------------------------* +CLASS lcl_output DEFINITION CREATE PRIVATE. + PUBLIC SECTION. + CLASS-METHODS: + output IMPORTING cl_excel TYPE REF TO zcl_excel + iv_writerclass_name TYPE clike OPTIONAL, + f4_path RETURNING VALUE(selected_folder) TYPE string, + parametertexts. + + PRIVATE SECTION. + METHODS: + download_frontend, + download_backend, + display_online, + send_email. + + DATA: xdata TYPE xstring, " Will be used for sending as email + t_rawdata TYPE solix_tab, " Will be used for downloading or open directly + bytecount TYPE i. " Will be used for downloading or open directly +ENDCLASS. "lcl_output DEFINITION + + +SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE txt_bl1. +PARAMETERS: rb_down RADIOBUTTON GROUP rb1 USER-COMMAND space. + +PARAMETERS: rb_back RADIOBUTTON GROUP rb1. + +PARAMETERS: rb_show RADIOBUTTON GROUP rb1 DEFAULT 'X' . + +PARAMETERS: rb_send RADIOBUTTON GROUP rb1. + +PARAMETERS: p_path TYPE string LOWER CASE MODIF ID pat. +PARAMETERS: p_email TYPE string LOWER CASE MODIF ID ema OBLIGATORY DEFAULT 'insert_your_emailadress@here'. +PARAMETERS: p_backfn TYPE text40 NO-DISPLAY. +SELECTION-SCREEN END OF BLOCK bl1. + + +AT SELECTION-SCREEN OUTPUT. + LOOP AT SCREEN. + + IF rb_down IS INITIAL AND screen-group1 = 'PAT'. + screen-input = 0. + screen-invisible = 1. + ENDIF. + + IF rb_send IS INITIAL AND screen-group1 = 'EMA'. + screen-input = 0. + screen-invisible = 1. + ENDIF. + + MODIFY SCREEN. + + ENDLOOP. + +INITIALIZATION. + IF sy-batch IS INITIAL. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = p_path ). + cl_gui_cfw=>flush( ). + ENDIF. + lcl_output=>parametertexts( ). " If started in language w/o textelements translated set defaults + sy-title = gc_save_file_name. + txt_bl1 = 'Output options'(bl1). + p_backfn = gc_save_file_name. " Use as default if nothing else is supplied by submit + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + p_path = lcl_output=>f4_path( ). + + +*----------------------------------------------------------------------* +* CLASS lcl_output IMPLEMENTATION +*----------------------------------------------------------------------* +CLASS lcl_output IMPLEMENTATION. + METHOD output. + + DATA: cl_output TYPE REF TO lcl_output, + cl_writer TYPE REF TO zif_excel_writer. + + IF iv_writerclass_name IS INITIAL. + CREATE OBJECT cl_output. + CREATE OBJECT cl_writer TYPE zcl_excel_writer_2007. + ELSE. + CREATE OBJECT cl_output. + CREATE OBJECT cl_writer TYPE (iv_writerclass_name). + ENDIF. + cl_output->xdata = cl_writer->write_file( cl_excel ). + +* After 6.40 via cl_bcs_convert + cl_output->t_rawdata = cl_bcs_convert=>xstring_to_solix( iv_xstring = cl_output->xdata ). + cl_output->bytecount = xstrlen( cl_output->xdata ). + +* before 6.40 +* CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' +* EXPORTING +* buffer = cl_output->xdata +* IMPORTING +* output_length = cl_output->bytecount +* TABLES +* binary_tab = cl_output->t_rawdata. + + CASE 'X'. + WHEN rb_down. + IF sy-batch IS INITIAL. + cl_output->download_frontend( ). + ELSE. + MESSAGE e001(00) WITH 'Frontenddownload impossible in background processing'. + ENDIF. + + WHEN rb_back. + cl_output->download_backend( ). + + WHEN rb_show. + IF sy-batch IS INITIAL. + cl_output->display_online( ). + ELSE. + MESSAGE e001(00) WITH 'Online display absurd in background processing'. + ENDIF. + + WHEN rb_send. + cl_output->send_email( ). + + ENDCASE. + ENDMETHOD. "output + + METHOD f4_path. + DATA: new_path TYPE string, + repid TYPE syrepid, + dynnr TYPE sydynnr, + lt_dynpfields TYPE TABLE OF dynpread, + ls_dynpfields LIKE LINE OF lt_dynpfields. + +* Get current value + dynnr = sy-dynnr. + repid = sy-repid. + ls_dynpfields-fieldname = 'P_PATH'. + APPEND ls_dynpfields TO lt_dynpfields. + + CALL FUNCTION 'DYNP_VALUES_READ' + EXPORTING + dyname = repid + dynumb = dynnr + TABLES + dynpfields = lt_dynpfields + EXCEPTIONS + invalid_abapworkarea = 1 + invalid_dynprofield = 2 + invalid_dynproname = 3 + invalid_dynpronummer = 4 + invalid_request = 5 + no_fielddescription = 6 + invalid_parameter = 7 + undefind_error = 8 + double_conversion = 9 + stepl_not_found = 10 + OTHERS = 11. + IF sy-subrc <> 0. + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + EXIT. + ENDIF. + + READ TABLE lt_dynpfields INTO ls_dynpfields INDEX 1. + + new_path = ls_dynpfields-fieldvalue. + selected_folder = new_path. + + cl_gui_frontend_services=>directory_browse( + EXPORTING + window_title = 'Select path to download EXCEL-file' + initial_folder = new_path + CHANGING + selected_folder = new_path + EXCEPTIONS + cntl_error = 1 + error_no_gui = 2 + not_supported_by_gui = 3 + OTHERS = 4 + ). + cl_gui_cfw=>flush( ). + CHECK new_path IS NOT INITIAL. + selected_folder = new_path. + + ENDMETHOD. "f4_path + + METHOD parametertexts. +* If started in language w/o textelements translated set defaults +* Furthermore I don't have to change the selectiontexts of all demoreports. + DEFINE default_parametertext. + if %_&1_%_app_%-text = '&1' or + %_&1_%_app_%-text is initial. + %_&1_%_app_%-text = &2. + endif. + END-OF-DEFINITION. + + default_parametertext: rb_down 'Save to frontend', + rb_back 'Save to backend', + rb_show 'Direct display', + rb_send 'Send via email', + + p_path 'Frontend-path to download to', + p_email 'Email to send xlsx to'. + + ENDMETHOD. "parametertexts + + METHOD: download_frontend. + DATA: filename TYPE string. +* I don't like p_path here - but for this include it's ok + filename = p_path. +* Add trailing "\" or "/" + IF filename CA '/'. + REPLACE REGEX '([^/])\s*$' IN filename WITH '$1/' . + ELSE. + REPLACE REGEX '([^\\])\s*$' IN filename WITH '$1\\'. + ENDIF. + + CONCATENATE filename gc_save_file_name INTO filename. +* Get trailing blank + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = bytecount + filename = filename + filetype = 'BIN' + CHANGING data_tab = t_rawdata ). + ENDMETHOD. "download_frontend + + METHOD download_backend. + DATA: bytes_remain TYPE i. + FIELD-SYMBOLS: LIKE LINE OF t_rawdata. + + OPEN DATASET p_backfn FOR OUTPUT IN BINARY MODE. + CHECK sy-subrc = 0. + + bytes_remain = bytecount. + + LOOP AT t_rawdata ASSIGNING . + + AT LAST. + CHECK bytes_remain >= 0. + TRANSFER TO p_backfn LENGTH bytes_remain. + EXIT. + ENDAT. + + TRANSFER TO p_backfn. + SUBTRACT 255 FROM bytes_remain. " Solix has length 255 + + ENDLOOP. + + CLOSE DATASET p_backfn. + + + + + IF sy-repid <> sy-cprog AND sy-cprog IS NOT INITIAL. " no need to display anything if download was selected and report was called for demo purposes + LEAVE PROGRAM. + ELSE. + MESSAGE 'Data transferred to default backend directory' TYPE 'S'. + ENDIF. + ENDMETHOD. "download_backend + + METHOD display_online. + DATA:error TYPE REF TO i_oi_error, + t_errors TYPE STANDARD TABLE OF REF TO i_oi_error WITH NON-UNIQUE DEFAULT KEY, + cl_control TYPE REF TO i_oi_container_control, "OIContainerCtrl + cl_document TYPE REF TO i_oi_document_proxy. "Office Dokument + + c_oi_container_control_creator=>get_container_control( IMPORTING control = cl_control + error = error ). + APPEND error TO t_errors. + + cl_control->init_control( EXPORTING inplace_enabled = 'X' + no_flush = 'X' + r3_application_name = 'Demo Document Container' + parent = cl_gui_container=>screen0 + IMPORTING error = error + EXCEPTIONS OTHERS = 2 ). + APPEND error TO t_errors. + + cl_control->get_document_proxy( EXPORTING document_type = 'Excel.Sheet' " EXCEL + no_flush = ' ' + IMPORTING document_proxy = cl_document + error = error ). + APPEND error TO t_errors. +* Errorhandling should be inserted here + + cl_document->open_document_from_table( EXPORTING document_size = bytecount + document_table = t_rawdata + open_inplace = 'X' ). + + WRITE: '.'. " To create an output. That way screen0 will exist + ENDMETHOD. "display_online + + METHOD send_email. +* Needed to send emails + DATA: bcs_exception TYPE REF TO cx_bcs, + errortext TYPE string, + cl_send_request TYPE REF TO cl_bcs, + cl_document TYPE REF TO cl_document_bcs, + cl_recipient TYPE REF TO if_recipient_bcs, + cl_sender TYPE REF TO cl_cam_address_bcs, + t_attachment_header TYPE soli_tab, + wa_attachment_header LIKE LINE OF t_attachment_header, + attachment_subject TYPE sood-objdes, + + sood_bytecount TYPE sood-objlen, + mail_title TYPE so_obj_des, + t_mailtext TYPE soli_tab, + wa_mailtext LIKE LINE OF t_mailtext, + send_to TYPE adr6-smtp_addr, + sent TYPE os_boolean. + + + mail_title = 'Mail title'. + wa_mailtext = 'Mailtext'. + APPEND wa_mailtext TO t_mailtext. + + TRY. +* Create send request + cl_send_request = cl_bcs=>create_persistent( ). +* Create new document with mailtitle and mailtextg + cl_document = cl_document_bcs=>create_document( i_type = 'RAW' "#EC NOTEXT + i_text = t_mailtext + i_subject = mail_title ). +* Add attachment to document +* since the new excelfiles have an 4-character extension .xlsx but the attachment-type only holds 3 charactes .xls, +* we have to specify the real filename via attachment header +* Use attachment_type xls to have SAP display attachment with the excel-icon + attachment_subject = gc_save_file_name. + CONCATENATE '&SO_FILENAME=' attachment_subject INTO wa_attachment_header. + APPEND wa_attachment_header TO t_attachment_header. +* Attachment + sood_bytecount = bytecount. " next method expects sood_bytecount instead of any positive integer *sigh* + cl_document->add_attachment( i_attachment_type = 'XLS' "#EC NOTEXT + i_attachment_subject = attachment_subject + i_attachment_size = sood_bytecount + i_att_content_hex = t_rawdata + i_attachment_header = t_attachment_header ). + +* add document to send request + cl_send_request->set_document( cl_document ). + +* set sender in case if no own email is availabe +* cl_sender = cl_cam_address_bcs=>create_internet_address( 'sender@sender.sender' ). +* cl_send_request->set_sender( cl_sender ). + +* add recipient(s) - here only 1 will be needed + send_to = p_email. + IF send_to IS INITIAL. + send_to = 'no_email@no_email.no_email'. " Place into SOST in any case for demonstration purposes + ENDIF. + cl_recipient = cl_cam_address_bcs=>create_internet_address( send_to ). + cl_send_request->add_recipient( cl_recipient ). + +* Und abschicken + sent = cl_send_request->send( i_with_error_screen = 'X' ). + + COMMIT WORK. + + IF sent IS INITIAL. + MESSAGE i500(sbcoms) WITH p_email. + ELSE. + MESSAGE s022(so). + MESSAGE 'Document ready to be sent - Check SOST or SCOT' TYPE 'I'. + ENDIF. + + CATCH cx_bcs INTO bcs_exception. + errortext = bcs_exception->if_message~get_text( ). + MESSAGE errortext TYPE 'I'. + + ENDTRY. + ENDMETHOD. "send_email + + +ENDCLASS. "lcl_output IMPLEMENTATION diff --git a/src/zdemo_excel_outputopt_incl.prog.xml b/src/zdemo_excel_outputopt_incl.prog.xml new file mode 100644 index 0000000..0d6214a --- /dev/null +++ b/src/zdemo_excel_outputopt_incl.prog.xml @@ -0,0 +1,22 @@ + + + + + + ZDEMO_EXCEL_OUTPUTOPT_INCL + A + X + I + E + X + + + + R + Include ZDEMO_EXCEL_OUTPUTOPT_INCL + 34 + + + + + diff --git a/src/zdemo_teched1.prog.abap b/src/zdemo_teched1.prog.abap new file mode 100644 index 0000000..d5b52ff --- /dev/null +++ b/src/zdemo_teched1.prog.abap @@ -0,0 +1,83 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED1 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched1. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo01' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched1.prog.xml b/src/zdemo_teched1.prog.xml new file mode 100644 index 0000000..12ee61f --- /dev/null +++ b/src/zdemo_teched1.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED1 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched10.prog.abap b/src/zdemo_teched10.prog.abap new file mode 100644 index 0000000..e22f46f --- /dev/null +++ b/src/zdemo_teched10.prog.abap @@ -0,0 +1,49 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_reader TYPE REF TO zif_excel_reader, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +DATA: lt_files TYPE filetable, + ls_file TYPE file_table, + lv_rc TYPE i, + lv_value TYPE zexcel_cell_value. + +CONSTANTS: gc_save_file_name TYPE string VALUE 'TechEd01.xlsx'. +INCLUDE zdemo_excel_outputopt_incl. + +START-OF-SELECTION. + +******************************* +* abap2xlsx read XLSX * +******************************* + CREATE OBJECT lo_excel_reader TYPE zcl_excel_reader_2007. + lo_excel = lo_excel_reader->load_file( lv_full_path ). + + lo_excel->set_active_sheet_index( 1 ). + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_worksheet->get_cell( EXPORTING ip_column = 'C' + ip_row = 10 + IMPORTING ep_value = lv_value ). + + WRITE: 'abap2xlsx total score is ', lv_value. + +*** Create output + lcl_output=>output( lo_excel ). diff --git a/src/zdemo_teched10.prog.xml b/src/zdemo_teched10.prog.xml new file mode 100644 index 0000000..f440fb6 --- /dev/null +++ b/src/zdemo_teched10.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED10 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched2.prog.abap b/src/zdemo_teched2.prog.abap new file mode 100644 index 0000000..f880da8 --- /dev/null +++ b/src/zdemo_teched2.prog.abap @@ -0,0 +1,91 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED2 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched2. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lv_style_title_guid TYPE zexcel_cell_style. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched2.prog.xml b/src/zdemo_teched2.prog.xml new file mode 100644 index 0000000..e14fac2 --- /dev/null +++ b/src/zdemo_teched2.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED2 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched3.prog.abap b/src/zdemo_teched3.prog.abap new file mode 100644 index 0000000..3057087 --- /dev/null +++ b/src/zdemo_teched3.prog.abap @@ -0,0 +1,107 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lv_style_title_guid TYPE zexcel_cell_style, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched3.prog.xml b/src/zdemo_teched3.prog.xml new file mode 100644 index 0000000..40fba5a --- /dev/null +++ b/src/zdemo_teched3.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED3 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched4.prog.abap b/src/zdemo_teched4.prog.abap new file mode 100644 index 0000000..0fa638a --- /dev/null +++ b/src/zdemo_teched4.prog.abap @@ -0,0 +1,129 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lv_style_title_guid TYPE zexcel_cell_style, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched4.prog.xml b/src/zdemo_teched4.prog.xml new file mode 100644 index 0000000..1604924 --- /dev/null +++ b/src/zdemo_teched4.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED4 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched5.prog.abap b/src/zdemo_teched5.prog.abap new file mode 100644 index 0000000..45d351a --- /dev/null +++ b/src/zdemo_teched5.prog.abap @@ -0,0 +1,150 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lv_style_title_guid TYPE zexcel_cell_style, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " add data validation + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 7. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). + + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched5.prog.xml b/src/zdemo_teched5.prog.xml new file mode 100644 index 0000000..9a43b8b --- /dev/null +++ b/src/zdemo_teched5.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED5 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched6.prog.abap b/src/zdemo_teched6.prog.abap new file mode 100644 index 0000000..9752085 --- /dev/null +++ b/src/zdemo_teched6.prog.abap @@ -0,0 +1,157 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lv_style_title_guid TYPE zexcel_cell_style, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " add data validation + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 7. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). + + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). + + " add autosize (column width) + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched6.prog.xml b/src/zdemo_teched6.prog.xml new file mode 100644 index 0000000..d56bd7a --- /dev/null +++ b/src/zdemo_teched6.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED6 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched7.prog.abap b/src/zdemo_teched7.prog.abap new file mode 100644 index 0000000..a429c8f --- /dev/null +++ b/src/zdemo_teched7.prog.abap @@ -0,0 +1,160 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lv_style_title_guid TYPE zexcel_cell_style, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). + + lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_value = 'Total score' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 10 ip_formula = 'SUM(C7:C8)' ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " add data validation + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 7. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). + + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). + + " add autosize (column width) + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched7.prog.xml b/src/zdemo_teched7.prog.xml new file mode 100644 index 0000000..5ffaf23 --- /dev/null +++ b/src/zdemo_teched7.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED7 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched8.prog.abap b/src/zdemo_teched8.prog.abap new file mode 100644 index 0000000..109064a --- /dev/null +++ b/src/zdemo_teched8.prog.abap @@ -0,0 +1,222 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_style_green TYPE REF TO zcl_excel_style, + lo_style_yellow TYPE REF TO zcl_excel_style, + lo_style_red TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lo_style_conditional TYPE REF TO zcl_excel_style_conditional, + lv_style_title_guid TYPE zexcel_cell_style, + lv_style_green_guid TYPE zexcel_cell_style, + lv_style_yellow_guid TYPE zexcel_cell_style, + lv_style_red_guid TYPE zexcel_cell_style, + ls_cellis TYPE zexcel_conditional_cellis, + ls_key TYPE wwwdatatab. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lt_file_tab TYPE solix_tab. + +DATA: lv_full_path TYPE string, + lv_workdir TYPE string, + lv_file_separator TYPE c. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* Selection screen management * +******************************* + +PARAMETERS: p_path TYPE zexcel_export_dir. + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. + lv_workdir = p_path. + cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir + CHANGING selected_folder = lv_workdir ). + p_path = lv_workdir. + +INITIALIZATION. + cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). + cl_gui_cfw=>flush( ). + p_path = lv_workdir. + +START-OF-SELECTION. + + IF p_path IS INITIAL. + p_path = lv_workdir. + ENDIF. + cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). + CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). + + lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_value = 'Total score' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 10 ip_formula = 'SUM(C7:C8)' ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + +* ls_key-relid = 'MI'. +* ls_key-objid = 'WBLOGO'. +* lo_drawing->set_media_www( ip_key = ls_key +* ip_width = 140 +* ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " add data validation + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 7. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). + + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). + + " add autosize (column width) + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " defne conditional styles + lo_style_green = lo_excel->add_new_style( ). + lo_style_green->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_green->fill->bgcolor-rgb = zcl_excel_style_color=>c_green. + lv_style_green_guid = lo_style_green->get_guid( ). + + lo_style_yellow = lo_excel->add_new_style( ). + lo_style_yellow->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_yellow->fill->bgcolor-rgb = zcl_excel_style_color=>c_yellow. + lv_style_yellow_guid = lo_style_yellow->get_guid( ). + + lo_style_red = lo_excel->add_new_style( ). + lo_style_red->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_red->fill->bgcolor-rgb = zcl_excel_style_color=>c_red. + lv_style_red_guid = lo_style_red->get_guid( ). + + " add conditional formatting + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '5'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_greaterthan. + ls_cellis-cell_style = lv_style_green_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 1. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '5'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_equal. + ls_cellis-cell_style = lv_style_yellow_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 2. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '0'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_greaterthan. + ls_cellis-cell_style = lv_style_red_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 3. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + + " Save the file + cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount + filename = lv_full_path + filetype = 'BIN' + CHANGING data_tab = lt_file_tab ). diff --git a/src/zdemo_teched8.prog.xml b/src/zdemo_teched8.prog.xml new file mode 100644 index 0000000..a91c2d5 --- /dev/null +++ b/src/zdemo_teched8.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED8 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zdemo_teched9.prog.abap b/src/zdemo_teched9.prog.abap new file mode 100644 index 0000000..c9b0ac8 --- /dev/null +++ b/src/zdemo_teched9.prog.abap @@ -0,0 +1,215 @@ +*&---------------------------------------------------------------------* +*& Report ZDEMO_TECHED3 +*& +*&---------------------------------------------------------------------* +*& +*& +*&---------------------------------------------------------------------* + +REPORT zdemo_teched3. + +******************************* +* Data Object declaration * +******************************* + +DATA: lo_excel TYPE REF TO zcl_excel, + lo_excel_writer TYPE REF TO zif_excel_writer, + lo_worksheet TYPE REF TO zcl_excel_worksheet. + +DATA: lo_style_title TYPE REF TO zcl_excel_style, + lo_style_green TYPE REF TO zcl_excel_style, + lo_style_yellow TYPE REF TO zcl_excel_style, + lo_style_red TYPE REF TO zcl_excel_style, + lo_drawing TYPE REF TO zcl_excel_drawing, + lo_range TYPE REF TO zcl_excel_range, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, + lo_style_conditional TYPE REF TO zcl_excel_style_conditional, + lv_style_title_guid TYPE zexcel_cell_style, + lv_style_green_guid TYPE zexcel_cell_style, + lv_style_yellow_guid TYPE zexcel_cell_style, + lv_style_red_guid TYPE zexcel_cell_style, + ls_cellis TYPE zexcel_conditional_cellis, + ls_key TYPE wwwdatatab. + +DATA: lo_send_request TYPE REF TO cl_bcs, + lo_document TYPE REF TO cl_document_bcs, + lo_sender TYPE REF TO cl_sapuser_bcs, + lo_recipient TYPE REF TO cl_sapuser_bcs, + lo_recipient_i TYPE REF TO CL_CAM_ADDRESS_BCS. + +DATA: lv_file TYPE xstring, + lv_bytecount TYPE i, + lv_bytecount_c TYPE sood-objlen, + lt_file_tab TYPE solix_tab. + +CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. + +******************************* +* abap2xlsx create XLSX * +******************************* + + " Create excel instance + CREATE OBJECT lo_excel. + + " Styles + lo_style_title = lo_excel->add_new_style( ). + lo_style_title->font->bold = abap_true. + lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. + lv_style_title_guid = lo_style_title->get_guid( ). + + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lo_worksheet->set_title( ip_title = 'Demo TechEd' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). + lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). + + lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_value = 'Total score' ). + lo_worksheet->set_cell( ip_column = 'C' ip_row = 10 ip_formula = 'SUM(C7:C8)' ). + + " add logo from SMWO + lo_drawing = lo_excel->add_new_drawing( ). + lo_drawing->set_position( ip_from_row = 2 + ip_from_col = 'B' ). + + ls_key-relid = 'MI'. + ls_key-objid = 'WBLOGO'. + lo_drawing->set_media_www( ip_key = ls_key + ip_width = 140 + ip_height = 64 ). + + " assign drawing to the worksheet + lo_worksheet->add_drawing( lo_drawing ). + + " Add new sheet + lo_worksheet = lo_excel->add_new_worksheet( ). + lo_worksheet->set_title( ip_title = 'Values' ). + + " Set values for range + lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). + lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). + lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). + lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). + lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). + + lo_range = lo_excel->add_new_range( ). + lo_range->name = 'Values'. + lo_range->set_value( ip_sheet_name = 'Values' + ip_start_column = 'A' + ip_start_row = 4 + ip_stop_column = 'A' + ip_stop_row = 8 ). + + lo_excel->set_active_sheet_index( 1 ). + + " add data validation + lo_worksheet = lo_excel->get_active_worksheet( ). + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 7. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). + + + lo_data_validation = lo_worksheet->add_new_data_validation( ). + lo_data_validation->type = zcl_excel_data_validation=>c_type_list. + lo_data_validation->formula1 = 'Values'. + lo_data_validation->cell_row = 8. + lo_data_validation->cell_column = 'C'. + lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). + + " add autosize (column width) + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'B' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + lo_column_dimension = lo_worksheet->get_column_dimension( ip_column = 'C' ). + lo_column_dimension->set_auto_size( ip_auto_size = abap_true ). + + " defne conditional styles + lo_style_green = lo_excel->add_new_style( ). + lo_style_green->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_green->fill->bgcolor-rgb = zcl_excel_style_color=>c_green. + lv_style_green_guid = lo_style_green->get_guid( ). + + lo_style_yellow = lo_excel->add_new_style( ). + lo_style_yellow->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_yellow->fill->bgcolor-rgb = zcl_excel_style_color=>c_yellow. + lv_style_yellow_guid = lo_style_yellow->get_guid( ). + + lo_style_red = lo_excel->add_new_style( ). + lo_style_red->fill->filltype = zcl_excel_style_fill=>c_fill_solid. + lo_style_red->fill->bgcolor-rgb = zcl_excel_style_color=>c_red. + lv_style_red_guid = lo_style_red->get_guid( ). + + " add conditional formatting + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '5'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_greaterthan. + ls_cellis-cell_style = lv_style_green_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 1. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '5'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_equal. + ls_cellis-cell_style = lv_style_yellow_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 2. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + lo_style_conditional = lo_worksheet->add_new_conditional_style( ). + lo_style_conditional->rule = zcl_excel_style_conditional=>c_rule_cellis. + ls_cellis-formula = '0'. + ls_cellis-operator = zcl_excel_style_conditional=>c_operator_greaterthan. + ls_cellis-cell_style = lv_style_red_guid. + lo_style_conditional->mode_cellis = ls_cellis. + lo_style_conditional->priority = 3. + lo_style_conditional->set_range( ip_start_column = 'C' + ip_start_row = 10 + ip_stop_column = 'C' + ip_stop_row = 10 ). + + + " Create xlsx stream + CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. + lv_file = lo_excel_writer->write_file( lo_excel ). + +******************************* +* Output * +******************************* + + " Convert to binary + lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). + lv_bytecount = xstrlen( lv_file ). + lv_bytecount_c = lv_bytecount. + + " Send via email + lo_document = cl_document_bcs=>create_document( i_type = 'RAW' + i_subject = 'Demo TechEd' ). + + lo_document->add_attachment( i_attachment_type = 'EXT' + i_attachment_subject = 'abap2xlsx.xlsx' + i_attachment_size = lv_bytecount_c + i_att_content_hex = lt_file_tab ). + + lo_sender = cl_sapuser_bcs=>create( sy-uname ). + lo_recipient = cl_sapuser_bcs=>create( sy-uname ). +* lo_recipient_i = cl_cam_address_bcs=>create_internet_address( 'ivan.femia@techedge.it' ). + + lo_send_request = cl_bcs=>create_persistent( ). + lo_send_request->set_document( lo_document ). + lo_send_request->set_sender( lo_sender ). + lo_send_request->add_recipient( lo_recipient ). + lo_send_request->set_send_immediately( abap_true ). + lo_send_request->send( ). diff --git a/src/zdemo_teched9.prog.xml b/src/zdemo_teched9.prog.xml new file mode 100644 index 0000000..54fc2ea --- /dev/null +++ b/src/zdemo_teched9.prog.xml @@ -0,0 +1,32 @@ + + + + + + ZDEMO_TECHED9 + A + X + 1 + T + E + X + X + + + + + R + abap2xlsx Demo: Hello World + 27 + + + S + P_PATH + . + 9 + D + + + + + diff --git a/src/zexcel_active_worksheet.dtel.xml b/src/zexcel_active_worksheet.dtel.xml new file mode 100644 index 0000000..d3cbdcd --- /dev/null +++ b/src/zexcel_active_worksheet.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_ACTIVE_WORKSHEET + E + INT1 + 16 + 06 + 16 + 16 + Active Worksheet + Active Worksheet + Active + Active Worksheet + Active Worksheet + E + D + + + + + diff --git a/src/zexcel_aes_password.dtel.xml b/src/zexcel_aes_password.dtel.xml new file mode 100644 index 0000000..e4c4c18 --- /dev/null +++ b/src/zexcel_aes_password.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_AES_PASSWORD + E + CHAR50 + 20 + 10 + 15 + 20 + AES Password + AES Password + AES Pwd + AES Password + AES Password + E + D + + + + + diff --git a/src/zexcel_alignment.dtel.xml b/src/zexcel_alignment.dtel.xml new file mode 100644 index 0000000..2a62815 --- /dev/null +++ b/src/zexcel_alignment.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_ALIGNMENT + E + CHAR20 + 09 + 09 + 09 + 09 + Alignment + Alignment + Alignment + Alignment + Alignment + E + D + + + + + diff --git a/src/zexcel_application.dtel.xml b/src/zexcel_application.dtel.xml new file mode 100644 index 0000000..82af051 --- /dev/null +++ b/src/zexcel_application.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_APPLICATION + E + TEXT80 + 55 + 10 + 15 + 20 + Application + Application + Applic. + Application + Application + E + D + + + + + diff --git a/src/zexcel_appversion.dtel.xml b/src/zexcel_appversion.dtel.xml new file mode 100644 index 0000000..7544f35 --- /dev/null +++ b/src/zexcel_appversion.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_APPVERSION + E + CHAR07 + 19 + 10 + 19 + 20 + Application version + Application version + AppVersion + Application version + Application version + E + D + + + + + diff --git a/src/zexcel_book_protection.dtel.xml b/src/zexcel_book_protection.dtel.xml new file mode 100644 index 0000000..3ddb020 --- /dev/null +++ b/src/zexcel_book_protection.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_BOOK_PROTECTION + E + XFELD + 16 + 10 + 16 + 20 + Book protection indicator + Book protection + Protection + Book protection + Book protection + E + D + + + + + diff --git a/src/zexcel_boole01.doma.xml b/src/zexcel_boole01.doma.xml new file mode 100644 index 0000000..795249a --- /dev/null +++ b/src/zexcel_boole01.doma.xml @@ -0,0 +1,32 @@ + + + + + + ZEXCEL_BOOLE01 + E + CHAR + 000001 + 000001 + X + XML Schema bool data type + + + + ZEXCEL_BOOLE01 + 0001 + E + 1 + True + + + ZEXCEL_BOOLE01 + 0002 + E + 0 + False + + + + + diff --git a/src/zexcel_border.dtel.xml b/src/zexcel_border.dtel.xml new file mode 100644 index 0000000..408228c --- /dev/null +++ b/src/zexcel_border.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_BORDER + E + CHAR20 + 12 + 06 + 12 + 12 + Border style + Border style + Border + Border style + Border style + E + D + + + + + diff --git a/src/zexcel_break.dtel.xml b/src/zexcel_break.dtel.xml new file mode 100644 index 0000000..90cf806 --- /dev/null +++ b/src/zexcel_break.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_BREAK + E + INT1 + 15 + 10 + 15 + 20 + Worksheet Break + Worksheet Break + Break + Worksheet Break + Worksheet Break + E + D + + + + + diff --git a/src/zexcel_category.dtel.xml b/src/zexcel_category.dtel.xml new file mode 100644 index 0000000..fd687c4 --- /dev/null +++ b/src/zexcel_category.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CATEGORY + E + TEXT80 + 55 + 10 + 15 + 20 + Category + Category + Category + Category + Category + E + D + + + + + diff --git a/src/zexcel_cell_column.dtel.xml b/src/zexcel_cell_column.dtel.xml new file mode 100644 index 0000000..7233de8 --- /dev/null +++ b/src/zexcel_cell_column.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_COLUMN + E + INT4 + 11 + 06 + 11 + 11 + Cell Column + Cell Column + Column + Cell Column + Cell Column + E + D + + + + + diff --git a/src/zexcel_cell_column_alpha.dtel.xml b/src/zexcel_cell_column_alpha.dtel.xml new file mode 100644 index 0000000..27ceacc --- /dev/null +++ b/src/zexcel_cell_column_alpha.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_COLUMN_ALPHA + E + CHAR3 + 11 + 06 + 11 + 11 + Cell Column + Cell Column + Column + Cell Column + Cell Column + E + D + + + + + diff --git a/src/zexcel_cell_coords.dtel.xml b/src/zexcel_cell_coords.dtel.xml new file mode 100644 index 0000000..e86dc95 --- /dev/null +++ b/src/zexcel_cell_coords.dtel.xml @@ -0,0 +1,23 @@ + + + + + + ZEXCEL_CELL_COORDS + E + 25 + 10 + 16 + 25 + Cell coordinates as Excel + Cell coordinates as Excel + Cell coord + Cell coordinates + Cell coordinates as Excel + E + STRG + + + + + diff --git a/src/zexcel_cell_data_type.dtel.xml b/src/zexcel_cell_data_type.dtel.xml new file mode 100644 index 0000000..78a6ff0 --- /dev/null +++ b/src/zexcel_cell_data_type.dtel.xml @@ -0,0 +1,23 @@ + + + + + + ZEXCEL_CELL_DATA_TYPE + E + 14 + 09 + 14 + 14 + Cell data type + Cell data type + Data type + Cell data type + Cell data type + E + STRG + + + + + diff --git a/src/zexcel_cell_formula.dtel.xml b/src/zexcel_cell_formula.dtel.xml new file mode 100644 index 0000000..f6a10b2 --- /dev/null +++ b/src/zexcel_cell_formula.dtel.xml @@ -0,0 +1,23 @@ + + + + + + ZEXCEL_CELL_FORMULA + E + 12 + 10 + 15 + 20 + Cell Formula + Cell Formula + Formula + Cell Formula + Cell Formula + E + STRG + + + + + diff --git a/src/zexcel_cell_protection.doma.xml b/src/zexcel_cell_protection.doma.xml new file mode 100644 index 0000000..a5b19b9 --- /dev/null +++ b/src/zexcel_cell_protection.doma.xml @@ -0,0 +1,32 @@ + + + + + + ZEXCEL_CELL_PROTECTION + E + CHAR + 000001 + 000001 + X + Cell locked + + + + ZEXCEL_CELL_PROTECTION + 0001 + E + 1 + Locked + + + ZEXCEL_CELL_PROTECTION + 0002 + E + 0 + Unlocked + + + + + diff --git a/src/zexcel_cell_protection.dtel.xml b/src/zexcel_cell_protection.dtel.xml new file mode 100644 index 0000000..d091e57 --- /dev/null +++ b/src/zexcel_cell_protection.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_PROTECTION + E + ZEXCEL_CELL_PROTECTION + 15 + 10 + 16 + 20 + Cell protection indicator + Cell protection + Protection + Cell protection + Cell protection + E + D + + + + + diff --git a/src/zexcel_cell_row.dtel.xml b/src/zexcel_cell_row.dtel.xml new file mode 100644 index 0000000..2a5d7aa --- /dev/null +++ b/src/zexcel_cell_row.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_ROW + E + INT4 + 08 + 08 + 08 + 08 + Cell Row + Cell Row + Row + Cell Row + Cell Row + E + D + + + + + diff --git a/src/zexcel_cell_style.dtel.xml b/src/zexcel_cell_style.dtel.xml new file mode 100644 index 0000000..9f34e52 --- /dev/null +++ b/src/zexcel_cell_style.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_STYLE + E + UUID + 16 + 10 + 16 + 20 + Style identifier + Style identifier + Style no + Style identifier + Style identifier + E + D + + + + + diff --git a/src/zexcel_cell_value.dtel.xml b/src/zexcel_cell_value.dtel.xml new file mode 100644 index 0000000..40c717f --- /dev/null +++ b/src/zexcel_cell_value.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CELL_VALUE + E + STRING + 10 + 10 + 15 + 20 + Cell Value + Cell Value + Value + Cell Value + Cell Value + E + D + + + + + diff --git a/src/zexcel_color.dtel.xml b/src/zexcel_color.dtel.xml new file mode 100644 index 0000000..0f3ba95 --- /dev/null +++ b/src/zexcel_color.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_COLOR + E + CHAR8 + 12 + 06 + 12 + 12 + Color + Color + Color + Color + Color + E + D + + + + + diff --git a/src/zexcel_company.dtel.xml b/src/zexcel_company.dtel.xml new file mode 100644 index 0000000..746260c --- /dev/null +++ b/src/zexcel_company.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_COMPANY + E + TEXT80 + 55 + 10 + 15 + 20 + Company + Company + Company + Company + Company + E + D + + + + + diff --git a/src/zexcel_condition_operator.dtel.xml b/src/zexcel_condition_operator.dtel.xml new file mode 100644 index 0000000..819b9f3 --- /dev/null +++ b/src/zexcel_condition_operator.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITION_OPERATOR + E + CHAR20 + 20 + 10 + 18 + 20 + Condition operator + Condition operator + Cond. oper + Condition operator + Condition operator + E + D + + + + + diff --git a/src/zexcel_condition_rule.dtel.xml b/src/zexcel_condition_rule.dtel.xml new file mode 100644 index 0000000..615f120 --- /dev/null +++ b/src/zexcel_condition_rule.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITION_RULE + E + CHAR20 + 20 + 10 + 15 + 20 + Condition rule + Condition rule + Cond. rule + Condition rule + Condition rule + E + D + + + + + diff --git a/src/zexcel_condition_rule_iconset.dtel.xml b/src/zexcel_condition_rule_iconset.dtel.xml new file mode 100644 index 0000000..844cfa8 --- /dev/null +++ b/src/zexcel_condition_rule_iconset.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITION_RULE_ICONSET + E + CHAR20 + 22 + 10 + 18 + 22 + Condition rule iconset + Condition rule iconset + Cond. rule + Cond. rule iconset + Condition rule iconset + E + D + + + + + diff --git a/src/zexcel_conditional.dtel.xml b/src/zexcel_conditional.dtel.xml new file mode 100644 index 0000000..96bc62e --- /dev/null +++ b/src/zexcel_conditional.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITIONAL + E + CHAR20 + 20 + 10 + 15 + 20 + Conditional + Conditional + Condit. + Conditional + Conditional + E + D + + + + + diff --git a/src/zexcel_conditional_show_value.dtel.xml b/src/zexcel_conditional_show_value.dtel.xml new file mode 100644 index 0000000..e623bb3 --- /dev/null +++ b/src/zexcel_conditional_show_value.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITIONAL_SHOW_VALUE + E + ZEXCEL_BOOLE01 + 15 + 05 + 15 + 15 + Condition type + Condition type + Type + Condition type + Condition type + E + D + + + + + diff --git a/src/zexcel_conditional_type.dtel.xml b/src/zexcel_conditional_type.dtel.xml new file mode 100644 index 0000000..054c673 --- /dev/null +++ b/src/zexcel_conditional_type.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITIONAL_TYPE + E + TEXT10 + 15 + 05 + 15 + 15 + Condition type + Condition type + Type + Condition type + Condition type + E + D + + + + + diff --git a/src/zexcel_conditional_value.dtel.xml b/src/zexcel_conditional_value.dtel.xml new file mode 100644 index 0000000..a0dd7e3 --- /dev/null +++ b/src/zexcel_conditional_value.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONDITIONAL_VALUE + E + STRING + 15 + 05 + 15 + 15 + Condition value + Condition value + Value + Condition value + Condition value + E + D + + + + + diff --git a/src/zexcel_converter_option.doma.xml b/src/zexcel_converter_option.doma.xml new file mode 100644 index 0000000..49e116e --- /dev/null +++ b/src/zexcel_converter_option.doma.xml @@ -0,0 +1,38 @@ + + + + + + ZEXCEL_CONVERTER_OPTION + E + CHAR + 000001 + 000001 + X + Converter Option + + + + ZEXCEL_CONVERTER_OPTION + 0001 + E + Option not converted + + + ZEXCEL_CONVERTER_OPTION + 0002 + E + X + Option Converted + + + ZEXCEL_CONVERTER_OPTION + 0003 + E + - + Option applied converted + + + + + diff --git a/src/zexcel_converter_option_filter.dtel.xml b/src/zexcel_converter_option_filter.dtel.xml new file mode 100644 index 0000000..a0c7e22 --- /dev/null +++ b/src/zexcel_converter_option_filter.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONVERTER_OPTION_FILTER + E + ZEXCEL_CONVERTER_OPTION + 14 + 10 + 15 + 24 + Filter options for converter with grid object + Filter options + Filter + Filter options + Converter Filter options + E + D + + + + + diff --git a/src/zexcel_converter_option_hidehd.dtel.xml b/src/zexcel_converter_option_hidehd.dtel.xml new file mode 100644 index 0000000..8476785 --- /dev/null +++ b/src/zexcel_converter_option_hidehd.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONVERTER_OPTION_HIDEHD + E + ZEXCEL_CONVERTER_OPTION + 20 + 10 + 17 + 30 + Hiden column header for converter with grid object + Hiden column options + Hiden col. + Hiden column opt. + Converter hiden column options + E + D + + + + + diff --git a/src/zexcel_converter_option_hidenc.dtel.xml b/src/zexcel_converter_option_hidenc.dtel.xml new file mode 100644 index 0000000..b987383 --- /dev/null +++ b/src/zexcel_converter_option_hidenc.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONVERTER_OPTION_HIDENC + E + ZEXCEL_CONVERTER_OPTION + 20 + 10 + 17 + 30 + Hiden column options for converter with grid object + Hiden column options + Hiden col. + Hiden column opt. + Converter hiden column options + E + D + + + + + diff --git a/src/zexcel_converter_option_subtot.dtel.xml b/src/zexcel_converter_option_subtot.dtel.xml new file mode 100644 index 0000000..2996067 --- /dev/null +++ b/src/zexcel_converter_option_subtot.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CONVERTER_OPTION_SUBTOT + E + ZEXCEL_CONVERTER_OPTION + 16 + 10 + 16 + 26 + Subtotal options for converter with grid object + Subtotal options + Subtotal + Subtotal options + Converter subtotal options + E + D + + + + + diff --git a/src/zexcel_creator.dtel.xml b/src/zexcel_creator.dtel.xml new file mode 100644 index 0000000..006ea82 --- /dev/null +++ b/src/zexcel_creator.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_CREATOR + E + TEXT80 + 07 + 07 + 07 + 07 + Creator + Creator + Creator + Creator + Creator + E + D + + + + + diff --git a/src/zexcel_data_val_error_style.dtel.xml b/src/zexcel_data_val_error_style.dtel.xml new file mode 100644 index 0000000..e078727 --- /dev/null +++ b/src/zexcel_data_val_error_style.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DATA_VAL_ERROR_STYLE + E + CHAR20 + 28 + 10 + 20 + 28 + Data validation error style + Data validation error style + Error sty. + Data val. err. style + Data validation error style + E + D + + + + + diff --git a/src/zexcel_data_val_operator.dtel.xml b/src/zexcel_data_val_operator.dtel.xml new file mode 100644 index 0000000..4de5821 --- /dev/null +++ b/src/zexcel_data_val_operator.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DATA_VAL_OPERATOR + E + CHAR20 + 28 + 10 + 20 + 28 + Data validation operator + Data validation operator + Operator + Data val. operator + Data validation operator + E + D + + + + + diff --git a/src/zexcel_data_val_type.dtel.xml b/src/zexcel_data_val_type.dtel.xml new file mode 100644 index 0000000..d43843c --- /dev/null +++ b/src/zexcel_data_val_type.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DATA_VAL_TYPE + E + CHAR20 + 20 + 10 + 20 + 20 + Data validation type + Data validation type + Type + Data validation type + Data validation type + E + D + + + + + diff --git a/src/zexcel_dec_8_2.doma.xml b/src/zexcel_dec_8_2.doma.xml new file mode 100644 index 0000000..e794d39 --- /dev/null +++ b/src/zexcel_dec_8_2.doma.xml @@ -0,0 +1,17 @@ + + + + + + ZEXCEL_DEC_8_2 + E + DEC + 000008 + 000010 + 000002 + Decimal number 8.2 + + + + + diff --git a/src/zexcel_dec_8_2.dtel.xml b/src/zexcel_dec_8_2.dtel.xml new file mode 100644 index 0000000..6b7e097 --- /dev/null +++ b/src/zexcel_dec_8_2.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DEC_8_2 + E + ZEXCEL_DEC_8_2 + 18 + 07 + 18 + 18 + Decimal number 8.2 + Decimal number 8.2 + Dec 8.2 + Decimal number 8.2 + Decimal number 8.2 + E + D + + + + + diff --git a/src/zexcel_description.dtel.xml b/src/zexcel_description.dtel.xml new file mode 100644 index 0000000..9e0af40 --- /dev/null +++ b/src/zexcel_description.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DESCRIPTION + E + TEXT80 + 55 + 10 + 15 + 20 + Description + Description + Descr. + Description + Description + E + D + + + + + diff --git a/src/zexcel_diagonal.dtel.xml b/src/zexcel_diagonal.dtel.xml new file mode 100644 index 0000000..1aaab5c --- /dev/null +++ b/src/zexcel_diagonal.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DIAGONAL + E + INT1 + 09 + 09 + 09 + 09 + Diagonal + Fill Type + Fill Type + Fill Type + Fill Type + E + D + + + + + diff --git a/src/zexcel_docsecurity.dtel.xml b/src/zexcel_docsecurity.dtel.xml new file mode 100644 index 0000000..2e37329 --- /dev/null +++ b/src/zexcel_docsecurity.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DOCSECURITY + E + NUMC1 + 55 + 10 + 15 + 20 + DocSecurity + DocSecurity + DocSec. + DocSecurity + DocSecurity + E + D + + + + + diff --git a/src/zexcel_drawing_anchor.doma.xml b/src/zexcel_drawing_anchor.doma.xml new file mode 100644 index 0000000..1d32d96 --- /dev/null +++ b/src/zexcel_drawing_anchor.doma.xml @@ -0,0 +1,39 @@ + + + + + + ZEXCEL_DRAWING_ANCHOR + E + CHAR + 000003 + 000003 + X + Excel drawing anchor type + + + + ZEXCEL_DRAWING_ANCHOR + 0001 + E + ABS + Absolute position + + + ZEXCEL_DRAWING_ANCHOR + 0002 + E + ONE + One-cell anchor + + + ZEXCEL_DRAWING_ANCHOR + 0003 + E + TWO + Two-cell anchor + + + + + diff --git a/src/zexcel_drawing_anchor.dtel.xml b/src/zexcel_drawing_anchor.dtel.xml new file mode 100644 index 0000000..3fc29e6 --- /dev/null +++ b/src/zexcel_drawing_anchor.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DRAWING_ANCHOR + E + ZEXCEL_DRAWING_ANCHOR + 06 + 10 + 15 + 20 + Excel Drawing anchor + Anchor + Anchor + Anchor + Anchor Type + E + D + + + + + diff --git a/src/zexcel_drawing_type.doma.xml b/src/zexcel_drawing_type.doma.xml new file mode 100644 index 0000000..246fe53 --- /dev/null +++ b/src/zexcel_drawing_type.doma.xml @@ -0,0 +1,33 @@ + + + + + + ZEXCEL_DRAWING_TYPE + E + CHAR + 000005 + 000005 + X + X + Excel Drawing type + + + + ZEXCEL_DRAWING_TYPE + 0001 + E + image + Image + + + ZEXCEL_DRAWING_TYPE + 0002 + E + chart + Chart + + + + + diff --git a/src/zexcel_drawing_type.dtel.xml b/src/zexcel_drawing_type.dtel.xml new file mode 100644 index 0000000..037e3b4 --- /dev/null +++ b/src/zexcel_drawing_type.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_DRAWING_TYPE + E + ZEXCEL_DRAWING_TYPE + 04 + 10 + 15 + 20 + Excel Drawing type + Type + Type + Type + Drawing type + E + D + + + + + diff --git a/src/zexcel_export_dir.dtel.xml b/src/zexcel_export_dir.dtel.xml new file mode 100644 index 0000000..48e992b --- /dev/null +++ b/src/zexcel_export_dir.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_EXPORT_DIR + E + TEXT255 + 20 + 10 + 15 + 20 + Export Directory + Export Directory + Exprt D + Exprt D + Export Directory + E + D + + + + + diff --git a/src/zexcel_fill.dtel.xml b/src/zexcel_fill.dtel.xml new file mode 100644 index 0000000..4ba3d36 --- /dev/null +++ b/src/zexcel_fill.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_FILL + E + CHAR10 + 04 + 04 + 04 + 04 + Font + Font + Font + Font + Font + E + D + + + + + diff --git a/src/zexcel_fill_type.dtel.xml b/src/zexcel_fill_type.dtel.xml new file mode 100644 index 0000000..8b6578f --- /dev/null +++ b/src/zexcel_fill_type.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_FILL_TYPE + E + CHAR20 + 09 + 09 + 09 + 09 + Fill Type + Fill Type + Fill Type + Fill Type + Fill Type + E + D + + + + + diff --git a/src/zexcel_font.dtel.xml b/src/zexcel_font.dtel.xml new file mode 100644 index 0000000..06edcd8 --- /dev/null +++ b/src/zexcel_font.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_FONT + E + CHAR10 + 04 + 04 + 04 + 04 + Font + Font + Font + Font + Font + E + D + + + + + diff --git a/src/zexcel_format.doma.xml b/src/zexcel_format.doma.xml new file mode 100644 index 0000000..6a66bbd --- /dev/null +++ b/src/zexcel_format.doma.xml @@ -0,0 +1,32 @@ + + + + + + ZEXCEL_FORMAT + E + CHAR + 000004 + 000004 + X + File format + + + + ZEXCEL_FORMAT + 0001 + E + XLSX + Excel 2007 workbook (.xlsx) + + + ZEXCEL_FORMAT + 0002 + E + XLS + Excel 2003 workbook (.xls) + + + + + diff --git a/src/zexcel_format.dtel.xml b/src/zexcel_format.dtel.xml new file mode 100644 index 0000000..ef2de2a --- /dev/null +++ b/src/zexcel_format.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_FORMAT + E + ZEXCEL_FORMAT + 11 + 10 + 15 + 20 + File format + File format + File type + File format + File format + E + D + + + + + diff --git a/src/zexcel_graph_type.dtel.xml b/src/zexcel_graph_type.dtel.xml new file mode 100644 index 0000000..720cb92 --- /dev/null +++ b/src/zexcel_graph_type.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_GRAPH_TYPE + E + INT1 + 10 + 10 + 15 + 20 + Graph type + Graph type + Graph type + Graph type + Graph type + E + D + + + + + diff --git a/src/zexcel_hidden.dtel.xml b/src/zexcel_hidden.dtel.xml new file mode 100644 index 0000000..66d997c --- /dev/null +++ b/src/zexcel_hidden.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_HIDDEN + E + XFELD + 11 + 10 + 15 + 20 + Cell hidden + Cell hidden + Cell hide + Cell hidden + Cell hidden + E + D + + + + + diff --git a/src/zexcel_indent.dtel.xml b/src/zexcel_indent.dtel.xml new file mode 100644 index 0000000..1ec18fb --- /dev/null +++ b/src/zexcel_indent.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_INDENT + E + INT1 + 13 + 10 + 15 + 20 + Indent + Indent + Indent + Indent + Indent + E + D + + + + + diff --git a/src/zexcel_keywords.dtel.xml b/src/zexcel_keywords.dtel.xml new file mode 100644 index 0000000..a85dd5f --- /dev/null +++ b/src/zexcel_keywords.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_KEYWORDS + E + TEXT80 + 55 + 10 + 15 + 20 + Keywords + Keywords + Keywords + Keywords + Keywords + E + D + + + + + diff --git a/src/zexcel_locked.dtel.xml b/src/zexcel_locked.dtel.xml new file mode 100644 index 0000000..205df13 --- /dev/null +++ b/src/zexcel_locked.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_LOCKED + E + XFELD + 11 + 09 + 11 + 11 + Cell locked + Cell locked + Cell lock + Cell locked + Cell locked + E + D + + + + + diff --git a/src/zexcel_number_format.dtel.xml b/src/zexcel_number_format.dtel.xml new file mode 100644 index 0000000..6c27c30 --- /dev/null +++ b/src/zexcel_number_format.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_NUMBER_FORMAT + E + STRING + 20 + 10 + 15 + 20 + Number format + Number format + Format + Number format + Number format + E + D + + + + + diff --git a/src/zexcel_pane_state.dtel.xml b/src/zexcel_pane_state.dtel.xml new file mode 100644 index 0000000..cf4a594 --- /dev/null +++ b/src/zexcel_pane_state.dtel.xml @@ -0,0 +1,25 @@ + + + + + + ZEXCEL_PANE_STATE + E + STRING + Pane State + R + D + + + + R + + + + R + Pane state + + + + + diff --git a/src/zexcel_pane_type.dtel.xml b/src/zexcel_pane_type.dtel.xml new file mode 100644 index 0000000..6c0d11b --- /dev/null +++ b/src/zexcel_pane_type.dtel.xml @@ -0,0 +1,25 @@ + + + + + + ZEXCEL_PANE_TYPE + E + STRING + ZEXCEL_PANE_TYPE + R + D + + + + R + + + + R + Pane type + + + + + diff --git a/src/zexcel_print_gridlines.dtel.xml b/src/zexcel_print_gridlines.dtel.xml new file mode 100644 index 0000000..598bb55 --- /dev/null +++ b/src/zexcel_print_gridlines.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_PRINT_GRIDLINES + E + FLAG + 55 + 10 + 15 + 20 + Print Gridlines + Print Gridlines + Print Grid + Print Gridlines + Print Gridlines + E + D + + + + + diff --git a/src/zexcel_protection.dtel.xml b/src/zexcel_protection.dtel.xml new file mode 100644 index 0000000..9c25456 --- /dev/null +++ b/src/zexcel_protection.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_PROTECTION + E + CHAR20 + 20 + 10 + 15 + 20 + Protection + Protection + Protection + Protection + Protection + E + D + + + + + diff --git a/src/zexcel_pwd_hash.doma.xml b/src/zexcel_pwd_hash.doma.xml new file mode 100644 index 0000000..9ef0bd9 --- /dev/null +++ b/src/zexcel_pwd_hash.doma.xml @@ -0,0 +1,16 @@ + + + + + + ZEXCEL_PWD_HASH + E + RAW + 000002 + 000004 + Password hash + + + + + diff --git a/src/zexcel_pwd_hash.dtel.xml b/src/zexcel_pwd_hash.dtel.xml new file mode 100644 index 0000000..448f9b6 --- /dev/null +++ b/src/zexcel_pwd_hash.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_PWD_HASH + E + ZEXCEL_PWD_HASH + 13 + 10 + 15 + 20 + Password hash + Password hash + Password + Password hash + Password hash + E + D + + + + + diff --git a/src/zexcel_range_guid.dtel.xml b/src/zexcel_range_guid.dtel.xml new file mode 100644 index 0000000..58215bf --- /dev/null +++ b/src/zexcel_range_guid.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_RANGE_GUID + E + UUID + 32 + 10 + 15 + 20 + Range guid + Range guid + Range guid + Range guid + Range guid + E + D + + + + + diff --git a/src/zexcel_range_name.dtel.xml b/src/zexcel_range_name.dtel.xml new file mode 100644 index 0000000..e11d876 --- /dev/null +++ b/src/zexcel_range_name.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_RANGE_NAME + E + STRING + 20 + 10 + 15 + 20 + Range Name + Range Name + Range Name + Range Name + Range Name + E + D + + + + + diff --git a/src/zexcel_range_value.dtel.xml b/src/zexcel_range_value.dtel.xml new file mode 100644 index 0000000..41b452f --- /dev/null +++ b/src/zexcel_range_value.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_RANGE_VALUE + E + STRING + 10 + 10 + 15 + 20 + Cell Value + Cell Value + Value + Cell Value + Cell Value + E + D + + + + + diff --git a/src/zexcel_revisionspassword.dtel.xml b/src/zexcel_revisionspassword.dtel.xml new file mode 100644 index 0000000..1cef02f --- /dev/null +++ b/src/zexcel_revisionspassword.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_REVISIONSPASSWORD + E + TEXT80 + 55 + 10 + 20 + 20 + Revisions password + Revisions password + Password + Revisions password + Revisions password + E + D + + + + + diff --git a/src/zexcel_rotation.dtel.xml b/src/zexcel_rotation.dtel.xml new file mode 100644 index 0000000..187abcc --- /dev/null +++ b/src/zexcel_rotation.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_ROTATION + E + INT4 + 19 + 10 + 15 + 20 + Rotation + Rotation + Rotation + Rotation + Rotation + E + D + + + + + diff --git a/src/zexcel_scalecrop.dtel.xml b/src/zexcel_scalecrop.dtel.xml new file mode 100644 index 0000000..902971f --- /dev/null +++ b/src/zexcel_scalecrop.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SCALECROP + E + FLAG + 55 + 10 + 15 + 20 + ScaleCrop + ScaleCrop + ScaleCrop + ScaleCrop + ScaleCrop + E + D + + + + + diff --git a/src/zexcel_sheet_bool.doma.xml b/src/zexcel_sheet_bool.doma.xml new file mode 100644 index 0000000..3812845 --- /dev/null +++ b/src/zexcel_sheet_bool.doma.xml @@ -0,0 +1,32 @@ + + + + + + ZEXCEL_SHEET_BOOL + E + CHAR + 000001 + 000001 + X + XML Schema bool data type + + + + ZEXCEL_SHEET_BOOL + 0001 + E + 1 + True + + + ZEXCEL_SHEET_BOOL + 0002 + E + 0 + False + + + + + diff --git a/src/zexcel_sheet_hidden.dtel.xml b/src/zexcel_sheet_hidden.dtel.xml new file mode 100644 index 0000000..8bf5604 --- /dev/null +++ b/src/zexcel_sheet_hidden.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_HIDDEN + E + FLAG + 15 + 10 + 15 + 20 + Hidden property + Hidden property + Hidden + Hidden property + Hidden property + E + D + + + + + diff --git a/src/zexcel_sheet_orienatation.dtel.xml b/src/zexcel_sheet_orienatation.dtel.xml new file mode 100644 index 0000000..ab03a05 --- /dev/null +++ b/src/zexcel_sheet_orienatation.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_ORIENATATION + E + CHAR20 + 20 + 10 + 17 + 20 + Sheet orientation + Sheet orientation + Orientat. + Sheet orientation + Sheet orientation + E + D + + + + + diff --git a/src/zexcel_sheet_paper_size.dtel.xml b/src/zexcel_sheet_paper_size.dtel.xml new file mode 100644 index 0000000..7a804d0 --- /dev/null +++ b/src/zexcel_sheet_paper_size.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_PAPER_SIZE + E + INT1 + 09 + 09 + 09 + 09 + Fill Type + Fill Type + Fill Type + Fill Type + Fill Type + E + D + + + + + diff --git a/src/zexcel_sheet_protection.dtel.xml b/src/zexcel_sheet_protection.dtel.xml new file mode 100644 index 0000000..10c5d0a --- /dev/null +++ b/src/zexcel_sheet_protection.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_PROTECTION + E + XFELD + 16 + 10 + 16 + 20 + Sheet protection indicator + Sheet protection + Protection + Sheet protection + Sheet protection + E + D + + + + + diff --git a/src/zexcel_sheet_protection_bool.dtel.xml b/src/zexcel_sheet_protection_bool.dtel.xml new file mode 100644 index 0000000..dd879f6 --- /dev/null +++ b/src/zexcel_sheet_protection_bool.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_PROTECTION_BOOL + E + ZEXCEL_BOOLE01 + 16 + 10 + 16 + 20 + Sheet protection indicator + Sheet protection + Protection + Sheet protection + Sheet protection + E + D + + + + + diff --git a/src/zexcel_sheet_selected.dtel.xml b/src/zexcel_sheet_selected.dtel.xml new file mode 100644 index 0000000..7b2c048 --- /dev/null +++ b/src/zexcel_sheet_selected.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_SELECTED + E + FLAG + 18 + 10 + 18 + 22 + Selected property + Selected property + Selected + Selected property + Selected property + E + D + + + + + diff --git a/src/zexcel_sheet_showzeros.dtel.xml b/src/zexcel_sheet_showzeros.dtel.xml new file mode 100644 index 0000000..773b901 --- /dev/null +++ b/src/zexcel_sheet_showzeros.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_SHOWZEROS + E + XFELD + 15 + 10 + 15 + 20 + Show zeros + Show zeros + Show zeros + Show zeros + Show zeros + E + D + + + + + diff --git a/src/zexcel_sheet_state.dtel.xml b/src/zexcel_sheet_state.dtel.xml new file mode 100644 index 0000000..22c8f9b --- /dev/null +++ b/src/zexcel_sheet_state.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_STATE + E + CHAR20 + 20 + 10 + 15 + 20 + Sheet state + Sheet state + State + Sheet state + Sheet state + E + D + + + + + diff --git a/src/zexcel_sheet_summary.dtel.xml b/src/zexcel_sheet_summary.dtel.xml new file mode 100644 index 0000000..ece4360 --- /dev/null +++ b/src/zexcel_sheet_summary.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_SUMMARY + E + INT4 + 27 + 10 + 19 + 26 + Outline summary below/right + Outline summary below/right + SumBlwRgt + Summary below/right + Outline summary below/rght + E + D + + + + + diff --git a/src/zexcel_sheet_title.dtel.xml b/src/zexcel_sheet_title.dtel.xml new file mode 100644 index 0000000..559ec07 --- /dev/null +++ b/src/zexcel_sheet_title.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_TITLE + E + TEXT31 + 55 + 10 + 15 + 20 + Title + Title + Title + Title + Title + E + D + + + + + diff --git a/src/zexcel_sheet_zoomscale.dtel.xml b/src/zexcel_sheet_zoomscale.dtel.xml new file mode 100644 index 0000000..5e10851 --- /dev/null +++ b/src/zexcel_sheet_zoomscale.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHEET_ZOOMSCALE + E + INT2 + 16 + 10 + 16 + 16 + Sheet Zoom Scale + Sheet Zoom Scale + Zoom Scale + Sheet Zoom Scale + Sheet Zoom Scale + E + D + + + + + diff --git a/src/zexcel_show_gridlines.dtel.xml b/src/zexcel_show_gridlines.dtel.xml new file mode 100644 index 0000000..9233c2b --- /dev/null +++ b/src/zexcel_show_gridlines.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHOW_GRIDLINES + E + FLAG + 55 + 10 + 15 + 20 + Show Gridlines + Show Gridlines + Show Grid + Show Gridlines + Show Gridlines + E + D + + + + + diff --git a/src/zexcel_show_rowcolheader.dtel.xml b/src/zexcel_show_rowcolheader.dtel.xml new file mode 100644 index 0000000..eda80e5 --- /dev/null +++ b/src/zexcel_show_rowcolheader.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SHOW_ROWCOLHEADER + E + FLAG + 22 + 10 + 20 + 22 + Show Row Column Header + Show Row Column Header + ColHeder + Show Row Column Head + Show Row Column Header + E + D + + + + + diff --git a/src/zexcel_style_color_argb.dtel.xml b/src/zexcel_style_color_argb.dtel.xml new file mode 100644 index 0000000..501b3e7 --- /dev/null +++ b/src/zexcel_style_color_argb.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_COLOR_ARGB + E + CHAR8 + 10 + 10 + 15 + 20 + Color ARGB + Color ARGB + Color ARGB + Color ARGB + Color ARGB + E + D + + + + + diff --git a/src/zexcel_style_color_component.dtel.xml b/src/zexcel_style_color_component.dtel.xml new file mode 100644 index 0000000..0ff913d --- /dev/null +++ b/src/zexcel_style_color_component.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_COLOR_COMPONENT + E + CHAR2 + 15 + 10 + 15 + 15 + Color Component + Color Component + Color Comp + Color Component + Color Component + E + D + + + + + diff --git a/src/zexcel_style_color_indexed.dtel.xml b/src/zexcel_style_color_indexed.dtel.xml new file mode 100644 index 0000000..febcafe --- /dev/null +++ b/src/zexcel_style_color_indexed.dtel.xml @@ -0,0 +1,25 @@ + + + + + + ZEXCEL_STYLE_COLOR_INDEXED + E + 19 + 10 + 15 + 20 + Indexed color value + Indexed color value + Color + Indexed color + Indexed color value + E + INT4 + 000010 + 000011 + + + + + diff --git a/src/zexcel_style_color_theme.dtel.xml b/src/zexcel_style_color_theme.dtel.xml new file mode 100644 index 0000000..8a5a135 --- /dev/null +++ b/src/zexcel_style_color_theme.dtel.xml @@ -0,0 +1,25 @@ + + + + + + ZEXCEL_STYLE_COLOR_THEME + E + 11 + 10 + 15 + 20 + Theme Color + Theme Color + Color + Theme Color + Theme Color + E + INT4 + 000010 + 000011 + + + + + diff --git a/src/zexcel_style_color_tint.dtel.xml b/src/zexcel_style_color_tint.dtel.xml new file mode 100644 index 0000000..b7e65bf --- /dev/null +++ b/src/zexcel_style_color_tint.dtel.xml @@ -0,0 +1,26 @@ + + + + + + ZEXCEL_STYLE_COLOR_TINT + E + 22 + 10 + 15 + 20 + Tint + Tint + Tint + Tint + Tint + E + FLTP + 000016 + 000016 + 000022 + + + + + diff --git a/src/zexcel_style_font_family.dtel.xml b/src/zexcel_style_font_family.dtel.xml new file mode 100644 index 0000000..f350b70 --- /dev/null +++ b/src/zexcel_style_font_family.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FONT_FAMILY + E + INT1 + 20 + 10 + 15 + 20 + Font family + Font family + Family + Font family + Font family + E + D + + + + + diff --git a/src/zexcel_style_font_name.dtel.xml b/src/zexcel_style_font_name.dtel.xml new file mode 100644 index 0000000..0a94aaf --- /dev/null +++ b/src/zexcel_style_font_name.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FONT_NAME + E + CHAR255 + 20 + 10 + 15 + 20 + Font name + Font name + Name + Font name + Font name + E + D + + + + + diff --git a/src/zexcel_style_font_scheme.dtel.xml b/src/zexcel_style_font_scheme.dtel.xml new file mode 100644 index 0000000..2ed8491 --- /dev/null +++ b/src/zexcel_style_font_scheme.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FONT_SCHEME + E + CHAR20 + 20 + 10 + 15 + 20 + Font scheme + Font scheme + Scheme + Font scheme + Font scheme + E + D + + + + + diff --git a/src/zexcel_style_font_size.dtel.xml b/src/zexcel_style_font_size.dtel.xml new file mode 100644 index 0000000..4244a80 --- /dev/null +++ b/src/zexcel_style_font_size.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FONT_SIZE + E + INT1 + 20 + 10 + 15 + 20 + Font size + Font size + Size + Font size + Font size + E + D + + + + + diff --git a/src/zexcel_style_font_underline.dtel.xml b/src/zexcel_style_font_underline.dtel.xml new file mode 100644 index 0000000..62ec6c2 --- /dev/null +++ b/src/zexcel_style_font_underline.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FONT_UNDERLINE + E + CHAR20 + 20 + 10 + 15 + 20 + Font underline + Font underline + Underline + Font underline + Font underline + E + D + + + + + diff --git a/src/zexcel_style_formula.dtel.xml b/src/zexcel_style_formula.dtel.xml new file mode 100644 index 0000000..c9d025b --- /dev/null +++ b/src/zexcel_style_formula.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_FORMULA + E + STRING + 13 + 10 + 15 + 20 + Style formula + Style formula + Formula + Style formula + Style formula + E + D + + + + + diff --git a/src/zexcel_style_priority.dtel.xml b/src/zexcel_style_priority.dtel.xml new file mode 100644 index 0000000..759413b --- /dev/null +++ b/src/zexcel_style_priority.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_STYLE_PRIORITY + E + INT1 + 14 + 10 + 15 + 20 + Style Priority + Style Priority + Priority + Style Priority + Style Priority + E + D + + + + + diff --git a/src/zexcel_subject.dtel.xml b/src/zexcel_subject.dtel.xml new file mode 100644 index 0000000..340f895 --- /dev/null +++ b/src/zexcel_subject.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_SUBJECT + E + TEXT80 + 55 + 10 + 15 + 20 + Subject + Subject + Subject + Subject + Subject + E + D + + + + + diff --git a/src/zexcel_t_autofilter_values.ttyp.xml b/src/zexcel_t_autofilter_values.ttyp.xml new file mode 100644 index 0000000..661fb0a --- /dev/null +++ b/src/zexcel_t_autofilter_values.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_AUTOFILTER_VALUES + E + ZEXCEL_S_AUTOFILTER_VALUES + S + STRU + T + D + N + Table with autofilter values + + + + + + diff --git a/src/zexcel_t_cell_data.ttyp.xml b/src/zexcel_t_cell_data.ttyp.xml new file mode 100644 index 0000000..563e4db --- /dev/null +++ b/src/zexcel_t_cell_data.ttyp.xml @@ -0,0 +1,34 @@ + + + + + + ZEXCEL_T_CELL_DATA + E + ZEXCEL_S_CELL_DATA + S + STRU + S + K + U + 0002 + Excel worksheet content + + + + ZEXCEL_T_CELL_DATA + 0001 + 0001 + CELL_ROW + + + ZEXCEL_T_CELL_DATA + 0002 + 0002 + CELL_COLUMN + + + + + + diff --git a/src/zexcel_t_cell_data_unsorted.ttyp.xml b/src/zexcel_t_cell_data_unsorted.ttyp.xml new file mode 100644 index 0000000..f9d4435 --- /dev/null +++ b/src/zexcel_t_cell_data_unsorted.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_CELL_DATA_UNSORTED + E + ZEXCEL_S_CELL_DATA + S + STRU + T + D + N + Excel worksheet content + + + + + + diff --git a/src/zexcel_t_cellxfs.ttyp.xml b/src/zexcel_t_cellxfs.ttyp.xml new file mode 100644 index 0000000..33a427c --- /dev/null +++ b/src/zexcel_t_cellxfs.ttyp.xml @@ -0,0 +1,100 @@ + + + + + + ZEXCEL_T_CELLXFS + E + ZEXCEL_S_CELLXFS + S + STRU + T + K + N + 0013 + Cell styles + + + + ZEXCEL_T_CELLXFS + 0001 + 0001 + NUMFMTID + + + ZEXCEL_T_CELLXFS + 0002 + 0002 + FONTID + + + ZEXCEL_T_CELLXFS + 0003 + 0003 + FILLID + + + ZEXCEL_T_CELLXFS + 0004 + 0004 + BORDERID + + + ZEXCEL_T_CELLXFS + 0005 + 0005 + XFID + + + ZEXCEL_T_CELLXFS + 0006 + 0006 + ALIGNMENTID + + + ZEXCEL_T_CELLXFS + 0007 + 0007 + PROTECTIONID + + + ZEXCEL_T_CELLXFS + 0008 + 0008 + APPLYNUMBERFORMAT + + + ZEXCEL_T_CELLXFS + 0009 + 0009 + APPLYFONT + + + ZEXCEL_T_CELLXFS + 0010 + 0010 + APPLYFILL + + + ZEXCEL_T_CELLXFS + 0011 + 0011 + APPLYBORDER + + + ZEXCEL_T_CELLXFS + 0012 + 0012 + APPLYALIGNMENT + + + ZEXCEL_T_CELLXFS + 0013 + 0013 + APPLYPROTECTION + + + + + + diff --git a/src/zexcel_t_conv_fieldcatalog.ttyp.xml b/src/zexcel_t_conv_fieldcatalog.ttyp.xml new file mode 100644 index 0000000..f4b4999 --- /dev/null +++ b/src/zexcel_t_conv_fieldcatalog.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_CONV_FIELDCATALOG + E + ZEXCEL_S_CONV_FIELDCATALOG + S + STRU + T + D + N + Converter configurations for fields + + + + + + diff --git a/src/zexcel_t_converter_col.ttyp.xml b/src/zexcel_t_converter_col.ttyp.xml new file mode 100644 index 0000000..378f401 --- /dev/null +++ b/src/zexcel_t_converter_col.ttyp.xml @@ -0,0 +1,34 @@ + + + + + + ZEXCEL_T_CONVERTER_COL + E + ZEXCEL_S_CONVERTER_COL + S + STRU + H + K + U + 0002 + Table type for color information of cells for converter + + + + ZEXCEL_T_CONVERTER_COL + 0001 + 0001 + ROWNUMBER + + + ZEXCEL_T_CONVERTER_COL + 0002 + 0002 + COLUMNNAME + + + + + + diff --git a/src/zexcel_t_converter_fcat.ttyp.xml b/src/zexcel_t_converter_fcat.ttyp.xml new file mode 100644 index 0000000..868e4d6 --- /dev/null +++ b/src/zexcel_t_converter_fcat.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_CONVERTER_FCAT + E + ZEXCEL_S_CONVERTER_FCAT + S + STRU + T + D + N + Conter table for tabel fields + + + + + + diff --git a/src/zexcel_t_converter_fil.ttyp.xml b/src/zexcel_t_converter_fil.ttyp.xml new file mode 100644 index 0000000..45a31fa --- /dev/null +++ b/src/zexcel_t_converter_fil.ttyp.xml @@ -0,0 +1,34 @@ + + + + + + ZEXCEL_T_CONVERTER_FIL + E + ZEXCEL_S_CONVERTER_FIL + S + STRU + H + K + U + 0002 + Table type for filter information of cells for converter + + + + ZEXCEL_T_CONVERTER_FIL + 0001 + 0001 + ROWNUMBER + + + ZEXCEL_T_CONVERTER_FIL + 0002 + 0002 + COLUMNNAME + + + + + + diff --git a/src/zexcel_t_converter_layo.ttyp.xml b/src/zexcel_t_converter_layo.ttyp.xml new file mode 100644 index 0000000..290b8ac --- /dev/null +++ b/src/zexcel_t_converter_layo.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_CONVERTER_LAYO + E + ZEXCEL_S_CONVERTER_LAYO + S + STRU + T + D + N + Table type for zexcel_s_converter_layo + + + + + + diff --git a/src/zexcel_t_fieldcatalog.ttyp.xml b/src/zexcel_t_fieldcatalog.ttyp.xml new file mode 100644 index 0000000..2068c8c --- /dev/null +++ b/src/zexcel_t_fieldcatalog.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_FIELDCATALOG + E + ZEXCEL_S_FIELDCATALOG + S + STRU + T + D + N + Table binding field catalog + + + + + + diff --git a/src/zexcel_t_shared_string.ttyp.xml b/src/zexcel_t_shared_string.ttyp.xml new file mode 100644 index 0000000..f74e679 --- /dev/null +++ b/src/zexcel_t_shared_string.ttyp.xml @@ -0,0 +1,28 @@ + + + + + + ZEXCEL_T_SHARED_STRING + E + ZEXCEL_S_SHARED_STRING + S + STRU + S + K + N + 0001 + Shared Strings + + + + ZEXCEL_T_SHARED_STRING + 0001 + 0002 + STRING_VALUE + + + + + + diff --git a/src/zexcel_t_sheet_style.ttyp.xml b/src/zexcel_t_sheet_style.ttyp.xml new file mode 100644 index 0000000..6697e54 --- /dev/null +++ b/src/zexcel_t_sheet_style.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_SHEET_STYLE + E + ZEXCEL_S_SHEET_STYLE + S + STRU + T + D + N + Sheet style table type + + + + + + diff --git a/src/zexcel_t_style_alignment.ttyp.xml b/src/zexcel_t_style_alignment.ttyp.xml new file mode 100644 index 0000000..0fa219c --- /dev/null +++ b/src/zexcel_t_style_alignment.ttyp.xml @@ -0,0 +1,58 @@ + + + + + + ZEXCEL_T_STYLE_ALIGNMENT + E + ZEXCEL_S_STYLE_ALIGNMENT + S + STRU + T + K + N + 0006 + Table type for + + + + ZEXCEL_T_STYLE_ALIGNMENT + 0001 + 0001 + HORIZONTAL + + + ZEXCEL_T_STYLE_ALIGNMENT + 0002 + 0002 + VERTICAL + + + ZEXCEL_T_STYLE_ALIGNMENT + 0003 + 0003 + TEXTROTATION + + + ZEXCEL_T_STYLE_ALIGNMENT + 0004 + 0004 + WRAPTEXT + + + ZEXCEL_T_STYLE_ALIGNMENT + 0005 + 0005 + SHRINKTOFIT + + + ZEXCEL_T_STYLE_ALIGNMENT + 0006 + 0006 + INDENT + + + + + + diff --git a/src/zexcel_t_style_border.ttyp.xml b/src/zexcel_t_style_border.ttyp.xml new file mode 100644 index 0000000..713f8a7 --- /dev/null +++ b/src/zexcel_t_style_border.ttyp.xml @@ -0,0 +1,94 @@ + + + + + + ZEXCEL_T_STYLE_BORDER + E + ZEXCEL_S_STYLE_BORDER + S + STRU + T + K + N + 0012 + Border Style + + + + ZEXCEL_T_STYLE_BORDER + 0001 + 0001 + LEFT_COLOR + + + ZEXCEL_T_STYLE_BORDER + 0002 + 0006 + LEFT_STYLE + + + ZEXCEL_T_STYLE_BORDER + 0003 + 0007 + RIGHT_COLOR + + + ZEXCEL_T_STYLE_BORDER + 0004 + 0012 + RIGHT_STYLE + + + ZEXCEL_T_STYLE_BORDER + 0005 + 0013 + TOP_COLOR + + + ZEXCEL_T_STYLE_BORDER + 0006 + 0018 + TOP_STYLE + + + ZEXCEL_T_STYLE_BORDER + 0007 + 0019 + BOTTOM_COLOR + + + ZEXCEL_T_STYLE_BORDER + 0008 + 0024 + BOTTOM_STYLE + + + ZEXCEL_T_STYLE_BORDER + 0009 + 0025 + DIAGONAL_COLOR + + + ZEXCEL_T_STYLE_BORDER + 0010 + 0030 + DIAGONAL_STYLE + + + ZEXCEL_T_STYLE_BORDER + 0011 + 0031 + DIAGONALUP + + + ZEXCEL_T_STYLE_BORDER + 0012 + 0032 + DIAGONALDOWN + + + + + + diff --git a/src/zexcel_t_style_color_argb.ttyp.xml b/src/zexcel_t_style_color_argb.ttyp.xml new file mode 100644 index 0000000..4c1ed2c --- /dev/null +++ b/src/zexcel_t_style_color_argb.ttyp.xml @@ -0,0 +1,21 @@ + + + + + + ZEXCEL_T_STYLE_COLOR_ARGB + E + ZEXCEL_STYLE_COLOR_ARGB + E + CHAR + 000008 + T + D + N + Table of RGB colors + + + + + + diff --git a/src/zexcel_t_style_fill.ttyp.xml b/src/zexcel_t_style_fill.ttyp.xml new file mode 100644 index 0000000..9f7761d --- /dev/null +++ b/src/zexcel_t_style_fill.ttyp.xml @@ -0,0 +1,52 @@ + + + + + + ZEXCEL_T_STYLE_FILL + E + ZEXCEL_S_STYLE_FILL + S + STRU + T + K + N + 0005 + Cell Fills + + + + ZEXCEL_T_STYLE_FILL + 0001 + 0001 + FILLTYPE + + + ZEXCEL_T_STYLE_FILL + 0002 + 0002 + ROTATION + + + ZEXCEL_T_STYLE_FILL + 0003 + 0003 + FGCOLOR + + + ZEXCEL_T_STYLE_FILL + 0004 + 0008 + BGCOLOR + + + ZEXCEL_T_STYLE_FILL + 0005 + 0013 + GRADTYPE + + + + + + diff --git a/src/zexcel_t_style_font.ttyp.xml b/src/zexcel_t_style_font.ttyp.xml new file mode 100644 index 0000000..744bfb7 --- /dev/null +++ b/src/zexcel_t_style_font.ttyp.xml @@ -0,0 +1,82 @@ + + + + + + ZEXCEL_T_STYLE_FONT + E + ZEXCEL_S_STYLE_FONT + S + STRU + T + K + N + 0010 + Table type for styles ZEXCEL_S_STYLE_FONT + + + + ZEXCEL_T_STYLE_FONT + 0001 + 0001 + BOLD + + + ZEXCEL_T_STYLE_FONT + 0002 + 0002 + ITALIC + + + ZEXCEL_T_STYLE_FONT + 0003 + 0003 + UNDERLINE + + + ZEXCEL_T_STYLE_FONT + 0004 + 0004 + UNDERLINE_MODE + + + ZEXCEL_T_STYLE_FONT + 0005 + 0005 + STRIKETHROUGH + + + ZEXCEL_T_STYLE_FONT + 0006 + 0006 + SIZE + + + ZEXCEL_T_STYLE_FONT + 0007 + 0007 + COLOR + + + ZEXCEL_T_STYLE_FONT + 0008 + 0012 + NAME + + + ZEXCEL_T_STYLE_FONT + 0009 + 0013 + FAMILY + + + ZEXCEL_T_STYLE_FONT + 0010 + 0014 + SCHEME + + + + + + diff --git a/src/zexcel_t_style_numfmt.ttyp.xml b/src/zexcel_t_style_numfmt.ttyp.xml new file mode 100644 index 0000000..677d67b --- /dev/null +++ b/src/zexcel_t_style_numfmt.ttyp.xml @@ -0,0 +1,28 @@ + + + + + + ZEXCEL_T_STYLE_NUMFMT + E + ZEXCEL_S_STYLE_NUMFMT + S + STRU + T + K + N + 0001 + Table type for styles ZEXCEL_S_STYLE_NUMFMT + + + + ZEXCEL_T_STYLE_NUMFMT + 0001 + 0001 + NUMFMT + + + + + + diff --git a/src/zexcel_t_style_protection.ttyp.xml b/src/zexcel_t_style_protection.ttyp.xml new file mode 100644 index 0000000..6fd45d8 --- /dev/null +++ b/src/zexcel_t_style_protection.ttyp.xml @@ -0,0 +1,34 @@ + + + + + + ZEXCEL_T_STYLE_PROTECTION + E + ZEXCEL_S_STYLE_PROTECTION + S + STRU + T + K + N + 0002 + Table type for styles ZEXCEL_S_STYLE_PROTECTION + + + + ZEXCEL_T_STYLE_PROTECTION + 0001 + 0001 + LOCKED + + + ZEXCEL_T_STYLE_PROTECTION + 0002 + 0002 + HIDDEN + + + + + + diff --git a/src/zexcel_t_stylemapping1.ttyp.xml b/src/zexcel_t_stylemapping1.ttyp.xml new file mode 100644 index 0000000..a67a6c8 --- /dev/null +++ b/src/zexcel_t_stylemapping1.ttyp.xml @@ -0,0 +1,40 @@ + + + + + + ZEXCEL_T_STYLEMAPPING1 + E + ZEXCEL_S_STYLEMAPPING + S + STRU + H + K + U + 0003 + Stylemapping: Values -> GUID + + + + ZEXCEL_T_STYLEMAPPING1 + 0001 + 0001 + DYNAMIC_STYLE_GUID + + + ZEXCEL_T_STYLEMAPPING1 + 0002 + 0097 + COMPLETE_STYLEX + + + ZEXCEL_T_STYLEMAPPING1 + 0003 + 0002 + COMPLETE_STYLE + + + + + + diff --git a/src/zexcel_t_stylemapping2.ttyp.xml b/src/zexcel_t_stylemapping2.ttyp.xml new file mode 100644 index 0000000..52caffa --- /dev/null +++ b/src/zexcel_t_stylemapping2.ttyp.xml @@ -0,0 +1,28 @@ + + + + + + ZEXCEL_T_STYLEMAPPING2 + E + ZEXCEL_S_STYLEMAPPING + S + STRU + H + K + U + 0001 + Stylemapping: GUID -> Values + + + + ZEXCEL_T_STYLEMAPPING2 + 0001 + 0192 + GUID + + + + + + diff --git a/src/zexcel_t_styles_cond_mapping.ttyp.xml b/src/zexcel_t_styles_cond_mapping.ttyp.xml new file mode 100644 index 0000000..d42bc01 --- /dev/null +++ b/src/zexcel_t_styles_cond_mapping.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_STYLES_COND_MAPPING + E + ZEXCEL_S_STYLES_COND_MAPPING + S + STRU + T + D + N + Styles mapping + + + + + + diff --git a/src/zexcel_t_styles_mapping.ttyp.xml b/src/zexcel_t_styles_mapping.ttyp.xml new file mode 100644 index 0000000..a9a4ce8 --- /dev/null +++ b/src/zexcel_t_styles_mapping.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_STYLES_MAPPING + E + ZEXCEL_S_STYLES_MAPPING + S + STRU + T + D + N + Styles mapping + + + + + + diff --git a/src/zexcel_t_worksheet_columndime.ttyp.xml b/src/zexcel_t_worksheet_columndime.ttyp.xml new file mode 100644 index 0000000..b15c1ab --- /dev/null +++ b/src/zexcel_t_worksheet_columndime.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_WORKSHEET_COLUMNDIME + E + ZEXCEL_S_WORKSHEET_COLUMNDIME + S + STRU + T + D + N + Collection of column dimensions + + + + + + diff --git a/src/zexcel_t_worksheet_rowdimensio.ttyp.xml b/src/zexcel_t_worksheet_rowdimensio.ttyp.xml new file mode 100644 index 0000000..338fdfc --- /dev/null +++ b/src/zexcel_t_worksheet_rowdimensio.ttyp.xml @@ -0,0 +1,20 @@ + + + + + + ZEXCEL_T_WORKSHEET_ROWDIMENSIO + E + ZEXCEL_S_WORKSHEET_ROWDIMENSIO + S + STRU + T + D + N + Collection of row dimensions + + + + + + diff --git a/src/zexcel_table_style.dtel.xml b/src/zexcel_table_style.dtel.xml new file mode 100644 index 0000000..53f74fc --- /dev/null +++ b/src/zexcel_table_style.dtel.xml @@ -0,0 +1,17 @@ + + + + + + ZEXCEL_TABLE_STYLE + E + 10 + Name of the table style + Table styl + E + STRG + + + + + diff --git a/src/zexcel_table_totals_function.dtel.xml b/src/zexcel_table_totals_function.dtel.xml new file mode 100644 index 0000000..5ef3571 --- /dev/null +++ b/src/zexcel_table_totals_function.dtel.xml @@ -0,0 +1,17 @@ + + + + + + ZEXCEL_TABLE_TOTALS_FUNCTION + E + 10 + Totals function for table column (xml ST_TotalsRowFunction) + Function + E + STRG + + + + + diff --git a/src/zexcel_text_rotation.dtel.xml b/src/zexcel_text_rotation.dtel.xml new file mode 100644 index 0000000..bcc1c65 --- /dev/null +++ b/src/zexcel_text_rotation.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_TEXT_ROTATION + E + INT1 + 13 + 10 + 15 + 20 + Text Rotation + Text Rotation + Rotation + Text Rotation + Text Rotation + E + D + + + + + diff --git a/src/zexcel_title.dtel.xml b/src/zexcel_title.dtel.xml new file mode 100644 index 0000000..0b62e7d --- /dev/null +++ b/src/zexcel_title.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_TITLE + E + TEXT80 + 55 + 10 + 15 + 20 + Title + Title + Title + Title + Title + E + D + + + + + diff --git a/src/zexcel_validation_formula1.dtel.xml b/src/zexcel_validation_formula1.dtel.xml new file mode 100644 index 0000000..5717878 --- /dev/null +++ b/src/zexcel_validation_formula1.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_VALIDATION_FORMULA1 + E + STRING + 20 + 10 + 19 + 20 + Validation formula1 + Validation formula1 + Formula1 + Validation formula1 + Validation formula1 + E + D + + + + + diff --git a/src/zexcel_workbookpassword.dtel.xml b/src/zexcel_workbookpassword.dtel.xml new file mode 100644 index 0000000..5a28ff0 --- /dev/null +++ b/src/zexcel_workbookpassword.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_WORKBOOKPASSWORD + E + TEXT80 + 55 + 10 + 20 + 20 + Workbook password + Workbook password + Password + Workbook password + Workbook password + E + D + + + + + diff --git a/src/zexcel_worksheets_name.dtel.xml b/src/zexcel_worksheets_name.dtel.xml new file mode 100644 index 0000000..e900c6e --- /dev/null +++ b/src/zexcel_worksheets_name.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZEXCEL_WORKSHEETS_NAME + E + TEXT80 + 55 + 10 + 15 + 20 + Worksheets name + Worksheets name + Name + Worksheets name + Worksheets name + E + D + + + + + diff --git a/src/zif_excel_book_properties.intf.abap b/src/zif_excel_book_properties.intf.abap new file mode 100644 index 0000000..6f5412d --- /dev/null +++ b/src/zif_excel_book_properties.intf.abap @@ -0,0 +1,24 @@ +interface ZIF_EXCEL_BOOK_PROPERTIES + public . + + + data CREATOR type ZEXCEL_CREATOR . + data LASTMODIFIEDBY type ZEXCEL_CREATOR . + data CREATED type TIMESTAMPL . + data MODIFIED type TIMESTAMPL . + data TITLE type ZEXCEL_TITLE . + data SUBJECT type ZEXCEL_SUBJECT . + data DESCRIPTION type ZEXCEL_DESCRIPTION . + data KEYWORDS type ZEXCEL_KEYWORDS . + data CATEGORY type ZEXCEL_CATEGORY . + data COMPANY type ZEXCEL_COMPANY . + data APPLICATION type ZEXCEL_APPLICATION . + data DOCSECURITY type ZEXCEL_DOCSECURITY . + data SCALECROP type ZEXCEL_SCALECROP . + data LINKSUPTODATE type FLAG . + data SHAREDDOC type FLAG . + data HYPERLINKSCHANGED type FLAG . + data APPVERSION type ZEXCEL_APPVERSION . + + methods INITIALIZE . +endinterface. diff --git a/src/zif_excel_book_properties.intf.xml b/src/zif_excel_book_properties.intf.xml new file mode 100644 index 0000000..0faf846 --- /dev/null +++ b/src/zif_excel_book_properties.intf.xml @@ -0,0 +1,126 @@ + + + + + + ZIF_EXCEL_BOOK_PROPERTIES + 1 + E + Excel Properties + 2 + 1 + X + + + + ZIF_EXCEL_BOOK_PROPERTIES + APPLICATION + E + Application + + + ZIF_EXCEL_BOOK_PROPERTIES + APPVERSION + E + Application version + + + ZIF_EXCEL_BOOK_PROPERTIES + CATEGORY + E + Category + + + ZIF_EXCEL_BOOK_PROPERTIES + COMPANY + E + Company + + + ZIF_EXCEL_BOOK_PROPERTIES + CREATED + E + Created on + + + ZIF_EXCEL_BOOK_PROPERTIES + CREATOR + E + Creator + + + ZIF_EXCEL_BOOK_PROPERTIES + DESCRIPTION + E + Description + + + ZIF_EXCEL_BOOK_PROPERTIES + DOCSECURITY + E + DocSecurity + + + ZIF_EXCEL_BOOK_PROPERTIES + HYPERLINKSCHANGED + E + Hyperlinks changed + + + ZIF_EXCEL_BOOK_PROPERTIES + INITIALIZE + E + Inizialize book properties + + + ZIF_EXCEL_BOOK_PROPERTIES + KEYWORDS + E + Keywords + + + ZIF_EXCEL_BOOK_PROPERTIES + LASTMODIFIEDBY + E + Modified by + + + ZIF_EXCEL_BOOK_PROPERTIES + LINKSUPTODATE + E + Links up to date + + + ZIF_EXCEL_BOOK_PROPERTIES + MODIFIED + E + Modified on + + + ZIF_EXCEL_BOOK_PROPERTIES + SCALECROP + E + ScaleCrop + + + ZIF_EXCEL_BOOK_PROPERTIES + SHAREDDOC + E + Shared document + + + ZIF_EXCEL_BOOK_PROPERTIES + SUBJECT + E + Subject + + + ZIF_EXCEL_BOOK_PROPERTIES + TITLE + E + Title + + + + + diff --git a/src/zif_excel_book_protection.intf.abap b/src/zif_excel_book_protection.intf.abap new file mode 100644 index 0000000..842faf4 --- /dev/null +++ b/src/zif_excel_book_protection.intf.abap @@ -0,0 +1,17 @@ +interface ZIF_EXCEL_BOOK_PROTECTION + public . + + + constants C_LOCKED type ZEXCEL_BOOK_PROTECTION value '1'. "#EC NOTEXT + constants C_PROTECTED type ZEXCEL_BOOK_PROTECTION value 'X'. "#EC NOTEXT + constants C_UNLOCKED type ZEXCEL_BOOK_PROTECTION value '0'. "#EC NOTEXT + constants C_UNPROTECTED type ZEXCEL_BOOK_PROTECTION value ''. "#EC NOTEXT + data LOCKREVISION type ZEXCEL_BOOK_PROTECTION . + data LOCKSTRUCTURE type ZEXCEL_BOOK_PROTECTION . + data LOCKWINDOWS type ZEXCEL_BOOK_PROTECTION . + data PROTECTED type ZEXCEL_BOOK_PROTECTION . + data REVISIONSPASSWORD type ZEXCEL_AES_PASSWORD . + data WORKBOOKPASSWORD type ZEXCEL_AES_PASSWORD . + + methods INITIALIZE . +endinterface. diff --git a/src/zif_excel_book_protection.intf.xml b/src/zif_excel_book_protection.intf.xml new file mode 100644 index 0000000..c4bcb18 --- /dev/null +++ b/src/zif_excel_book_protection.intf.xml @@ -0,0 +1,84 @@ + + + + + + ZIF_EXCEL_BOOK_PROTECTION + 1 + E + Book protection + 2 + 1 + X + + + + ZIF_EXCEL_BOOK_PROTECTION + C_LOCKED + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + C_PROTECTED + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + C_UNLOCKED + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + C_UNPROTECTED + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + INITIALIZE + E + Initialize protection + + + ZIF_EXCEL_BOOK_PROTECTION + LOCKREVISION + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + LOCKSTRUCTURE + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + LOCKWINDOWS + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + PROTECTED + E + Book protection indicator + + + ZIF_EXCEL_BOOK_PROTECTION + REVISIONSPASSWORD + E + AES Password + + + ZIF_EXCEL_BOOK_PROTECTION + WORKBOOKPASSWORD + E + AES Password + + + + + diff --git a/src/zif_excel_book_vba_project.intf.abap b/src/zif_excel_book_vba_project.intf.abap new file mode 100644 index 0000000..b9df519 --- /dev/null +++ b/src/zif_excel_book_vba_project.intf.abap @@ -0,0 +1,18 @@ +interface ZIF_EXCEL_BOOK_VBA_PROJECT + public . + + + data VBAPROJECT type XSTRING read-only . + data CODENAME type STRING read-only . + data CODENAME_PR type STRING read-only . + + methods SET_VBAPROJECT + importing + !IP_VBAPROJECT type XSTRING . + methods SET_CODENAME + importing + !IP_CODENAME type STRING . + methods SET_CODENAME_PR + importing + !IP_CODENAME_PR type STRING . +endinterface. diff --git a/src/zif_excel_book_vba_project.intf.xml b/src/zif_excel_book_vba_project.intf.xml new file mode 100644 index 0000000..c940534 --- /dev/null +++ b/src/zif_excel_book_vba_project.intf.xml @@ -0,0 +1,16 @@ + + + + + + ZIF_EXCEL_BOOK_VBA_PROJECT + 1 + E + Excel workbook VBA Project + 2 + 1 + X + + + + diff --git a/src/zif_excel_converter.intf.abap b/src/zif_excel_converter.intf.abap new file mode 100644 index 0000000..ddc0d01 --- /dev/null +++ b/src/zif_excel_converter.intf.abap @@ -0,0 +1,23 @@ +interface ZIF_EXCEL_CONVERTER + public . + + + methods CAN_CONVERT_OBJECT + importing + !IO_OBJECT type ref to OBJECT + raising + ZCX_EXCEL . + methods CREATE_FIELDCATALOG + importing + !IS_OPTION type ZEXCEL_S_CONVERTER_OPTION + !IO_OBJECT type ref to OBJECT + !IT_TABLE type STANDARD TABLE + exporting + !ES_LAYOUT type ZEXCEL_S_CONVERTER_LAYO + !ET_FIELDCATALOG type ZEXCEL_T_CONVERTER_FCAT + !EO_TABLE type ref to DATA + !ET_COLORS type ZEXCEL_T_CONVERTER_COL + !ET_FILTER type ZEXCEL_T_CONVERTER_FIL + raising + ZCX_EXCEL . +endinterface. diff --git a/src/zif_excel_converter.intf.xml b/src/zif_excel_converter.intf.xml new file mode 100644 index 0000000..9b2209a --- /dev/null +++ b/src/zif_excel_converter.intf.xml @@ -0,0 +1,30 @@ + + + + + + ZIF_EXCEL_CONVERTER + 1 + E + Converter Interface + 2 + 1 + X + + + + ZIF_EXCEL_CONVERTER + CAN_CONVERT_OBJECT + E + Can the object be handled? + + + ZIF_EXCEL_CONVERTER + CREATE_FIELDCATALOG + E + Create FIELDCATALOG for table + + + + + diff --git a/src/zif_excel_customui_element.intf.abap b/src/zif_excel_customui_element.intf.abap new file mode 100644 index 0000000..0f1038d --- /dev/null +++ b/src/zif_excel_customui_element.intf.abap @@ -0,0 +1,7 @@ +interface ZIF_EXCEL_CUSTOMUI_ELEMENT + public . + + + data ID type STRING . + data LABEL type STRING . +endinterface. diff --git a/src/zif_excel_customui_element.intf.xml b/src/zif_excel_customui_element.intf.xml new file mode 100644 index 0000000..96034e0 --- /dev/null +++ b/src/zif_excel_customui_element.intf.xml @@ -0,0 +1,16 @@ + + + + + + ZIF_EXCEL_CUSTOMUI_ELEMENT + 1 + E + Excel customUI element + 2 + 1 + X + + + + diff --git a/src/zif_excel_reader.intf.abap b/src/zif_excel_reader.intf.abap new file mode 100644 index 0000000..efaa47b --- /dev/null +++ b/src/zif_excel_reader.intf.abap @@ -0,0 +1,24 @@ +interface ZIF_EXCEL_READER + public . + + + methods LOAD_FILE + importing + !I_FILENAME type CSEQUENCE + !I_USE_ALTERNATE_ZIP type SEOCLSNAME default SPACE + !I_FROM_APPLSERVER type SYBATCH default SY-BATCH + !IV_ZCL_EXCEL_CLASSNAME type CLIKE optional + returning + value(R_EXCEL) type ref to ZCL_EXCEL + raising + ZCX_EXCEL . + methods LOAD + importing + !I_EXCEL2007 type XSTRING + !I_USE_ALTERNATE_ZIP type SEOCLSNAME default SPACE + !IV_ZCL_EXCEL_CLASSNAME type CLIKE optional + returning + value(R_EXCEL) type ref to ZCL_EXCEL + raising + ZCX_EXCEL . +endinterface. diff --git a/src/zif_excel_reader.intf.xml b/src/zif_excel_reader.intf.xml new file mode 100644 index 0000000..79dcdce --- /dev/null +++ b/src/zif_excel_reader.intf.xml @@ -0,0 +1,30 @@ + + + + + + ZIF_EXCEL_READER + 1 + E + Reader Interface + 2 + 1 + X + + + + ZIF_EXCEL_READER + LOAD + E + Loads ZCL_EXCEL from provided xstring + + + ZIF_EXCEL_READER + LOAD_FILE + E + Loads ZCL_EXCEL from file + + + + + diff --git a/src/zif_excel_sheet_printsettings.intf.abap b/src/zif_excel_sheet_printsettings.intf.abap new file mode 100644 index 0000000..b0c689e --- /dev/null +++ b/src/zif_excel_sheet_printsettings.intf.abap @@ -0,0 +1,29 @@ +interface ZIF_EXCEL_SHEET_PRINTSETTINGS + public . + + + constants GCV_PRINT_TITLE_NAME type STRING value '_xlnm.Print_Titles'. "#EC NOTEXT + + methods SET_PRINT_REPEAT_COLUMNS + importing + !IV_COLUMNS_FROM type ZEXCEL_CELL_COLUMN_ALPHA + !IV_COLUMNS_TO type ZEXCEL_CELL_COLUMN_ALPHA + raising + ZCX_EXCEL . + methods SET_PRINT_REPEAT_ROWS + importing + !IV_ROWS_FROM type ZEXCEL_CELL_ROW + !IV_ROWS_TO type ZEXCEL_CELL_ROW + raising + ZCX_EXCEL . + methods GET_PRINT_REPEAT_COLUMNS + exporting + !EV_COLUMNS_FROM type ZEXCEL_CELL_COLUMN_ALPHA + !EV_COLUMNS_TO type ZEXCEL_CELL_COLUMN_ALPHA . + methods GET_PRINT_REPEAT_ROWS + exporting + !EV_ROWS_FROM type ZEXCEL_CELL_ROW + !EV_ROWS_TO type ZEXCEL_CELL_ROW . + methods CLEAR_PRINT_REPEAT_COLUMNS . + methods CLEAR_PRINT_REPEAT_ROWS . +endinterface. diff --git a/src/zif_excel_sheet_printsettings.intf.xml b/src/zif_excel_sheet_printsettings.intf.xml new file mode 100644 index 0000000..d86aa7e --- /dev/null +++ b/src/zif_excel_sheet_printsettings.intf.xml @@ -0,0 +1,60 @@ + + + + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + 1 + E + Sheet printsettings + 2 + 1 + X + + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + CLEAR_PRINT_REPEAT_COLUMNS + E + Clear repeat columns + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + CLEAR_PRINT_REPEAT_ROWS + E + Clear repeat rows + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + GCV_PRINT_TITLE_NAME + E + Predefined name for repeat rows/cols range + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + GET_PRINT_REPEAT_COLUMNS + E + Get repeat columns + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + GET_PRINT_REPEAT_ROWS + E + Get repeat rows + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + SET_PRINT_REPEAT_COLUMNS + E + Set repeat columns + + + ZIF_EXCEL_SHEET_PRINTSETTINGS + SET_PRINT_REPEAT_ROWS + E + Set repeat rows + + + + + diff --git a/src/zif_excel_sheet_properties.intf.abap b/src/zif_excel_sheet_properties.intf.abap new file mode 100644 index 0000000..2828749 --- /dev/null +++ b/src/zif_excel_sheet_properties.intf.abap @@ -0,0 +1,34 @@ +interface ZIF_EXCEL_SHEET_PROPERTIES + public . + + + constants C_HIDDEN type ZEXCEL_SHEET_HIDDEN value 'X'. "#EC NOTEXT + constants C_VERYHIDDEN type ZEXCEL_SHEET_HIDDEN value '2'. "#EC NOTEXT + constants C_HIDEZERO type ZEXCEL_SHEET_SHOWZEROS value ''. "#EC NOTEXT + constants C_SHOWZERO type ZEXCEL_SHEET_SHOWZEROS value 'X'. "#EC NOTEXT + constants C_VISIBLE type ZEXCEL_SHEET_HIDDEN value ''. "#EC NOTEXT + data HIDDEN type ZEXCEL_SHEET_HIDDEN . + data SHOW_ZEROS type ZEXCEL_SHEET_SHOWZEROS . + data STYLE type ZEXCEL_CELL_STYLE . + data ZOOMSCALE type ZEXCEL_SHEET_ZOOMSCALE . + data ZOOMSCALE_NORMAL type ZEXCEL_SHEET_ZOOMSCALE . + data ZOOMSCALE_PAGELAYOUTVIEW type ZEXCEL_SHEET_ZOOMSCALE . + data ZOOMSCALE_SHEETLAYOUTVIEW type ZEXCEL_SHEET_ZOOMSCALE . + data SUMMARYBELOW type ZEXCEL_SHEET_SUMMARY . + constants C_BELOW_ON type ZEXCEL_SHEET_SUMMARY value 1. "#EC NOTEXT + constants C_BELOW_OFF type ZEXCEL_SHEET_SUMMARY value 0. "#EC NOTEXT + data SUMMARYRIGHT type ZEXCEL_SHEET_SUMMARY . + constants C_RIGHT_ON type ZEXCEL_SHEET_SUMMARY value 1. "#EC NOTEXT + constants C_RIGHT_OFF type ZEXCEL_SHEET_SUMMARY value 0. "#EC NOTEXT + data SELECTED type ZEXCEL_SHEET_SELECTED . + constants C_SELECTED type ZEXCEL_SHEET_SELECTED value 'X'. "#EC NOTEXT + data HIDE_COLUMNS_FROM type ZEXCEL_CELL_COLUMN_ALPHA . + + methods INITIALIZE . + methods GET_STYLE + returning + value(EP_STYLE) type ZEXCEL_CELL_STYLE . + methods SET_STYLE + importing + !IP_STYLE type ZEXCEL_CELL_STYLE . +endinterface. diff --git a/src/zif_excel_sheet_properties.intf.xml b/src/zif_excel_sheet_properties.intf.xml new file mode 100644 index 0000000..9a27e0b --- /dev/null +++ b/src/zif_excel_sheet_properties.intf.xml @@ -0,0 +1,162 @@ + + + + + + ZIF_EXCEL_SHEET_PROPERTIES + 1 + E + Sheet properties + 2 + 1 + X + + + + ZIF_EXCEL_SHEET_PROPERTIES + C_BELOW_OFF + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + C_BELOW_ON + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + C_HIDDEN + E + Hidden property + + + ZIF_EXCEL_SHEET_PROPERTIES + C_HIDEZERO + E + Show zeros + + + ZIF_EXCEL_SHEET_PROPERTIES + C_RIGHT_OFF + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + C_RIGHT_ON + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + C_SELECTED + E + Selected property + + + ZIF_EXCEL_SHEET_PROPERTIES + C_SHOWZERO + E + Show zeros + + + ZIF_EXCEL_SHEET_PROPERTIES + C_VERYHIDDEN + E + Hidden property + + + ZIF_EXCEL_SHEET_PROPERTIES + C_VISIBLE + E + Hidden property + + + ZIF_EXCEL_SHEET_PROPERTIES + GET_STYLE + E + Set Style Property + + + ZIF_EXCEL_SHEET_PROPERTIES + HIDDEN + E + Hidden property + + + ZIF_EXCEL_SHEET_PROPERTIES + HIDE_COLUMNS_FROM + E + Cell Column + + + ZIF_EXCEL_SHEET_PROPERTIES + INITIALIZE + E + Inizialize sheet properties + + + ZIF_EXCEL_SHEET_PROPERTIES + SELECTED + E + Selected property + + + ZIF_EXCEL_SHEET_PROPERTIES + SET_STYLE + E + Get Style Property + + + ZIF_EXCEL_SHEET_PROPERTIES + SHOW_ZEROS + E + Show zeros + + + ZIF_EXCEL_SHEET_PROPERTIES + STYLE + E + Style identifier + + + ZIF_EXCEL_SHEET_PROPERTIES + SUMMARYBELOW + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + SUMMARYRIGHT + E + Outline summary below/right + + + ZIF_EXCEL_SHEET_PROPERTIES + ZOOMSCALE + E + Sheet Zoom Scale + + + ZIF_EXCEL_SHEET_PROPERTIES + ZOOMSCALE_NORMAL + E + Sheet Zoom Scale + + + ZIF_EXCEL_SHEET_PROPERTIES + ZOOMSCALE_PAGELAYOUTVIEW + E + Sheet Zoom Scale + + + ZIF_EXCEL_SHEET_PROPERTIES + ZOOMSCALE_SHEETLAYOUTVIEW + E + Sheet Zoom Scale + + + + + diff --git a/src/zif_excel_sheet_protection.intf.abap b/src/zif_excel_sheet_protection.intf.abap new file mode 100644 index 0000000..2858ef0 --- /dev/null +++ b/src/zif_excel_sheet_protection.intf.abap @@ -0,0 +1,29 @@ +interface ZIF_EXCEL_SHEET_PROTECTION + public . + + + data AUTO_FILTER type ZEXCEL_SHEET_PROTECTION_BOOL . + constants C_ACTIVE type ZEXCEL_SHEET_PROTECTION_BOOL value '1'. "#EC NOTEXT + constants C_NOACTIVE type ZEXCEL_SHEET_PROTECTION_BOOL value '0'. "#EC NOTEXT + constants C_PROTECTED type ZEXCEL_SHEET_PROTECTION value 'X'. "#EC NOTEXT + constants C_UNPROTECTED type ZEXCEL_SHEET_PROTECTION value ''. "#EC NOTEXT + data DELETE_COLUMNS type ZEXCEL_SHEET_PROTECTION_BOOL . + data DELETE_ROWS type ZEXCEL_SHEET_PROTECTION_BOOL . + data FORMAT_CELLS type ZEXCEL_SHEET_PROTECTION_BOOL . + data FORMAT_COLUMNS type ZEXCEL_SHEET_PROTECTION_BOOL . + data FORMAT_ROWS type ZEXCEL_SHEET_PROTECTION_BOOL . + data INSERT_COLUMNS type ZEXCEL_SHEET_PROTECTION_BOOL . + data INSERT_HYPERLINKS type ZEXCEL_SHEET_PROTECTION_BOOL . + data INSERT_ROWS type ZEXCEL_SHEET_PROTECTION_BOOL . + data OBJECTS type ZEXCEL_SHEET_PROTECTION_BOOL . + data PASSWORD type ZEXCEL_AES_PASSWORD . + data PIVOT_TABLES type ZEXCEL_SHEET_PROTECTION_BOOL . + data PROTECTED type ZEXCEL_SHEET_PROTECTION . + data SCENARIOS type ZEXCEL_SHEET_PROTECTION_BOOL . + data SELECT_LOCKED_CELLS type ZEXCEL_SHEET_PROTECTION_BOOL . + data SELECT_UNLOCKED_CELLS type ZEXCEL_SHEET_PROTECTION_BOOL . + data SHEET type ZEXCEL_SHEET_PROTECTION_BOOL . + data SORT type ZEXCEL_SHEET_PROTECTION_BOOL . + + methods INITIALIZE . +endinterface. diff --git a/src/zif_excel_sheet_protection.intf.xml b/src/zif_excel_sheet_protection.intf.xml new file mode 100644 index 0000000..6041a18 --- /dev/null +++ b/src/zif_excel_sheet_protection.intf.xml @@ -0,0 +1,156 @@ + + + + + + ZIF_EXCEL_SHEET_PROTECTION + 1 + E + Sheet protection + 2 + 1 + X + + + + ZIF_EXCEL_SHEET_PROTECTION + AUTO_FILTER + E + Autofilters are locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + C_ACTIVE + E + Sheet protection indicator + + + ZIF_EXCEL_SHEET_PROTECTION + C_NOACTIVE + E + Sheet protection indicator + + + ZIF_EXCEL_SHEET_PROTECTION + C_PROTECTED + E + Sheet protection indicator + + + ZIF_EXCEL_SHEET_PROTECTION + C_UNPROTECTED + E + Sheet protection indicator + + + ZIF_EXCEL_SHEET_PROTECTION + DELETE_COLUMNS + E + Deleting columns is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + DELETE_ROWS + E + Deleting rows is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + FORMAT_CELLS + E + Formatting cells is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + FORMAT_COLUMNS + E + Formatting columns is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + FORMAT_ROWS + E + Formatting rows is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + INITIALIZE + E + Initialize protection + + + ZIF_EXCEL_SHEET_PROTECTION + INSERT_COLUMNS + E + Inserting columns is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + INSERT_HYPERLINKS + E + Inserting hyperlinks is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + INSERT_ROWS + E + Inserting rows is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + OBJECTS + E + Objects are locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + PASSWORD + E + AES Password + + + ZIF_EXCEL_SHEET_PROTECTION + PIVOT_TABLES + E + Pivot tables are locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + PROTECTED + E + Sheet protection indicator + + + ZIF_EXCEL_SHEET_PROTECTION + SCENARIOS + E + Scenarios are locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + SELECT_LOCKED_CELLS + E + Selection of locked cells is locked when the sheet is protec + + + ZIF_EXCEL_SHEET_PROTECTION + SELECT_UNLOCKED_CELLS + E + Selection of unlocked cells is locked when the sheet is prot + + + ZIF_EXCEL_SHEET_PROTECTION + SHEET + E + Sheet is locked when the sheet is protected + + + ZIF_EXCEL_SHEET_PROTECTION + SORT + E + Sorting is locked when the sheet is protected + + + + + diff --git a/src/zif_excel_sheet_vba_project.intf.abap b/src/zif_excel_sheet_vba_project.intf.abap new file mode 100644 index 0000000..debc47d --- /dev/null +++ b/src/zif_excel_sheet_vba_project.intf.abap @@ -0,0 +1,15 @@ +interface ZIF_EXCEL_SHEET_VBA_PROJECT + public . + + + data VBAPROJECT type XSTRING read-only . + data CODENAME type STRING read-only . + data CODENAME_PR type STRING read-only . + + methods SET_CODENAME + importing + !IP_CODENAME type STRING . + methods SET_CODENAME_PR + importing + !IP_CODENAME_PR type STRING . +endinterface. diff --git a/src/zif_excel_sheet_vba_project.intf.xml b/src/zif_excel_sheet_vba_project.intf.xml new file mode 100644 index 0000000..0694ef0 --- /dev/null +++ b/src/zif_excel_sheet_vba_project.intf.xml @@ -0,0 +1,16 @@ + + + + + + ZIF_EXCEL_SHEET_VBA_PROJECT + 1 + E + Excel workbook VBA Project + 2 + 1 + X + + + + diff --git a/src/zif_excel_writer.intf.abap b/src/zif_excel_writer.intf.abap new file mode 100644 index 0000000..cb46345 --- /dev/null +++ b/src/zif_excel_writer.intf.abap @@ -0,0 +1,10 @@ +interface ZIF_EXCEL_WRITER + public . + + + methods WRITE_FILE + importing + !IO_EXCEL type ref to ZCL_EXCEL + returning + value(EP_FILE) type XSTRING . +endinterface. diff --git a/src/zif_excel_writer.intf.xml b/src/zif_excel_writer.intf.xml new file mode 100644 index 0000000..b619ebc --- /dev/null +++ b/src/zif_excel_writer.intf.xml @@ -0,0 +1,16 @@ + + + + + + ZIF_EXCEL_WRITER + 1 + E + Writer Interface + 2 + 1 + X + + + +