diff --git a/ZA2X/CLAS/CLAS_ZCL_EXCEL_AUTOFILTERS.slnk b/ZA2X/CLAS/CLAS_ZCL_EXCEL_AUTOFILTERS.slnk deleted file mode 100644 index 2038e10..0000000 --- a/ZA2X/CLAS/CLAS_ZCL_EXCEL_AUTOFILTERS.slnk +++ /dev/null @@ -1,100 +0,0 @@ - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - METHOD add. - - DATA: ls_autofilter LIKE LINE OF me->mt_autofilters. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - READ TABLE me->mt_autofilters ASSIGNING <ls_autofilter> WITH TABLE KEY worksheet = io_sheet. - IF sy-subrc = 0. - RAISE EXCEPTION TYPE zcx_excel. " adding another autofilter to sheet is not allowed - ENDIF. - - CREATE OBJECT ro_autofilter - EXPORTING - io_sheet = io_sheet. - - ls_autofilter-worksheet = io_sheet. - ls_autofilter-autofilter = ro_autofilter. - INSERT ls_autofilter INTO TABLE me->mt_autofilters. - - -ENDMETHOD. - - - METHOD clear. - - CLEAR me->mt_autofilters. - -ENDMETHOD. - - - - - - METHOD get. - - DATA: ls_autofilter LIKE LINE OF me->mt_autofilters. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - READ TABLE me->mt_autofilters ASSIGNING <ls_autofilter> WITH TABLE KEY worksheet = io_worksheet. - IF sy-subrc = 0. - ro_autofilter = <ls_autofilter>-autofilter. - ELSE. - CLEAR ro_autofilter. - ENDIF. - -ENDMETHOD. - - - - METHOD is_empty. - IF me->mt_autofilters IS INITIAL. - r_empty = abap_true. - ENDIF. -ENDMETHOD. - - - - METHOD remove. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - DELETE TABLE me->mt_autofilters WITH TABLE KEY worksheet = lo_worksheet. - -ENDMETHOD. - - - - METHOD size. - DESCRIBE TABLE me->mt_autofilters LINES r_size. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL.slnk b/ZA2X/CLAS/ZCL_EXCEL.slnk deleted file mode 100644 index 19bf848..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL.slnk +++ /dev/null @@ -1,659 +0,0 @@ - - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - CLASS zcl_tc_excel DEFINITION DEFERRED. -CLASS zcl_excel DEFINITION LOCAL FRIENDS zcl_tc_excel. - -*----------------------------------------------------------------------* -* CLASS zcl_Tc_Excel DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS zcl_tc_excel DEFINITION FOR TESTING - DURATION SHORT - RISK LEVEL HARMLESS -. -*?<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> -*?<asx:values> -*?<TESTCLASS_OPTIONS> -*?<TEST_CLASS>zcl_Tc_Excel -*?</TEST_CLASS> -*?<TEST_MEMBER>f_Cut -*?</TEST_MEMBER> -*?<OBJECT_UNDER_TEST>ZCL_EXCEL -*?</OBJECT_UNDER_TEST> -*?<OBJECT_IS_LOCAL/> -*?<GENERATE_FIXTURE>X -*?</GENERATE_FIXTURE> -*?<GENERATE_CLASS_FIXTURE>X -*?</GENERATE_CLASS_FIXTURE> -*?<GENERATE_INVOCATION>X -*?</GENERATE_INVOCATION> -*?<GENERATE_ASSERT_EQUAL>X -*?</GENERATE_ASSERT_EQUAL> -*?</TESTCLASS_OPTIONS> -*?</asx:values> -*?</asx:abap> - PRIVATE SECTION. -* ================ - DATA: - f_cut TYPE REF TO zcl_excel. "class under test - - CLASS-METHODS: class_setup. - CLASS-METHODS: class_teardown. - METHODS: setup. - METHODS: teardown. - METHODS: create_empty_excel FOR TESTING. - -ENDCLASS. "zcl_Tc_Excel - - -*----------------------------------------------------------------------* -* CLASS zcl_Tc_Excel IMPLEMENTATION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS zcl_tc_excel IMPLEMENTATION. -* ================================== - - METHOD class_setup. -* =================== - - - ENDMETHOD. "class_Setup - - - METHOD class_teardown. -* ====================== - - - ENDMETHOD. "class_Teardown - - - METHOD setup. -* ============= - - CREATE OBJECT f_cut. - ENDMETHOD. "setup - - - METHOD teardown. -* ================ - - - ENDMETHOD. "teardown - -*// START TEST METHODS - - METHOD create_empty_excel. -* ================================== - - DATA: lv_count TYPE i. - lv_count = f_cut->get_worksheets_size( ). - - cl_abap_unit_assert=>assert_equals( act = lv_count - exp = 1 - msg = 'Testing number of sheet' - level = if_aunit_constants=>tolerable ). - ENDMETHOD. "create_empty_excel - -*// END TEST METHODS - - -ENDCLASS. "zcl_Tc_Excel - - - - - - - - - - - - - - - - - - - - - - METHOD zif_excel_book_properties~initialize. - DATA: lv_timestamp TYPE timestampl. - - me->zif_excel_book_properties~application = 'Microsoft Excel'. - me->zif_excel_book_properties~appversion = '12.0000'. - - GET TIME STAMP FIELD lv_timestamp. - me->zif_excel_book_properties~created = lv_timestamp. - me->zif_excel_book_properties~creator = sy-uname. - me->zif_excel_book_properties~description = zcl_excel=>version. - me->zif_excel_book_properties~modified = lv_timestamp. - me->zif_excel_book_properties~lastmodifiedby = sy-uname. -ENDMETHOD. - - - method ZIF_EXCEL_BOOK_PROTECTION~INITIALIZE. - me->zif_excel_book_protection~protected = zif_excel_book_protection=>c_unprotected. - me->zif_excel_book_protection~lockrevision = zif_excel_book_protection=>c_unlocked. - me->zif_excel_book_protection~lockstructure = zif_excel_book_protection=>c_unlocked. - me->zif_excel_book_protection~lockwindows = zif_excel_book_protection=>c_unlocked. - CLEAR me->zif_excel_book_protection~workbookpassword. - CLEAR me->zif_excel_book_protection~revisionspassword. - endmethod. - - - method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_CODENAME. - me->zif_excel_book_vba_project~codename = ip_codename. - endmethod. - - - method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_CODENAME_PR. - me->zif_excel_book_vba_project~codename_pr = ip_codename_pr. - endmethod. - - - method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_VBAPROJECT. - me->zif_excel_book_vba_project~vbaproject = ip_vbaproject. - endmethod. - - - - - - METHOD add_new_autofilter. -* Check for autofilter reference: new or overwrite; only one per sheet - ro_autofilter = autofilters->add( io_sheet ) . -ENDMETHOD. - - - - - - method ADD_NEW_DRAWING. - DATA: lv_guid TYPE guid_16. -* Create default blank worksheet - CREATE OBJECT eo_drawing - EXPORTING - ip_type = ip_type - ip_title = ip_title. - - CASE ip_type. - WHEN 'image'. - drawings->add( eo_drawing ). - WHEN 'chart'. - charts->add( eo_drawing ). - ENDCASE. - endmethod. - - - - method ADD_NEW_RANGE. -* Create default blank range - CREATE OBJECT eo_range. - ranges->add( eo_range ). - endmethod. - - - - - method ADD_NEW_STYLE. -* Start of deletion # issue 139 - Dateretention of cellstyles -* CREATE OBJECT eo_style. -* styles->add( eo_style ). -* End of deletion # issue 139 - Dateretention of cellstyles -* Start of insertion # issue 139 - Dateretention of cellstyles -* Create default style - CREATE OBJECT eo_style - EXPORTING - ip_guid = ip_guid. - styles->add( eo_style ). - - DATA: style2 TYPE zexcel_s_stylemapping. -* Copy to new representations - style2 = stylemapping_dynamic_style( eo_style ). - INSERT style2 INTO TABLE t_stylemapping1. - INSERT style2 INTO TABLE t_stylemapping2. -* End of insertion # issue 139 - Dateretention of cellstyles - - endmethod. - - - - - - method ADD_NEW_WORKSHEET. - DATA: lv_guid TYPE guid_16. - -* Create default blank worksheet - CREATE OBJECT eo_worksheet - EXPORTING - ip_excel = me - ip_title = ip_title. - - worksheets->add( eo_worksheet ). - worksheets->active_worksheet = worksheets->size( ). - endmethod. - - - METHOD add_static_styles. - " # issue 139 - FIELD-SYMBOLS: <style1> LIKE LINE OF t_stylemapping1, - <style2> LIKE LINE OF t_stylemapping2. - DATA: style TYPE REF TO zcl_excel_style. - - LOOP AT me->t_stylemapping1 ASSIGNING <style1> WHERE added_to_iterator IS INITIAL. - READ TABLE me->t_stylemapping2 ASSIGNING <style2> WITH TABLE KEY guid = <style1>-guid. - CHECK sy-subrc = 0. " Should always be true since these tables are being filled parallel - - style = me->add_new_style( <style1>-guid ). - - zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <style1>-complete_style - i_sourcex = <style1>-complete_stylex - CHANGING e_target = style ). - - ENDLOOP. -ENDMETHOD. - - - method CONSTRUCTOR. - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_style TYPE REF TO zcl_excel_style. - -* Inizialize instance objects - CREATE OBJECT security. - CREATE OBJECT worksheets. - CREATE OBJECT ranges. - CREATE OBJECT styles. - CREATE OBJECT drawings - EXPORTING - ip_type = zcl_excel_drawing=>type_image. - CREATE OBJECT charts - EXPORTING - ip_type = zcl_excel_drawing=>type_chart. - CREATE OBJECT legacy_palette. - CREATE OBJECT autofilters. - - me->zif_excel_book_protection~initialize( ). - me->zif_excel_book_properties~initialize( ). - - me->add_new_worksheet( ). - me->add_new_style( ). " Standard style - lo_style = me->add_new_style( ). " Standard style with fill gray125 - lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_pattern_gray125. - - endmethod. - - - - - METHOD delete_worksheet. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - l_size TYPE i, - lv_errormessage TYPE string. - - l_size = get_worksheets_size( ). - IF l_size = 1. " Only 1 worksheet left --> check whether this is the worksheet to be deleted - lo_worksheet = me->get_worksheet_by_index( 1 ). - IF lo_worksheet = io_worksheet. - lv_errormessage = 'Deleting last remaining worksheet is not allowed'(002). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - ENDIF. - - me->worksheets->remove( io_worksheet ). - -ENDMETHOD. - - - - METHOD delete_worksheet_by_index. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - lv_errormessage TYPE string. - - lo_worksheet = me->get_worksheet_by_index( iv_index ). - IF lo_worksheet IS NOT BOUND. - lv_errormessage = 'Worksheet not existing'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - me->delete_worksheet( lo_worksheet ). - -ENDMETHOD. - - - - METHOD delete_worksheet_by_name. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - lv_errormessage TYPE string. - - lo_worksheet = me->get_worksheet_by_name( iv_title ). - IF lo_worksheet IS NOT BOUND. - lv_errormessage = 'Worksheet not existing'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - me->delete_worksheet( lo_worksheet ). - -ENDMETHOD. - - - - method GET_ACTIVE_SHEET_INDEX. - r_active_worksheet = me->worksheets->active_worksheet. - endmethod. - - - - method GET_ACTIVE_WORKSHEET. - - eo_worksheet = me->worksheets->get( me->worksheets->active_worksheet ). - - endmethod. - - - - method GET_AUTOFILTERS_REFERENCE. - - ro_autofilters = autofilters. - - endmethod. - - - - method GET_DEFAULT_STYLE. - ep_style = me->default_style. - endmethod. - - - - - method GET_DRAWINGS_ITERATOR. - - CASE ip_type. - WHEN zcl_excel_drawing=>type_image. - eo_iterator = me->drawings->get_iterator( ). - WHEN zcl_excel_drawing=>type_chart. - eo_iterator = me->charts->get_iterator( ). - WHEN OTHERS. - ENDCASE. - - endmethod. - - - - method GET_NEXT_TABLE_ID. - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lv_tables_count TYPE i. - - lo_iterator = me->get_worksheets_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lv_tables_count = lo_worksheet->get_tables_size( ). - ADD lv_tables_count TO ep_id. - - ENDWHILE. - - ADD 1 TO ep_id. - - endmethod. - - - - method GET_RANGES_ITERATOR. - - eo_iterator = me->ranges->get_iterator( ). - - endmethod. - - - - - - METHOD get_static_cellstyle_guid. - " # issue 139 - DATA: style LIKE LINE OF me->t_stylemapping1. - - READ TABLE me->t_stylemapping1 INTO style - WITH TABLE KEY dynamic_style_guid = style-guid " no dynamic style --> look for initial guid here - complete_style = ip_cstyle_complete - complete_stylex = ip_cstylex_complete. - IF sy-subrc <> 0. - style-complete_style = ip_cstyle_complete. - style-complete_stylex = ip_cstylex_complete. -* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases -* IMPORTING -* ev_guid_16 = style-guid. - style-guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call - INSERT style INTO TABLE me->t_stylemapping1. - INSERT style INTO TABLE me->t_stylemapping2. - - ENDIF. - - ep_guid = style-guid. -ENDMETHOD. - - - - method GET_STYLES_ITERATOR. - - eo_iterator = me->styles->get_iterator( ). - - endmethod. - - - - - - method GET_STYLE_INDEX_IN_STYLES. - DATA: index TYPE syindex. - DATA: lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_style TYPE REF TO zcl_excel_style. - - CHECK ip_guid IS NOT INITIAL. - - - lo_iterator = me->get_styles_iterator( ). - WHILE lo_iterator->has_next( ) = 'X'. - ADD 1 TO index. - lo_style ?= lo_iterator->get_next( ). - IF lo_style->get_guid( ) = ip_guid. - ep_index = index. - EXIT. - ENDIF. - ENDWHILE. - - IF ep_index IS INITIAL. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Index not found'. - else. - SUBTRACT 1 from ep_index. " In excel list starts with "0" - ENDIF. - endmethod. - - - - - - method GET_STYLE_TO_GUID. - " # issue 139 - - READ TABLE me->t_stylemapping2 INTO ep_stylemapping WITH TABLE KEY guid = ip_guid. - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'GUID not found'. - ENDIF. - - IF ep_stylemapping-dynamic_style_guid IS NOT INITIAL. - zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = ep_stylemapping-cl_style - CHANGING e_target = ep_stylemapping-complete_style - e_targetx = ep_stylemapping-complete_stylex ). - ENDIF. - - - endmethod. - - - - method GET_THEME. - eo_theme = theme. -endmethod. - - - - method GET_WORKSHEETS_ITERATOR. - - eo_iterator = me->worksheets->get_iterator( ). - - endmethod. - - - - method GET_WORKSHEETS_NAME. - - ep_name = me->worksheets->name. - - endmethod. - - - - METHOD get_worksheets_size. - - ep_size = me->worksheets->size( ). - -ENDMETHOD. - - - - - METHOD get_worksheet_by_index. - - - DATA: lv_index TYPE zexcel_active_worksheet. - - lv_index = iv_index. - eo_worksheet = me->worksheets->get( lv_index ). - -ENDMETHOD. - - - - - METHOD get_worksheet_by_name. - - DATA: lv_index TYPE zexcel_active_worksheet, - l_size TYPE i. - - l_size = get_worksheets_size( ). - - DO l_size TIMES. - lv_index = sy-index. - eo_worksheet = me->worksheets->get( lv_index ). - IF eo_worksheet->get_title( ) = ip_sheet_name. - RETURN. - ENDIF. - ENDDO. - - CLEAR eo_worksheet. - -ENDMETHOD. - - - - - METHOD set_active_sheet_index. - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, - lv_errormessage TYPE string. - -*--------------------------------------------------------------------* -* Check whether worksheet exists -*--------------------------------------------------------------------* - lo_worksheet = me->get_worksheet_by_index( i_active_worksheet ). - IF lo_worksheet IS NOT BOUND. - lv_errormessage = 'Worksheet not existing'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - me->worksheets->active_worksheet = i_active_worksheet. - -ENDMETHOD. - - - - METHOD set_active_sheet_index_by_name. - - DATA: ws_it TYPE REF TO cl_object_collection_iterator, - ws TYPE REF TO zcl_excel_worksheet, - lv_title TYPE zexcel_sheet_title, - count TYPE i VALUE 1. - - ws_it = me->worksheets->get_iterator( ). - - WHILE ws_it->if_object_collection_iterator~has_next( ) = abap_true. - ws ?= ws_it->if_object_collection_iterator~get_next( ). - lv_title = ws->get_title( ). - IF lv_title = i_worksheet_name. - me->worksheets->active_worksheet = count. - EXIT. - ENDIF. - count = count + 1. - ENDWHILE. - -ENDMETHOD. - - - - - method SET_DEFAULT_STYLE. - me->default_style = ip_style. - endmethod. - - - - method SET_THEME. - theme = io_theme. -endmethod. - - - - - method STYLEMAPPING_DYNAMIC_STYLE. -" # issue 139 - eo_style2-dynamic_style_guid = ip_style->get_guid( ). - eo_style2-guid = eo_style2-dynamic_style_guid. - eo_style2-added_to_iterator = abap_true. - eo_style2-cl_style = ip_style. - -* don't care about attributes here, since this data may change -* dynamically - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTER.slnk b/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTER.slnk deleted file mode 100644 index 6447045..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTER.slnk +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - METHOD constructor. - worksheet = io_sheet. -ENDMETHOD. - - - - - METHOD get_column_filter. - - DATA: ls_filter LIKE LINE OF me->mt_filters. - - READ TABLE me->mt_filters REFERENCE INTO rr_filter WITH TABLE KEY column = i_column. - IF sy-subrc <> 0. - ls_filter-column = i_column. - INSERT ls_filter INTO TABLE me->mt_filters REFERENCE INTO rr_filter. - ENDIF. - -ENDMETHOD. - - - - METHOD get_filter_area. - - validate_area( ). - - rs_area = filter_area. - -ENDMETHOD. - - - - METHOD get_filter_range. - DATA: l_row_start_c TYPE string, - l_row_end_c TYPE string, - l_col_start_c TYPE string, - l_col_end_c TYPE string, - l_value TYPE string. - - validate_area( ). - - l_row_end_c = filter_area-row_end. - CONDENSE l_row_end_c NO-GAPS. - - l_row_start_c = filter_area-row_start. - CONDENSE l_row_start_c NO-GAPS. - - l_col_start_c = zcl_excel_common=>convert_column2alpha( ip_column = filter_area-col_start ) . - l_col_end_c = zcl_excel_common=>convert_column2alpha( ip_column = filter_area-col_end ) . - - CONCATENATE l_col_start_c l_row_start_c ':' l_col_end_c l_row_end_c INTO r_range. - -ENDMETHOD. - - - - METHOD get_filter_reference. - DATA: l_row_start_c TYPE string, - l_row_end_c TYPE string, - l_col_start_c TYPE string, - l_col_end_c TYPE string, - l_value TYPE string. - - validate_area( ). - - l_row_end_c = filter_area-row_end. - CONDENSE l_row_end_c NO-GAPS. - - l_row_start_c = filter_area-row_start. - CONDENSE l_row_start_c NO-GAPS. - - l_col_start_c = zcl_excel_common=>convert_column2alpha( ip_column = filter_area-col_start ) . - l_col_end_c = zcl_excel_common=>convert_column2alpha( ip_column = filter_area-col_end ) . - l_value = worksheet->get_title( ) . - - r_ref = zcl_excel_common=>escape_string( ip_value = l_value ). - - CONCATENATE r_ref '!$' l_col_start_c '$' l_row_start_c ':$' l_col_end_c '$' l_row_end_c INTO r_ref. - -ENDMETHOD. - - - - METHOD get_values. - - FIELD-SYMBOLS: <ls_filter> LIKE LINE OF me->mt_filters, - <ls_value> LIKE LINE OF <ls_filter>-t_values. - - DATA: ls_filter LIKE LINE OF rt_filter. - - LOOP AT me->mt_filters ASSIGNING <ls_filter> WHERE rule = mc_filter_rule_single_values. - - ls_filter-column = <ls_filter>-column. - LOOP AT <ls_filter>-t_values ASSIGNING <ls_value>. - ls_filter-value = <ls_value>. - APPEND ls_filter TO rt_filter. - ENDLOOP. - - ENDLOOP. - -ENDMETHOD. - - - - - METHOD is_row_hidden. - - - DATA: lr_filter TYPE REF TO ts_filter, - lv_col TYPE i, - ls_value TYPE zexcel_s_autofilter_values. - - FIELD-SYMBOLS: <ls_filter> TYPE ts_filter. - - rv_is_hidden = abap_false. - -*--------------------------------------------------------------------* -* 1st row of filter area is never hidden, because here the filter -* symbol is being shown -*--------------------------------------------------------------------* - IF iv_row = me->filter_area-row_start. - RETURN. - ENDIF. - - - lv_col = me->filter_area-col_start. - - - WHILE lv_col <= me->filter_area-col_end. - - lr_filter = me->get_column_filter( lv_col ). - ASSIGN lr_filter->* TO <ls_filter>. - - CASE <ls_filter>-rule. - - WHEN mc_filter_rule_single_values. - rv_is_hidden = me->is_row_hidden_single_values( iv_row = iv_row - iv_col = lv_col - is_filter = <ls_filter> ). - - WHEN mc_filter_rule_text_pattern. - rv_is_hidden = me->is_row_hidden_text_pattern( iv_row = iv_row - iv_col = lv_col - is_filter = <ls_filter> ). - - ENDCASE. - - IF rv_is_hidden = abap_true. - RETURN. - ENDIF. - - - ADD 1 TO lv_col. - - ENDWHILE. - - -ENDMETHOD. - - - - - - - METHOD is_row_hidden_single_values. - - - DATA: lv_value TYPE string. - - FIELD-SYMBOLS: <ls_sheet_content> LIKE LINE OF me->worksheet->sheet_content. - - rv_is_hidden = abap_false. " Default setting is NOT HIDDEN = is in filter range - -*--------------------------------------------------------------------* -* No filter values --> only symbol should be shown but nothing is being hidden -*--------------------------------------------------------------------* - IF is_filter-t_values IS INITIAL. - RETURN. - ENDIF. - -*--------------------------------------------------------------------* -* Get value of cell -*--------------------------------------------------------------------* - READ TABLE me->worksheet->sheet_content ASSIGNING <ls_sheet_content> WITH TABLE KEY cell_row = iv_row - cell_column = iv_col. - IF sy-subrc = 0. - lv_value = <ls_sheet_content>-cell_value. - ELSE. - CLEAR lv_value. - ENDIF. - -*--------------------------------------------------------------------* -* Check whether it is affected by filter -* this needs to be extended if we support other filtertypes -* other than single values -*--------------------------------------------------------------------* - READ TABLE is_filter-t_values TRANSPORTING NO FIELDS WITH TABLE KEY table_line = lv_value. - IF sy-subrc <> 0. - rv_is_hidden = abap_true. - RETURN. - ENDIF. - -ENDMETHOD. - - - - - - - METHOD is_row_hidden_text_pattern. - - - - DATA: lv_value TYPE string. - - FIELD-SYMBOLS: <ls_sheet_content> LIKE LINE OF me->worksheet->sheet_content. - - rv_is_hidden = abap_false. " Default setting is NOT HIDDEN = is in filter range - -*--------------------------------------------------------------------* -* Get value of cell -*--------------------------------------------------------------------* - READ TABLE me->worksheet->sheet_content ASSIGNING <ls_sheet_content> WITH TABLE KEY cell_row = iv_row - cell_column = iv_col. - IF sy-subrc = 0. - lv_value = <ls_sheet_content>-cell_value. - ELSE. - CLEAR lv_value. - ENDIF. - -*--------------------------------------------------------------------* -* Check whether it is affected by filter -* this needs to be extended if we support other filtertypes -* other than single values -*--------------------------------------------------------------------* - IF lv_value NOT IN is_filter-tr_textfilter1. - rv_is_hidden = abap_true. - RETURN. - ENDIF. - -ENDMETHOD. - - - - METHOD set_filter_area. - - filter_area = is_area. - -ENDMETHOD. - - - - - - - METHOD set_text_filter. -* see method documentation how to use this - - DATA: lr_filter TYPE REF TO ts_filter, - ls_value1 TYPE LINE OF ts_filter-tr_textfilter1. - - FIELD-SYMBOLS: <ls_filter> TYPE ts_filter. - - - lr_filter = me->get_column_filter( i_column ). - ASSIGN lr_filter->* TO <ls_filter>. - - <ls_filter>-rule = mc_filter_rule_text_pattern. - CLEAR <ls_filter>-tr_textfilter1. - - IF iv_textfilter1 CA '*+'. " Pattern - ls_value1-sign = 'I'. - ls_value1-option = 'CP'. - ls_value1-low = iv_textfilter1. - ELSE. - ls_value1-sign = 'I'. - ls_value1-option = 'EQ'. - ls_value1-low = iv_textfilter1. - ENDIF. - APPEND ls_value1 TO <ls_filter>-tr_textfilter1. - -ENDMETHOD. - - - - - - - - - - - - - - - - - - - - - - - - METHOD set_value. - - DATA: lr_filter TYPE REF TO ts_filter, - ls_value TYPE zexcel_s_autofilter_values. - - FIELD-SYMBOLS: <ls_filter> TYPE ts_filter. - - - lr_filter = me->get_column_filter( i_column ). - ASSIGN lr_filter->* TO <ls_filter>. - - <ls_filter>-rule = mc_filter_rule_single_values. - - INSERT i_value INTO TABLE <ls_filter>-t_values. - -ENDMETHOD. - - - - METHOD set_values. - - FIELD-SYMBOLS: <ls_value> LIKE LINE OF it_values. - - LOOP AT it_values ASSIGNING <ls_value>. - - me->set_value( i_column = <ls_value>-column - i_value = <ls_value>-value ). - - ENDLOOP. - -ENDMETHOD. - - - METHOD validate_area. - DATA: l_col TYPE zexcel_cell_column, - l_row TYPE zexcel_cell_row. - - l_row = worksheet->get_highest_row( ) . - l_col = worksheet->get_highest_column( ) . - - IF filter_area IS INITIAL. - filter_area-row_start = 1. - filter_area-col_start = 1. - filter_area-row_end = l_row . - filter_area-col_end = l_col . - ENDIF. - - IF filter_area-row_start < 1. - filter_area-row_start = 1. - ENDIF. - IF filter_area-col_start < 1. - filter_area-col_start = 1. - ENDIF. - IF filter_area-row_end > l_row OR - filter_area-row_end < 1. - filter_area-row_end = l_row. - ENDIF. - IF filter_area-col_end > l_col OR - filter_area-col_end < 1. - filter_area-col_end = l_col. - ENDIF. - IF filter_area-row_start >= filter_area-row_end. - filter_area-row_start = filter_area-row_end - 1. - IF filter_area-row_start < 1. - filter_area-row_start = 1. - filter_area-row_end = 2. - ENDIF. - ENDIF. - IF filter_area-col_start > filter_area-col_end. - filter_area-col_start = filter_area-col_end. - ENDIF. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTERS.slnk b/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTERS.slnk deleted file mode 100644 index 2038e10..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_AUTOFILTERS.slnk +++ /dev/null @@ -1,100 +0,0 @@ - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - METHOD add. - - DATA: ls_autofilter LIKE LINE OF me->mt_autofilters. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - READ TABLE me->mt_autofilters ASSIGNING <ls_autofilter> WITH TABLE KEY worksheet = io_sheet. - IF sy-subrc = 0. - RAISE EXCEPTION TYPE zcx_excel. " adding another autofilter to sheet is not allowed - ENDIF. - - CREATE OBJECT ro_autofilter - EXPORTING - io_sheet = io_sheet. - - ls_autofilter-worksheet = io_sheet. - ls_autofilter-autofilter = ro_autofilter. - INSERT ls_autofilter INTO TABLE me->mt_autofilters. - - -ENDMETHOD. - - - METHOD clear. - - CLEAR me->mt_autofilters. - -ENDMETHOD. - - - - - - METHOD get. - - DATA: ls_autofilter LIKE LINE OF me->mt_autofilters. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - READ TABLE me->mt_autofilters ASSIGNING <ls_autofilter> WITH TABLE KEY worksheet = io_worksheet. - IF sy-subrc = 0. - ro_autofilter = <ls_autofilter>-autofilter. - ELSE. - CLEAR ro_autofilter. - ENDIF. - -ENDMETHOD. - - - - METHOD is_empty. - IF me->mt_autofilters IS INITIAL. - r_empty = abap_true. - ENDIF. -ENDMETHOD. - - - - METHOD remove. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet. - - FIELD-SYMBOLS: <ls_autofilter> LIKE LINE OF me->mt_autofilters. - - DELETE TABLE me->mt_autofilters WITH TABLE KEY worksheet = lo_worksheet. - -ENDMETHOD. - - - - METHOD size. - DESCRIBE TABLE me->mt_autofilters LINES r_size. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk deleted file mode 100644 index eb875fc..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk +++ /dev/null @@ -1,2800 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - CLASS lcl_excel_common_test DEFINITION DEFERRED. -CLASS zcl_excel_common DEFINITION LOCAL FRIENDS lcl_excel_common_test. - -*----------------------------------------------------------------------* -* CLASS lcl_Excel_Common_Test DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_excel_common_test DEFINITION FOR TESTING "#AU Risk_Level Harmless - . "#AU Duration Short -*?<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> -*?<asx:values> -*?<TESTCLASS_OPTIONS> -*?<TEST_CLASS>lcl_Excel_Common_Test -*?</TEST_CLASS> -*?<TEST_MEMBER>f_Cut -*?</TEST_MEMBER> -*?<OBJECT_UNDER_TEST>ZCL_EXCEL_COMMON -*?</OBJECT_UNDER_TEST> -*?<OBJECT_IS_LOCAL/> -*?<GENERATE_FIXTURE>X -*?</GENERATE_FIXTURE> -*?<GENERATE_CLASS_FIXTURE>X -*?</GENERATE_CLASS_FIXTURE> -*?<GENERATE_INVOCATION>X -*?</GENERATE_INVOCATION> -*?<GENERATE_ASSERT_EQUAL>X -*?</GENERATE_ASSERT_EQUAL> -*?</TESTCLASS_OPTIONS> -*?</asx:values> -*?</asx:abap> - PRIVATE SECTION. -* ================ - DATA: - lx_excel TYPE REF TO zcx_excel, - ls_symsg_act TYPE symsg, " actual messageinformation of exception - ls_symsg_exp TYPE symsg, " expected messageinformation of exception - f_cut TYPE REF TO zcl_excel_common. "class under test - - CLASS-METHODS: class_setup. - CLASS-METHODS: class_teardown. - METHODS: setup. - METHODS: teardown. -* METHODS: char2hex FOR TESTING. - METHODS: convert_column2alpha FOR TESTING. - METHODS: convert_column2int FOR TESTING. - METHODS: date_to_excel_string FOR TESTING. - METHODS: encrypt_password FOR TESTING. - METHODS: excel_string_to_date FOR TESTING. - METHODS: excel_string_to_time FOR TESTING. -* METHODS: number_to_excel_string FOR TESTING. - METHODS: time_to_excel_string FOR TESTING. - METHODS: split_file FOR TESTING. - METHODS: convert_range2column_a_row FOR TESTING. - METHODS: describe_structure FOR TESTING. - METHODS: calculate_cell_distance FOR TESTING. - METHODS: shift_formula FOR TESTING. - METHODS: is_cell_in_range FOR TESTING. -ENDCLASS. "lcl_Excel_Common_Test - - -*----------------------------------------------------------------------* -* CLASS lcl_Excel_Common_Test IMPLEMENTATION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_excel_common_test IMPLEMENTATION. -* =========================================== - - METHOD class_setup. -* =================== - - - ENDMETHOD. "class_Setup - - - METHOD class_teardown. -* ====================== - - - ENDMETHOD. "class_Teardown - - - METHOD setup. -* ============= - - CREATE OBJECT f_cut. - ENDMETHOD. "setup - - - METHOD teardown. -* ================ - - - ENDMETHOD. "teardown - - - METHOD convert_column2alpha. -* ============================ - DATA ep_column TYPE zexcel_cell_column_alpha. - -* Test 1. Simple test - TRY. - ep_column = zcl_excel_common=>convert_column2alpha( 1 ). - - zcl_excel_common=>assert_equals( - act = ep_column - exp = 'A' - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Max column for OXML #16,384 = XFD - TRY. - ep_column = zcl_excel_common=>convert_column2alpha( 16384 ). - - zcl_excel_common=>assert_equals( - act = ep_column - exp = 'XFD' - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Index 0 is out of bounds - TRY. - ep_column = zcl_excel_common=>convert_column2alpha( 0 ). - - zcl_excel_common=>assert_equals( - act = ep_column - exp = 'A' - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( - act = lx_excel->error - exp = 'Index out of bounds' - msg = 'Colum index 0 is out of bounds, min column index is 1' - level = if_aunit_constants=>fatal - ). - ENDTRY. - -* Test 4. Exception should be thrown index out of bounds - TRY. - ep_column = zcl_excel_common=>convert_column2alpha( 16385 ). - - zcl_excel_common=>assert_differs( - act = ep_column - exp = 'XFE' - msg = 'Colum index 16385 is out of bounds, max column index is 16384' - level = if_aunit_constants=>fatal - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( - act = lx_excel->error - exp = 'Index out of bounds' - msg = 'Wrong exception is thrown' - level = if_aunit_constants=>tolerable - ). - ENDTRY. - ENDMETHOD. "convert_Column2alpha - - - METHOD convert_column2int. -* ========================== - DATA ep_column TYPE zexcel_cell_column. - -* Test 1. Basic test - TRY. - ep_column = zcl_excel_common=>convert_column2int( 'A' ). - - zcl_excel_common=>assert_equals( - act = ep_column - exp = 1 - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Max column - TRY. - ep_column = zcl_excel_common=>convert_column2int( 'XFD' ). - - zcl_excel_common=>assert_equals( - act = ep_column - exp = 16384 - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Out of bounds - TRY. - ep_column = zcl_excel_common=>convert_column2int( '' ). - - zcl_excel_common=>assert_differs( act = ep_column - exp = '0' - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical ). - CATCH zcx_excel INTO lx_excel. - CLEAR: ls_symsg_act, - ls_symsg_exp. - ls_symsg_exp-msgid = 'ZABAP2XLSX'. - ls_symsg_exp-msgno = '800'. - ls_symsg_act-msgid = lx_excel->syst_at_raise-msgid. - ls_symsg_act-msgno = lx_excel->syst_at_raise-msgno. - zcl_excel_common=>assert_equals( act = ls_symsg_act - exp = ls_symsg_exp - msg = 'Colum name should be a valid string' - level = if_aunit_constants=>fatal ). - ENDTRY. - -* Test 4. Out of bounds - TRY. - ep_column = zcl_excel_common=>convert_column2int( 'XFE' ). - - zcl_excel_common=>assert_differs( act = ep_column - exp = 16385 - msg = 'Wrong column conversion' - level = if_aunit_constants=>critical ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( act = lx_excel->error - exp = 'Index out of bounds' - msg = 'Colum XFE is out of range' - level = if_aunit_constants=>fatal ). - ENDTRY. - ENDMETHOD. "convert_Column2int - - - METHOD date_to_excel_string. -* ============================ - DATA ep_value TYPE zexcel_cell_value. - -* Test 1. Basic conversion - TRY. - ep_value = zcl_excel_common=>date_to_excel_string( '19000101' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = 1 - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. -* Check around the "Excel Leap Year" 1900 - TRY. - ep_value = zcl_excel_common=>date_to_excel_string( '19000228' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = 59 - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - TRY. - ep_value = zcl_excel_common=>date_to_excel_string( '19000301' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = 61 - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - - -* Test 2. Basic conversion - TRY. - ep_value = zcl_excel_common=>date_to_excel_string( '99991212' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = 2958446 - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Initial date - TRY. - DATA: lv_date TYPE d. - ep_value = zcl_excel_common=>date_to_excel_string( lv_date ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Basic conversion - TRY. - DATA exp_value TYPE zexcel_cell_value VALUE 0. - ep_value = zcl_excel_common=>date_to_excel_string( '18991231' ). - - zcl_excel_common=>assert_differs( - act = ep_value - exp = exp_value - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( - act = lx_excel->error - exp = 'Index out of bounds' - msg = 'Dates prior of 1900 are not available in excel' - level = if_aunit_constants=>critical - ). - ENDTRY. - - ENDMETHOD. "date_To_Excel_String - - - METHOD encrypt_password. -* ======================== - DATA lv_encrypted_pwd TYPE zexcel_aes_password. - - TRY. - lv_encrypted_pwd = zcl_excel_common=>encrypt_password( 'test' ). - - zcl_excel_common=>assert_equals( - act = lv_encrypted_pwd - exp = 'CBEB' - msg = 'Wrong password encryption' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - ENDMETHOD. "encrypt_Password - - - METHOD excel_string_to_date. -* ============================ - DATA ep_value TYPE d. - - -* Test 1. Simple test -> ABAP Manage also date prior of 1900 - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '0' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '18991231' - msg = 'Wrong date conversion' - level = if_aunit_constants=>tolerable - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. -* Check around the "Excel Leap Year" 1900 - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '59' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '19000228' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '61' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '19000301' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Simple test - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '1' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '19000101' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Index 0 is out of bounds - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '2958446' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '99991212' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 4. Exception should be thrown index out of bounds - TRY. - ep_value = zcl_excel_common=>excel_string_to_date( '2958447' ). - - zcl_excel_common=>assert_differs( - act = ep_value - exp = '99991212' - msg = 'Wrong date conversion' - level = if_aunit_constants=>fatal - ). - - zcl_excel_common=>assert_differs( - act = ep_value - exp = '00000000' - msg = 'Wrong date conversion' - level = if_aunit_constants=>fatal - ). - - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( - act = lx_excel->error - exp = 'Index out of bounds' - msg = 'Wrong exception is thrown' - level = if_aunit_constants=>tolerable - ). - ENDTRY. - ENDMETHOD. "excel_String_To_Date - - - METHOD excel_string_to_time. -* ============================ - DATA ep_value TYPE t. - -* Test 1. Simple test - TRY. - ep_value = zcl_excel_common=>excel_string_to_time( '0' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '000000' - msg = 'Wrong date conversion' - level = if_aunit_constants=>tolerable - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Simple test - TRY. - ep_value = zcl_excel_common=>excel_string_to_time( '1' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '000000' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Simple test - TRY. - ep_value = zcl_excel_common=>excel_string_to_time( '0.99999' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '235959' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 4. Also string greater than 1 should be managed - TRY. - ep_value = zcl_excel_common=>excel_string_to_time( '4.1' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '022400' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 4. string is not a number - TRY. - ep_value = zcl_excel_common=>excel_string_to_time( 'NaN' ). - - zcl_excel_common=>assert_differs( - act = ep_value - exp = '000000' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>assert_equals( - act = lx_excel->error - exp = 'Unable to interpret time' - msg = 'Time should be a valid string' - level = if_aunit_constants=>fatal - ). - ENDTRY. - ENDMETHOD. "excel_String_To_Time - - - METHOD time_to_excel_string. -* ============================ - DATA ep_value TYPE zexcel_cell_value. - -* Test 1. Basic conversion - TRY. - ep_value = zcl_excel_common=>time_to_excel_string( '000001' ). - " A test directly in Excel returns the value 0.0000115740740740741000 - zcl_excel_common=>assert_equals( - act = ep_value - exp = '0.0000115740740741' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Basic conversion - TRY. - ep_value = zcl_excel_common=>time_to_excel_string( '235959' ). - " A test directly in Excel returns the value 0.9999884259259260000000 - zcl_excel_common=>assert_equals( - act = ep_value - exp = '0.9999884259259260' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 3. Initial date - TRY. - ep_value = zcl_excel_common=>time_to_excel_string( '000000' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '0' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - -* Test 2. Basic conversion - TRY. - ep_value = zcl_excel_common=>time_to_excel_string( '022400' ). - - zcl_excel_common=>assert_equals( - act = ep_value - exp = '0.1000000000000000' - msg = 'Wrong date conversion' - level = if_aunit_constants=>critical - ). - CATCH zcx_excel INTO lx_excel. - zcl_excel_common=>fail( - msg = 'unexpected exception' - level = if_aunit_constants=>critical " Error Severity - ). - ENDTRY. - - ENDMETHOD. "time_To_Excel_String - - METHOD split_file. -* ============================ - - DATA: ep_file TYPE text255, - ep_extension TYPE char10, - ep_dotextension TYPE char10. - - -* Test 1. Basic conversion - zcl_excel_common=>split_file( EXPORTING ip_file = 'filename.xml' - IMPORTING ep_file = ep_file - ep_extension = ep_extension - ep_dotextension = ep_dotextension ). - - zcl_excel_common=>assert_equals( - act = ep_file - exp = 'filename' - msg = 'Split filename failed' - level = if_aunit_constants=>critical ). - - zcl_excel_common=>assert_equals( - act = ep_extension - exp = 'xml' - msg = 'Split extension failed' - level = if_aunit_constants=>critical ). - - zcl_excel_common=>assert_equals( - act = ep_dotextension - exp = '.xml' - msg = 'Split extension failed' - level = if_aunit_constants=>critical ). - -* Test 2. no extension - zcl_excel_common=>split_file( EXPORTING ip_file = 'filename' - IMPORTING ep_file = ep_file - ep_extension = ep_extension - ep_dotextension = ep_dotextension ). - - zcl_excel_common=>assert_equals( - act = ep_file - exp = 'filename' - msg = 'Split filename failed' - level = if_aunit_constants=>critical ). - - zcl_excel_common=>assert_equals( - act = ep_extension - exp = '' - msg = 'Split extension failed' - level = if_aunit_constants=>critical ). - - zcl_excel_common=>assert_equals( - act = ep_dotextension - exp = '' - msg = 'Split extension failed' - level = if_aunit_constants=>critical ). - - ENDMETHOD. "split_file - - METHOD convert_range2column_a_row. - DATA: lv_range TYPE string. - DATA: lv_column_start TYPE zexcel_cell_column_alpha, - lv_column_end TYPE zexcel_cell_column_alpha, - lv_row_start TYPE zexcel_cell_row, - lv_row_end TYPE zexcel_cell_row, - lv_sheet TYPE string. - -* a) input empty --> nothing to do - zcl_excel_common=>convert_range2column_a_row( - EXPORTING - i_range = lv_range - IMPORTING - e_column_start = lv_column_start " Cell Column Start - e_column_end = lv_column_end " Cell Column End - e_row_start = lv_row_start " Cell Row - e_row_end = lv_row_end " Cell Row - e_sheet = lv_sheet " Title - ). - - zcl_excel_common=>assert_equals( - act = lv_column_start - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_column_end - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_start - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_end - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_sheet - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). -* b) sheetname existing - starts with ' example 'Sheet 1'!$B$6:$D$13 - lv_range = `'Sheet 1'!$B$6:$D$13`. - zcl_excel_common=>convert_range2column_a_row( - EXPORTING - i_range = lv_range - IMPORTING - e_column_start = lv_column_start " Cell Column Start - e_column_end = lv_column_end " Cell Column End - e_row_start = lv_row_start " Cell Row - e_row_end = lv_row_end " Cell Row - e_sheet = lv_sheet " Title - ). - - zcl_excel_common=>assert_equals( - act = lv_column_start - exp = 'B' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_column_end - exp = 'D' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_start - exp = '6' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_end - exp = '13' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_sheet - exp = 'Sheet 1' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). -* c) sheetname existing - does not start with ' example Sheet1!$B$6:$D$13 - lv_range = `Sheet1!B6:$D$13`. - zcl_excel_common=>convert_range2column_a_row( - EXPORTING - i_range = lv_range - IMPORTING - e_column_start = lv_column_start " Cell Column Start - e_column_end = lv_column_end " Cell Column End - e_row_start = lv_row_start " Cell Row - e_row_end = lv_row_end " Cell Row - e_sheet = lv_sheet " Title - ). - - zcl_excel_common=>assert_equals( - act = lv_column_start - exp = 'B' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_column_end - exp = 'D' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_start - exp = '6' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_end - exp = '13' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_sheet - exp = 'Sheet1' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). -* d) no sheetname - just area example $B$6:$D$13 - lv_range = `$B$6:D13`. - zcl_excel_common=>convert_range2column_a_row( - EXPORTING - i_range = lv_range - IMPORTING - e_column_start = lv_column_start " Cell Column Start - e_column_end = lv_column_end " Cell Column End - e_row_start = lv_row_start " Cell Row - e_row_end = lv_row_end " Cell Row - e_sheet = lv_sheet " Title - ). - - zcl_excel_common=>assert_equals( - act = lv_column_start - exp = 'B' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_column_end - exp = 'D' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_start - exp = '6' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_row_end - exp = '13' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - zcl_excel_common=>assert_equals( - act = lv_sheet - exp = '' - msg = 'Conversion of range failed' - level = if_aunit_constants=>critical ). - ENDMETHOD. "convert_range2column_a_row - - - METHOD describe_structure. - DATA: ls_test TYPE scarr. - DATA: lo_structdescr TYPE REF TO cl_abap_structdescr. - DATA: lt_structure TYPE ddfields. - FIELD-SYMBOLS: <line> LIKE LINE OF lt_structure. - - " Test with DDIC Type - lo_structdescr ?= cl_abap_structdescr=>describe_by_data( p_data = ls_test ). - lt_structure = zcl_excel_common=>describe_structure( io_struct = lo_structdescr ). - READ TABLE lt_structure ASSIGNING <line> INDEX 1. - zcl_excel_common=>assert_equals( - act = <line>-fieldname - exp = 'MANDT' - msg = 'Describe structure failed' - level = if_aunit_constants=>critical ). - - " Test with local defined structure having DDIC and non DDIC elements - TYPES: - BEGIN OF t_test, - carrid TYPE s_carr_id, - carrname TYPE s_carrname, - carrdesc TYPE string, - END OF t_test. - DATA: ls_ttest TYPE t_test. - - lo_structdescr ?= cl_abap_structdescr=>describe_by_data( p_data = ls_ttest ). - lt_structure = zcl_excel_common=>describe_structure( io_struct = lo_structdescr ). - READ TABLE lt_structure ASSIGNING <line> INDEX 1. - zcl_excel_common=>assert_equals( - act = <line>-fieldname - exp = 'CARRID' - msg = 'Describe structure failed' - level = if_aunit_constants=>critical ). - - ENDMETHOD. "describe_structure - - - METHOD calculate_cell_distance. - DATA: lv_offset_rows TYPE i, - lv_offset_cols TYPE i, - lv_message TYPE string. - - DEFINE macro_calculate_cell_distance. - zcl_excel_common=>calculate_cell_distance( exporting iv_reference_cell = &1 - iv_current_cell = &2 - importing ev_row_difference = lv_offset_rows - ev_col_difference = lv_offset_cols ). -* Check delta columns - concatenate 'Error calculating column difference in test:' - &1 - '->' - &2 - into lv_message separated by space. - zcl_excel_common=>assert_equals( act = lv_offset_cols - exp = &3 - msg = lv_message - quit = 0 " continue tests - level = if_aunit_constants=>critical ). -* Check delta rows - concatenate 'Error calculating row difference in test:' - &1 - '->' - &2 - into lv_message separated by space. - zcl_excel_common=>assert_equals( act = lv_offset_rows - exp = &4 - msg = lv_message - quit = 0 " continue tests - level = if_aunit_constants=>critical ). - END-OF-DEFINITION. - - - macro_calculate_cell_distance: - 'C12' 'C12' 0 0 , " Same cell - 'C12' 'C13' 0 1 , " Shift down 1 place - 'C12' 'C25' 0 13 , " Shift down some places - 'C12' 'C11' 0 -1 , " Shift up 1 place - 'C12' 'C1' 0 -11 , " Shift up some place - 'C12' 'D12' 1 0 , " Shift right 1 place - 'C12' 'AA12' 24 0 , " Shift right some places - 'C12' 'B12' -1 0 , " Shift left 1 place - 'AA12' 'C12' -24 0 , " Shift left some place - 'AA121' 'C12' -24 -109 . " The full package. - - ENDMETHOD. "CALCULATE_CELL_DISTANCE - - METHOD shift_formula. - DATA: lv_resulting_formula TYPE string, - lv_message TYPE string, - lv_counter TYPE num8. - - DEFINE macro_shift_formula. - add 1 to lv_counter. - clear lv_resulting_formula. - try. - lv_resulting_formula = zcl_excel_common=>shift_formula( iv_reference_formula = &1 - iv_shift_cols = &2 - iv_shift_rows = &3 ). - concatenate 'Wrong result in test' - lv_counter - 'shifting formula ' - &1 - into lv_message separated by space. - zcl_excel_common=>assert_equals( act = lv_resulting_formula - exp = &4 - msg = lv_message - quit = 0 " continue tests - level = if_aunit_constants=>critical ). - catch zcx_excel. - concatenate 'Unexpected exception occurred in test' - lv_counter - 'shifting formula ' - &1 - into lv_message separated by space. - zcl_excel_common=>assert_equals( act = lv_resulting_formula - exp = &4 - msg = lv_message - quit = 0 " continue tests - level = if_aunit_constants=>critical ). - endtry. - END-OF-DEFINITION. - -* Test shifts that should result in a valid output - macro_shift_formula: - 'C17' 0 0 'C17', " Very basic check - 'C17' 2 3 'E20', " Check shift right and down - 'C17' -2 -3 'A14', " Check shift left and up - '$C$17' 1 1 '$C$17', " Fixed columns/rows - 'SUM($C17:C$23)+C30' 1 11 'SUM($C28:D$23)+D41', " Operators and Ranges, mixed fixed rows or columns - 'RNGNAME1+C7' -1 -4 'RNGNAME1+B3', " Operators and Rangename - '"Date:"&TEXT(B2)' 1 1 '"Date:"&TEXT(C3)', " String literals and string concatenation - '[TEST6.XLSX]SHEET1!A1' 1 11 '[TEST6.XLSX]SHEET1!B12', " External sheet reference - `X(B13, "KK" ) ` 1 1 `X(C14,"KK")`, " superflous blanks, multi-argument functions, literals in function, unknown functions -* 'SIN((((((B2))))))' 1 1 'SIN((((((C3))))))', " Deep nesting -* 'SIN(SIN(SIN(SIN(E22))))' 0 1 'SIN(SIN(SIN(SIN(E23))))', " Different type of deep nesting - `SIN(SIN(SIN(SIN(E22))))` 0 1 'SIN(SIN(SIN(SIN(E23))))', " same as above - but with string input instead of Char-input - 'HEUTE()' 2 5 'HEUTE()', " Functions w/o arguments, No cellreferences - '"B2"' 2 5 '"B2"', " No cellreferences - '' 2 5 '', " Empty - 'A1+$A1+A$1+$A$1+B2' -1 0 '#REF!+$A1+#REF!+$A$1+A2', " Referencing error , column only , underflow - 'A1+$A1+A$1+$A$1+B2' 0 -1 '#REF!+#REF!+A$1+$A$1+B1', " Referencing error , row only , underflow - 'A1+$A1+A$1+$A$1+B2' -1 -1 '#REF!+#REF!+#REF!+$A$1+A1'. " Referencing error , row and column , underflow - ENDMETHOD. "SHIFT_FORMULA - - METHOD is_cell_in_range. - DATA ep_cell_in_range TYPE abap_bool. - -* Test 1: upper left corner (in range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'B' - ip_row = 2 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_true - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - -* Test 2: lower right corner (in range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'D' - ip_row = 4 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_true - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - -* Test 3: left side (out of range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'A' - ip_row = 3 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_false - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - -* Test 4: upper side (out of range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'C' - ip_row = 1 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_false - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - -* Test 5: right side (out of range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'E' - ip_row = 3 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_false - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - -* Test 6: lower side (out of range) - TRY. - ep_cell_in_range = zcl_excel_common=>is_cell_in_range( - ip_column = 'C' - ip_row = 5 - ip_range = 'B2:D4' ). - - zcl_excel_common=>assert_equals( - act = ep_cell_in_range - exp = abap_false - msg = 'Check cell in range failed' - level = if_aunit_constants=>critical ). - CATCH zcx_excel. - zcl_excel_common=>fail( - msg = 'Unexpected exception' - level = if_aunit_constants=>critical ). - ENDTRY. - ENDMETHOD. - -ENDCLASS. "lcl_Excel_Common_Test - - - - - - - - - - - - - - - - - - ABAP - - - - - - - - - - - - - - - - - - - - method ASSERT_DIFFERS. - DATA: ls_seoclass TYPE seoclass. - -" Let see >=7.02 - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_ABAP_UNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>assert_differs - EXPORTING - exp = exp - act = act - msg = msg - level = level - tol = tol - quit = quit - RECEIVING - assertion_failed = assertion_failed. - ELSE. -" Let see >=7.00 or even lower - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_AUNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>assert_differs - EXPORTING - exp = exp - act = act - msg = msg - level = level - tol = tol - quit = quit - RECEIVING - assertion_failed = assertion_failed. - ELSE. -* We do nothing for now not supported - ENDIF. - ENDIF. -endmethod. - - - - - - - - - - - METHOD assert_equals. - DATA: ls_seoclass TYPE seoclass. - - " Let see >=7.02 - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_ABAP_UNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>assert_equals - EXPORTING - exp = exp - act = act - msg = msg - level = level - tol = tol - quit = quit - ignore_hash_sequence = ignore_hash_sequence - RECEIVING - assertion_failed = assertion_failed. - ELSE. - " Let see >=7.00 or even lower - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_AUNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>assert_equals - EXPORTING - exp = exp - act = act - msg = msg - level = level - tol = tol - quit = quit - ignore_hash_sequence = ignore_hash_sequence - RECEIVING - assertion_failed = assertion_failed. - ELSE. -* We do nothing for now not supported - ENDIF. - ENDIF. -ENDMETHOD. - - - - - - - - METHOD calculate_cell_distance. - - DATA: lv_reference_row TYPE i, - lv_reference_col_alpha TYPE zexcel_cell_column_alpha, - lv_reference_col TYPE i, - lv_current_row TYPE i, - lv_current_col_alpha TYPE zexcel_cell_column_alpha, - lv_current_col TYPE i. - -*--------------------------------------------------------------------* -* Split reference cell into numerical row/column representation -*--------------------------------------------------------------------* - convert_columnrow2column_a_row( EXPORTING - i_columnrow = iv_reference_cell - IMPORTING - e_column = lv_reference_col_alpha - e_row = lv_reference_row ). - lv_reference_col = convert_column2int( lv_reference_col_alpha ). - -*--------------------------------------------------------------------* -* Split current cell into numerical row/column representation -*--------------------------------------------------------------------* - convert_columnrow2column_a_row( EXPORTING - i_columnrow = iv_current_cell - IMPORTING - e_column = lv_current_col_alpha - e_row = lv_current_row ). - lv_current_col = convert_column2int( lv_current_col_alpha ). - -*--------------------------------------------------------------------* -* Calculate row and column difference -* Positive: Current cell below reference cell -* or Current cell right of reference cell -* Negative: Current cell above reference cell -* or Current cell left of reference cell -*--------------------------------------------------------------------* - ev_row_difference = lv_current_row - lv_reference_row. - ev_col_difference = lv_current_col - lv_reference_col. - -ENDMETHOD. - - - - - method CHAR2HEX. - - IF o_conv IS NOT BOUND. - o_conv = cl_abap_conv_out_ce=>create( endian = 'L' - ignore_cerr = abap_true - replacement = '#' ). - ENDIF. - - CALL METHOD o_conv->reset( ). - CALL METHOD o_conv->write( data = i_char ). - r_hex+1 = o_conv->get_buffer( ). " x'65' must be x'0065' - -endmethod. - - - METHOD class_constructor. - c_xlsx_file_filter = 'Excel Workbook (*.xlsx)|*.xlsx|'(005). -ENDMETHOD. - - - - - - METHOD convert_column2alpha. - - DATA: lv_uccpi TYPE i, - lv_text TYPE sychar02, - lv_module TYPE int4, - lv_column TYPE zexcel_cell_column. - - STATICS: sv_prev_in LIKE lv_column, - sv_prev_out LIKE ep_column. - -* Propagate zcx_excel if error occurs " issue #155 - less restrictive typing for ip_column - lv_column = convert_column2int( ip_column ). " issue #155 - less restrictive typing for ip_column - -*--------------------------------------------------------------------* -* Check whether column is in allowed range for EXCEL to handle ( 1-16384 ) -*--------------------------------------------------------------------* - IF lv_column > 16384 - OR lv_column < 1. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Index out of bounds'. - ENDIF. - -*--------------------------------------------------------------------* -* Look up for previous succesfull cached result -*--------------------------------------------------------------------* - IF lv_column = sv_prev_in AND sv_prev_out IS NOT INITIAL. - ep_column = sv_prev_out. - RETURN. - ELSE. - CLEAR sv_prev_out. - sv_prev_in = lv_column. - ENDIF. - -*--------------------------------------------------------------------* -* Build alpha representation of column -*--------------------------------------------------------------------* - WHILE lv_column GT 0. - - lv_module = ( lv_column - 1 ) MOD 26. - lv_uccpi = 65 + lv_module. - - lv_column = ( lv_column - lv_module ) / 26. - - lv_text = cl_abap_conv_in_ce=>uccpi( lv_uccpi ). - CONCATENATE lv_text ep_column INTO ep_column. - - ENDWHILE. - -*--------------------------------------------------------------------* -* Save succesfull output into cache -*--------------------------------------------------------------------* - sv_prev_out = ep_column. - -ENDMETHOD. - - - - - - METHOD convert_column2int. - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-12-29 -* - ... -* changes: renaming variables to naming conventions -* removing unused variables -* removing commented out code that is inactive for more then half a year -* message made to support multilinguality -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* -* issue#246 - error converting lower case column names -* - Stefan Schmoecker, 2012-12-29 -* changes: translating the correct variable to upper dase -* adding missing exception if input is a number -* that is out of bounds -* adding missing exception if input contains -* illegal characters like german umlauts -*--------------------------------------------------------------------* - - DATA: lv_column TYPE zexcel_cell_column_alpha, - lv_column_c TYPE char10, - lv_column_s TYPE string, - lv_errormessage TYPE string, " Can't pass '...'(abc) to exception-class - lv_modulo TYPE i. - - STATICS: sv_prev_in LIKE lv_column_c, - sv_prev_out LIKE ep_column. -*--------------------------------------------------------------------* -* This module tries to identify which column a user wants to access -* Numbers as input are just passed back, anything else will be converted -* using EXCEL nomenclatura A = 1, AA = 27, ..., XFD = 16384 -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* Normalize input ( upper case , no gaps ) -*--------------------------------------------------------------------* - lv_column_c = ip_column. -* TRANSLATE lv_column TO UPPER CASE. " Fix #246 - TRANSLATE lv_column_c TO UPPER CASE. " Fix #246 - CONDENSE lv_column_c NO-GAPS. - IF lv_column_c EQ ''. -* lv_errormessage = 'Unable to interpret input as column'(003). -* RAISE EXCEPTION TYPE zcx_excel -* EXPORTING -* error = lv_errormessage. - MESSAGE e800(zabap2xlsx) INTO lv_errormessage. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - syst_at_raise = syst. - ENDIF. - -*--------------------------------------------------------------------* -* Look up for previous succesfull cached result -*--------------------------------------------------------------------* - IF lv_column_c = sv_prev_in AND sv_prev_out IS NOT INITIAL. - ep_column = sv_prev_out. - RETURN. - ELSE. - CLEAR sv_prev_out. - sv_prev_in = lv_column_c. - ENDIF. - -*--------------------------------------------------------------------* -* If a number gets passed, just convert it to an integer and return -* the converted value -*--------------------------------------------------------------------* - TRY. - IF lv_column_c CO '1234567890 '. " Fix #164 - ep_column = lv_column_c. " Fix #164 -*--------------------------------------------------------------------* -* Maximum column for EXCEL: XFD = 16384 " if anyone has a reference for this information - please add here instead of this comment -*--------------------------------------------------------------------* - IF ep_column > 16384 OR ep_column < 1. - lv_errormessage = 'Index out of bounds'(004). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - EXIT. - ENDIF. - CATCH cx_sy_conversion_no_number. "#EC NO_HANDLER - " Try the character-approach if approach via number has failed - ENDTRY. - -*--------------------------------------------------------------------* -* Raise error if unexpected characters turns up -*--------------------------------------------------------------------* - lv_column_s = lv_column_c. - IF lv_column_s CN sy-abcde. -* lv_errormessage = 'Unable to interpret input as column'(003). -* RAISE EXCEPTION TYPE zcx_excel -* EXPORTING -* error = lv_errormessage. - MESSAGE e800(zabap2xlsx) INTO lv_errormessage. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - syst_at_raise = syst. - ENDIF. - - DO 1 TIMES. "Because of using CHECK -*--------------------------------------------------------------------* -* Interpret input as number to base 26 with A=1, ... Z=26 -* Raise error if unexpected character turns up -*--------------------------------------------------------------------* -* 1st character -*--------------------------------------------------------------------* - lv_column = lv_column_c. - lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+0(1) ) MOD zcl_excel_common=>c_excel_col_module. - IF lv_modulo < 1 OR lv_modulo > 26. -* lv_errormessage = 'Unable to interpret input as column'(003). -* RAISE EXCEPTION TYPE zcx_excel -* EXPORTING -* error = lv_errormessage. - MESSAGE e800(zabap2xlsx) INTO lv_errormessage. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - syst_at_raise = syst. - ENDIF. - ep_column = lv_modulo. " Leftmost digit - -*--------------------------------------------------------------------* -* 2nd character if present -*--------------------------------------------------------------------* - CHECK lv_column+1(1) IS NOT INITIAL. " No need to continue if string ended - lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+1(1) ) MOD zcl_excel_common=>c_excel_col_module. - IF lv_modulo < 1 OR lv_modulo > 26. -* lv_errormessage = 'Unable to interpret input as column'(003). -* RAISE EXCEPTION TYPE zcx_excel -* EXPORTING -* error = lv_errormessage. - MESSAGE e800(zabap2xlsx) INTO lv_errormessage. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - syst_at_raise = syst. - ENDIF. - ep_column = 26 * ep_column + lv_modulo. " if second digit is present first digit is for 26^1 - -*--------------------------------------------------------------------* -* 3rd character if present -*--------------------------------------------------------------------* - CHECK lv_column+2(1) IS NOT INITIAL. " No need to continue if string ended - lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+2(1) ) MOD zcl_excel_common=>c_excel_col_module. - IF lv_modulo < 1 OR lv_modulo > 26. -* lv_errormessage = 'Unable to interpret input as column'(003). -* RAISE EXCEPTION TYPE zcx_excel -* EXPORTING -* error = lv_errormessage. - MESSAGE e800(zabap2xlsx) INTO lv_errormessage. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - syst_at_raise = syst. - ENDIF. - ep_column = 26 * ep_column + lv_modulo. " if third digit is present first digit is for 26^2 and second digit for 26^1 - ENDDO. - -*--------------------------------------------------------------------* -* Maximum column for EXCEL: XFD = 16384 " if anyone has a reference for this information - please add here instead of this comment -*--------------------------------------------------------------------* - IF ep_column > 16384 OR ep_column < 1. - lv_errormessage = 'Index out of bounds'(004). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* Save succesfull output into cache -*--------------------------------------------------------------------* - sv_prev_out = ep_column. - -ENDMETHOD. - - - - - - method CONVERT_COLUMNROW2COLUMN_A_ROW. -*--------------------------------------------------------------------* - "issue #256 - replacing char processing with regex -*--------------------------------------------------------------------* -* Stefan Schmoecker, 2013-08-11 -* Allow input to be CLIKE instead of STRING -*--------------------------------------------------------------------* - - DATA: pane_cell_row_a TYPE string, - lv_columnrow type string. - - lv_columnrow = i_columnrow. " Get rid of trailing blanks - - FIND REGEX '^(\D+)(\d+)$' IN lv_columnrow SUBMATCHES e_column - pane_cell_row_a. - e_row = pane_cell_row_a. - -endmethod. - - - - - - - - - - method CONVERT_RANGE2COLUMN_A_ROW. -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-12-07 -* - ... -* changes: renaming variables to naming conventions -* aligning code -* added exceptionclass -* added errorhandling for invalid range -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* -* issue#241 - error when sheetname contains "!" -* - sheetname should be returned unescaped -* - Stefan Schmoecker, 2012-12-07 -* changes: changed coding to support sheetnames with "!" -* unescaping sheetname -*--------------------------------------------------------------------* -* issue#155 - lessening restrictions of input parameters -* - Stefan Schmoecker, 2012-12-07 -* changes: i_range changed to clike -* e_sheet changed to clike -*--------------------------------------------------------------------* - - DATA: lv_sheet TYPE string, - lv_range TYPE string, - lv_columnrow_start TYPE string, - lv_columnrow_end TYPE string, - lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class - - -*--------------------------------------------------------------------* -* Split input range into sheetname and Area -* 4 cases - a) input empty --> nothing to do -* - b) sheetname existing - starts with ' example 'Sheet 1'!$B$6:$D$13 -* - c) sheetname existing - does not start with ' example Sheet1!$B$6:$D$13 -* - d) no sheetname - just area example $B$6:$D$13 -*--------------------------------------------------------------------* -* Initialize output parameters - CLEAR: e_column_start, - e_column_end, - e_row_start, - e_row_end, - e_sheet. - - IF i_range IS INITIAL. " a) input empty --> nothing to do - EXIT. - - ELSEIF i_range(1) = `'`. " b) sheetname existing - starts with ' - FIND REGEX '\![^\!]*$' IN i_range MATCH OFFSET sy-fdpos. " Find last ! - IF sy-subrc = 0. - lv_sheet = i_range(sy-fdpos). - ADD 1 TO sy-fdpos. - lv_range = i_range. - SHIFT lv_range LEFT BY sy-fdpos PLACES. - ELSE. - lv_errormessage = 'Invalid range'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ELSEIF i_range CS '!'. " c) sheetname existing - does not start with ' - SPLIT i_range AT '!' INTO lv_sheet lv_range. - - ELSE. " d) no sheetname - just area - lv_range = i_range. - ENDIF. - - REPLACE ALL OCCURRENCES OF '$' IN lv_range WITH ''. - SPLIT lv_range AT ':' INTO lv_columnrow_start lv_columnrow_end. - - convert_columnrow2column_a_row( EXPORTING - i_columnrow = lv_columnrow_start - IMPORTING - e_column = e_column_start - e_row = e_row_start ). - convert_columnrow2column_a_row( EXPORTING - i_columnrow = lv_columnrow_end - IMPORTING - e_column = e_column_end - e_row = e_row_end ). - - e_sheet = unescape_string( lv_sheet ). " Return in unescaped form -endmethod. - - - - - method DATE_TO_EXCEL_STRING. - DATA: lv_date_diff TYPE i. - - CHECK ip_value IS NOT INITIAL - AND ip_value <> space. - " Needed hack caused by the problem that: - " Excel 2000 incorrectly assumes that the year 1900 is a leap year - " http://support.microsoft.com/kb/214326/en-us - IF ip_value > c_excel_1900_leap_year. - lv_date_diff = ip_value - c_excel_baseline_date + 2. - ELSE. - lv_date_diff = ip_value - c_excel_baseline_date + 1. - ENDIF. - ep_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_date_diff ). -endmethod. - - - - - method DESCRIBE_STRUCTURE. - DATA: lt_components TYPE abap_component_tab, - lt_comps TYPE abap_component_tab, - lo_struct TYPE REF TO cl_abap_structdescr, - ls_component TYPE abap_componentdescr, - lo_elemdescr TYPE REF TO cl_abap_elemdescr, - ls_dfies TYPE dfies, - l_position TYPE tabfdpos. - - "for DDIC structure get the info directly - IF io_struct->is_ddic_type( ) = abap_true. - rt_dfies = io_struct->get_ddic_field_list( ). - ELSE. - lt_components = io_struct->get_components( ). - - LOOP AT lt_components INTO ls_component. - structure_case( EXPORTING is_component = ls_component - CHANGING xt_components = lt_comps ) . - ENDLOOP. - LOOP AT lt_comps INTO ls_component. - CLEAR ls_dfies. - IF ls_component-type->kind = cl_abap_typedescr=>kind_elem. "E Elementary Type - ADD 1 TO l_position. - lo_elemdescr ?= ls_component-type. - IF lo_elemdescr->is_ddic_type( ) = abap_true. - ls_dfies = lo_elemdescr->get_ddic_field( ). - ls_dfies-fieldname = ls_component-name. - ls_dfies-position = l_position. - ELSE. - ls_dfies-fieldname = ls_component-name. - ls_dfies-position = l_position. - ls_dfies-inttype = lo_elemdescr->type_kind. - ls_dfies-leng = lo_elemdescr->length. - ls_dfies-outputlen = lo_elemdescr->length. - ls_dfies-decimals = lo_elemdescr->decimals. - ls_dfies-fieldtext = ls_component-name. - ls_dfies-reptext = ls_component-name. - ls_dfies-scrtext_s = ls_component-name. - ls_dfies-scrtext_m = ls_component-name. - ls_dfies-scrtext_l = ls_component-name. - ls_dfies-dynpfld = abap_true. - ENDIF. - INSERT ls_dfies INTO TABLE rt_dfies. - ENDIF. - ENDLOOP. - ENDIF. -endmethod. - - - - - - - - METHOD determine_resulting_formula. - - DATA: lv_row_difference TYPE i, - lv_col_difference TYPE i. - -*--------------------------------------------------------------------* -* Calculate distance of reference and current cell -*--------------------------------------------------------------------* - calculate_cell_distance( EXPORTING - iv_reference_cell = iv_reference_cell - iv_current_cell = iv_current_cell - IMPORTING - ev_row_difference = lv_row_difference - ev_col_difference = lv_col_difference ). - -*--------------------------------------------------------------------* -* and shift formula by using the row- and columndistance -*--------------------------------------------------------------------* - ev_resulting_formula = shift_formula( iv_reference_formula = iv_reference_formula - iv_shift_rows = lv_row_difference - iv_shift_cols = lv_col_difference ). - -ENDMETHOD. "determine_resulting_formula - - - - - method ENCRYPT_PASSWORD. - - DATA lv_curr_offset TYPE i. - DATA lv_curr_char TYPE c LENGTH 1. - DATA lv_curr_hex TYPE zexcel_pwd_hash. - DATA lv_pwd_len TYPE zexcel_pwd_hash. - DATA lv_pwd_hash TYPE zexcel_pwd_hash. - - CONSTANTS: - lv_0x7fff TYPE zexcel_pwd_hash VALUE '7FFF', - lv_0x0001 TYPE zexcel_pwd_hash VALUE '0001', - lv_0xce4b TYPE zexcel_pwd_hash VALUE 'CE4B'. - - DATA lv_pwd TYPE zexcel_aes_password. - - lv_pwd = i_pwd(15). - - lv_pwd_len = STRLEN( lv_pwd ). - lv_curr_offset = lv_pwd_len - 1. - - WHILE lv_curr_offset GE 0. - - lv_curr_char = lv_pwd+lv_curr_offset(1). - lv_curr_hex = char2hex( lv_curr_char ). - - lv_pwd_hash = ( shr14( lv_pwd_hash ) BIT-AND lv_0x0001 ) BIT-OR ( shl01( lv_pwd_hash ) BIT-AND lv_0x7fff ). - - lv_pwd_hash = lv_pwd_hash BIT-XOR lv_curr_hex. - SUBTRACT 1 FROM lv_curr_offset. - ENDWHILE. - - lv_pwd_hash = ( shr14( lv_pwd_hash ) BIT-AND lv_0x0001 ) BIT-OR ( shl01( lv_pwd_hash ) BIT-AND lv_0x7fff ). - lv_pwd_hash = lv_pwd_hash BIT-XOR lv_0xce4b. - lv_pwd_hash = lv_pwd_hash BIT-XOR lv_pwd_len. - - WRITE lv_pwd_hash TO r_encrypted_pwd. - -endmethod. - - - - - method ESCAPE_STRING. -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-12-08 -* - ... -* changes: aligning code -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* -* issue#242 - Support escaping for white-spaces -* - Escaping also necessary when ' encountered in input -* - Stefan Schmoecker, 2012-12-08 -* changes: switched check if escaping is necessary to regular expression -* and moved the "REPLACE" -*--------------------------------------------------------------------* -* issue#155 - lessening restrictions of input parameters -* - Stefan Schmoecker, 2012-12-08 -* changes: ip_value changed to clike -*--------------------------------------------------------------------* - DATA: lv_value TYPE string. - -*--------------------------------------------------------------------* -* There exist various situations when a space will be used to separate -* different parts of a string. When we have a string consisting spaces -* that will cause errors unless we "escape" the string by putting ' at -* the beginning and at the end of the string. -*--------------------------------------------------------------------* - - -*--------------------------------------------------------------------* -* When allowing clike-input parameters we might encounter trailing -* "real" blanks . These are automatically eliminated when moving -* the input parameter to a string. -* Now any remaining spaces ( white-spaces or normal spaces ) should -* trigger the escaping as well as any ' -*--------------------------------------------------------------------* - lv_value = ip_value. - - - FIND REGEX `\s|'` IN lv_value. " \s finds regular and white spaces - IF sy-subrc = 0. - REPLACE ALL OCCURRENCES OF `'` IN lv_value WITH `''`. - CONCATENATE `'` lv_value `'` INTO lv_value . - ENDIF. - - ep_escaped_value = lv_value. - -endmethod. - - - - - - method EXCEL_STRING_TO_DATE. - DATA: lv_date_int TYPE i. - - TRY. - lv_date_int = ip_value. - ep_value = lv_date_int + c_excel_baseline_date - 2. - " Needed hack caused by the problem that: - " Excel 2000 incorrectly assumes that the year 1900 is a leap year - " http://support.microsoft.com/kb/214326/en-us - IF ep_value < c_excel_1900_leap_year. - ep_value = ep_value + 1. - ENDIF. - CATCH cx_sy_conversion_error. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Index out of bounds'. - ENDTRY. -endmethod. - - - - - - method EXCEL_STRING_TO_NUMBER. - -* If we encounter anything more complicated in EXCEL we might have to extend this -* But currently this works fine - even for numbers in scientific notation - - ep_value = ip_value. - -endmethod. - - - - - - method EXCEL_STRING_TO_TIME. - DATA: lv_seconds_in_day TYPE i, - lv_day_fraction TYPE f, - lc_seconds_in_day TYPE i VALUE 86400. - - TRY. - - lv_day_fraction = ip_value. - lv_seconds_in_day = lv_day_fraction * lc_seconds_in_day. - - ep_value = lv_seconds_in_day. - - CATCH cx_sy_conversion_error. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unable to interpret time'. - ENDTRY. -endmethod. - - - - - - - method FAIL. - DATA: ls_seoclass TYPE seoclass. - - " Let see >=7.02 - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_ABAP_UNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>fail - EXPORTING - msg = msg - level = level - quit = quit - detail = detail. - ELSE. - " Let see >=7.00 or even lower - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_AUNIT_ASSERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>fail - EXPORTING - msg = msg - level = level - quit = quit - detail = detail. - ELSE. -* We do nothing for now not supported - ENDIF. - ENDIF. - -endmethod. - - - - - METHOD get_fieldcatalog. - DATA: lr_dref_tab TYPE REF TO data, - lo_salv_table TYPE REF TO cl_salv_table, - lo_salv_columns_table TYPE REF TO cl_salv_columns_table, - lt_salv_t_column_ref TYPE salv_t_column_ref, - ls_salv_t_column_ref LIKE LINE OF lt_salv_t_column_ref, - lo_salv_column_table TYPE REF TO cl_salv_column_table. - - FIELD-SYMBOLS: <tab> TYPE STANDARD TABLE. - FIELD-SYMBOLS: <fcat> LIKE LINE OF ep_fieldcatalog. - -* Get copy of IP_TABLE-structure <-- must be changeable to create salv - CREATE DATA lr_dref_tab LIKE ip_table. - ASSIGN lr_dref_tab->* TO <tab>. -* Create salv --> implicitly create fieldcat - TRY. - cl_salv_table=>factory( IMPORTING - r_salv_table = lo_salv_table - CHANGING - t_table = <tab> ). - lo_salv_columns_table = lo_salv_table->get_columns( ). - lt_salv_t_column_ref = lo_salv_columns_table->get( ). - CATCH cx_root. -* maybe some errorhandling here - just haven't made up my mind yet - ENDTRY. - -* Loop through columns and set relevant fields ( fieldname, texts ) - LOOP AT lt_salv_t_column_ref INTO ls_salv_t_column_ref. - - lo_salv_column_table ?= ls_salv_t_column_ref-r_column. - APPEND INITIAL LINE TO ep_fieldcatalog ASSIGNING <fcat>. - <fcat>-position = sy-tabix. - <fcat>-fieldname = ls_salv_t_column_ref-columnname. - <fcat>-scrtext_s = ls_salv_t_column_ref-r_column->get_short_text( ). - <fcat>-scrtext_m = ls_salv_t_column_ref-r_column->get_medium_text( ). - <fcat>-scrtext_l = ls_salv_t_column_ref-r_column->get_long_text( ). - <fcat>-abap_type = lo_salv_column_table->get_ddic_inttype( ). - - <fcat>-dynpfld = 'X'. " What in the world would we exclude here? - IF <fcat>-position = 1. " except for the MANDT-field of most tables ( 1st column that is ) - IF lo_salv_column_table->get_ddic_datatype( ) = 'CLNT'. - CLEAR <fcat>-dynpfld. - ENDIF. - ENDIF. - -* For fields that don't a description ( i.e. defined by "field type i," ) -* just use the fieldname as description - that is better than nothing - IF <fcat>-scrtext_s IS INITIAL - AND <fcat>-scrtext_m IS INITIAL - AND <fcat>-scrtext_l IS INITIAL. - CONCATENATE 'Col:' <fcat>-fieldname INTO <fcat>-scrtext_l SEPARATED BY space. - <fcat>-scrtext_m = <fcat>-scrtext_l. - <fcat>-scrtext_s = <fcat>-scrtext_l. - ENDIF. - - ENDLOOP. - -ENDMETHOD. - - - - - - - - method IS_CELL_IN_RANGE. - DATA lv_column_start TYPE zexcel_cell_column_alpha. - DATA lv_column_end TYPE zexcel_cell_column_alpha. - DATA lv_row_start TYPE zexcel_cell_row. - DATA lv_row_end TYPE zexcel_cell_row. - DATA lv_column_start_i TYPE zexcel_cell_column. - DATA lv_column_end_i TYPE zexcel_cell_column. - DATA lv_column_i TYPE zexcel_cell_column. - - -* Split range and convert columns - convert_range2column_a_row( - exporting - i_range = ip_range - IMPORTING - e_column_start = lv_column_start - e_column_end = lv_column_end - e_row_start = lv_row_start - e_row_end = lv_row_end ). - - lv_column_start_i = convert_column2int( ip_column = lv_column_start ). - lv_column_end_i = convert_column2int( ip_column = lv_column_end ). - - lv_column_i = convert_column2int( ip_column = ip_column ). - -* Check if cell is in range - IF lv_column_i >= lv_column_start_i AND - lv_column_i <= lv_column_end_i AND - ip_row >= lv_row_start AND - ip_row <= lv_row_end. - rp_in_range = abap_true. - ENDIF. -endmethod. - - - - - method NUMBER_TO_EXCEL_STRING. - DATA: lv_value_c TYPE c LENGTH 100. - - WRITE ip_value TO lv_value_c EXPONENT 0 NO-GROUPING NO-SIGN. - REPLACE ALL OCCURRENCES OF ',' IN lv_value_c WITH '.'. - - ep_value = lv_value_c. - CONDENSE ep_value. - - IF ip_value < 0. - CONCATENATE '-' ep_value INTO ep_value. - ELSEIF ip_value EQ 0. - ep_value = '0'. - ENDIF. -endmethod. - - - - - - method RECURSIVE_CLASS_TO_STRUCT. - " # issue 139 -* is working for me - but after looking through this coding I guess -* I'll rewrite this to a version w/o recursion -* This is private an no one using it so far except me, so no need to hurry - DATA: descr TYPE REF TO cl_abap_structdescr, - wa_component LIKE LINE OF descr->components, - attribute_name TYPE fieldname, - flag_class TYPE flag, - o_border TYPE REF TO zcl_excel_style_border. - - FIELD-SYMBOLS: <field> TYPE any, - <fieldx> TYPE any, - <class> TYPE REF TO object, - <attribute> TYPE any. - - - descr ?= cl_abap_structdescr=>describe_by_data( e_target ). - - LOOP AT descr->components INTO wa_component. - -* Assign structure and X-structure - ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <field>. - ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO <fieldx>. -* At least one field in the structure should be marked - otherwise continue with next field - CLEAR flag_class. -* maybe source is just a structure - try assign component... - ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <attribute>. - IF sy-subrc <> 0. -* not - then it is an attribute of the class - use different assign then - CONCATENATE 'i_source->' wa_component-name INTO attribute_name. - ASSIGN (attribute_name) TO <attribute>. - IF sy-subrc <> 0. - EXIT. - ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - flag_class = abap_true. - ENDIF. - - CASE wa_component-type_kind. - WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursio -* IF flag_class = abap_true. -** Only borders will be passed as unbound references. But since we want to set a value we have to create an instance -* ENDIF. - zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = <attribute> - CHANGING e_target = <field> - e_targetx = <fieldx> ). - WHEN OTHERS. - <field> = <attribute>. - <fieldx> = abap_true. - - ENDCASE. - ENDLOOP. - -endmethod. - - - - - - METHOD recursive_struct_to_class. - " # issue 139 -* is working for me - but after looking through this coding I guess -* I'll rewrite this to a version w/o recursion -* This is private an no one using it so far except me, so no need to hurry - DATA: descr TYPE REF TO cl_abap_structdescr, - wa_component LIKE LINE OF descr->components, - attribute_name TYPE fieldname, - flag_class TYPE flag, - o_border TYPE REF TO zcl_excel_style_border. - - FIELD-SYMBOLS: <field> TYPE any, - <fieldx> TYPE any, - <class> TYPE REF TO object, - <attribute> TYPE any, - <attribute_s> TYPE ANY TABLE. - - - descr ?= cl_abap_structdescr=>describe_by_data( i_source ). - - LOOP AT descr->components INTO wa_component. - -* Assign structure and X-structure - ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <field>. - ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO <fieldx>. -* At least one field in the structure should be marked - otherwise continue with next field - CHECK <fieldx> CA abap_true. - CLEAR flag_class. -* maybe target is just a structure - try assign component... - ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <attribute>. - IF sy-subrc <> 0. -* not - then it is an attribute of the class - use different assign then - CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. - ASSIGN (attribute_name) TO <attribute>. - IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - flag_class = abap_true. - ENDIF. - - CASE wa_component-type_kind. - WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion - " To avoid dump with attribute GRADTYPE of class ZCL_EXCEL_STYLE_FILL - " quick and really dirty fix -> check the attribute name - " Border has to be initialized somewhere else - IF wa_component-name EQ 'GRADTYPE'. - flag_class = abap_false. - ENDIF. - - IF flag_class = abap_true AND <attribute> IS INITIAL. -* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance - CREATE OBJECT o_border. - <attribute> = o_border. - ENDIF. - zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <field> - i_sourcex = <fieldx> - CHANGING e_target = <attribute> ). -* WHEN cl_abap_structdescr=>typekind_struct2. " String -* CHECK <fieldx> = abap_true. " Marked for change -* <attribute_s> = <field>. - WHEN OTHERS. - CHECK <fieldx> = abap_true. " Marked for change - <attribute> = <field>. - - ENDCASE. - ENDLOOP. - -ENDMETHOD. - - - - - - - - METHOD shift_formula. - - CONSTANTS: lcv_operators TYPE string VALUE '+-/*^%=<>&, !', - lcv_letters TYPE string VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$', - lcv_digits TYPE string VALUE '0123456789', - lcv_cell_reference_error TYPE string VALUE '#REF!'. - - DATA: lv_tcnt TYPE i, " Counter variable - lv_tlen TYPE i, " Temp variable length - lv_cnt TYPE i, " Counter variable - lv_cnt2 TYPE i, " Counter variable - lv_offset1 TYPE i, " Character offset - lv_numchars TYPE i, " Number of characters counter - lv_tchar(1) TYPE c, " Temp character - lv_tchar2(1) TYPE c, " Temp character - lv_cur_form(2000) TYPE c, " Formula for current cell - lv_ref_cell_addr TYPE string, " Reference cell address - lv_tcol1 TYPE string, " Temp column letter - lv_tcol2 TYPE string, " Temp column letter - lv_tcoln TYPE i, " Temp column number - lv_trow1 TYPE string, " Temp row number - lv_trow2 TYPE string, " Temp row number - lv_flen TYPE i, " Length of reference formula - lv_tlen2 TYPE i, " Temp variable length - lv_substr1 TYPE string, " Substring variable - lv_abscol TYPE string, " Absolute column symbol - lv_absrow TYPE string, " Absolute row symbol - - lv_errormessage TYPE string. - - FIELD-SYMBOLS: <find_my_include> TYPE ANY. - -*--------------------------------------------------------------------* -* When copying a cell in EXCEL to another cell any inherent formulas -* are copied as well. Cell-references in the formula are being adjusted -* by the distance of the new cell to the original one -*--------------------------------------------------------------------* -* §1 Parse reference formula character by character -* §2 Identify Cell-references -* §3 Shift cell-reference -* §4 Build resulting formula -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* No distance --> Reference = resulting cell/formula -*--------------------------------------------------------------------* - IF iv_shift_cols = 0 - AND iv_shift_rows = 0. - ev_resulting_formula = iv_reference_formula. - EXIT. " done - ENDIF. - - - lv_flen = STRLEN( iv_reference_formula ). - lv_numchars = 1. - -*--------------------------------------------------------------------* -* §1 Parse reference formula character by character -*--------------------------------------------------------------------* - DO lv_flen TIMES. - - CLEAR: lv_tchar, - lv_substr1, - lv_ref_cell_addr. - lv_cnt2 = lv_cnt + 1. - IF lv_cnt2 > lv_flen. - EXIT. " Done - ENDIF. - -*--------------------------------------------------------------------* -* Here we have the current character in the formula -*--------------------------------------------------------------------* - lv_tchar = iv_reference_formula+lv_cnt(1). - -*--------------------------------------------------------------------* -* Operators or opening parenthesis will separate possible cellreferences -*--------------------------------------------------------------------* - IF ( lv_tchar CA lcv_operators - OR lv_tchar CA '(' ) - AND lv_cnt2 = 1. - lv_substr1 = iv_reference_formula+lv_offset1(1). - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_numchars = 1. - CONTINUE. " --> next character in formula can be analyzed - ENDIF. - -*--------------------------------------------------------------------* -* Quoted literal text holds no cell reference --> advance to end of text -*--------------------------------------------------------------------* - IF lv_tchar EQ '"'. - lv_cnt = lv_cnt + 1. - lv_numchars = lv_numchars + 1. - lv_tchar = iv_reference_formula+lv_cnt(1). - WHILE lv_tchar NE '"'. - - lv_cnt = lv_cnt + 1. - lv_numchars = lv_numchars + 1. - lv_tchar = iv_reference_formula+lv_cnt(1). - - ENDWHILE. - lv_cnt2 = lv_cnt + 1. - lv_substr1 = iv_reference_formula+lv_offset1(lv_numchars). - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - IF lv_cnt = lv_flen. - EXIT. - ENDIF. - lv_offset1 = lv_cnt. - lv_numchars = 1. - lv_tchar = iv_reference_formula+lv_cnt(1). - lv_cnt2 = lv_cnt + 1. - CONTINUE. " --> next character in formula can be analyzed - ENDIF. - - -*--------------------------------------------------------------------* -* Operators or parenthesis or last character in formula will separate possible cellreferences -*--------------------------------------------------------------------* - IF lv_tchar CA lcv_operators - OR lv_tchar CA '():' - OR lv_cnt2 = lv_flen. - IF lv_cnt > 0. - lv_substr1 = iv_reference_formula+lv_offset1(lv_numchars). -*--------------------------------------------------------------------* -* Check for text concatenation and functions -*--------------------------------------------------------------------* - IF ( lv_tchar CA lcv_operators AND lv_tchar EQ lv_substr1 ) OR lv_tchar EQ '('. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. " --> next character in formula can be analyzed - ENDIF. - - lv_tlen = lv_cnt2 - lv_offset1. -*--------------------------------------------------------------------* -* Exclude mathematical operators and closing parentheses -*--------------------------------------------------------------------* - IF lv_tchar CA lcv_operators - OR lv_tchar CA ':)'. - IF lv_cnt2 = lv_flen - AND lv_numchars = 1. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. " --> next character in formula can be analyzed - ELSE. - lv_tlen = lv_tlen - 1. - ENDIF. - ENDIF. -*--------------------------------------------------------------------* -* Capture reference cell address -*--------------------------------------------------------------------* - TRY. - MOVE: iv_reference_formula+lv_offset1(lv_tlen) TO lv_ref_cell_addr. "Ref cell address - CATCH cx_root. - lv_errormessage = 'Internal error in Class ZCL_EXCEL_COMMON Method SHIFT_FORMULA Spot 1 '. " Change to messageclass if possible - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDTRY. - -*--------------------------------------------------------------------* -* Split cell address into characters and numbers -*--------------------------------------------------------------------* - CLEAR: lv_tlen, - lv_tcnt, - lv_tcol1, - lv_trow1. - lv_tlen = STRLEN( lv_ref_cell_addr ). - IF lv_tlen <> 0. - CLEAR: lv_tcnt. - DO lv_tlen TIMES. - CLEAR: lv_tchar2. - lv_tchar2 = lv_ref_cell_addr+lv_tcnt(1). - IF lv_tchar2 CA lcv_letters. - CONCATENATE lv_tcol1 lv_tchar2 INTO lv_tcol1. - ELSEIF lv_tchar2 CA lcv_digits. - CONCATENATE lv_trow1 lv_tchar2 INTO lv_trow1. - ENDIF. - lv_tcnt = lv_tcnt + 1. - ENDDO. - ENDIF. -*--------------------------------------------------------------------* -* Check for invalid cell address -*--------------------------------------------------------------------* - IF lv_tcol1 IS INITIAL OR lv_trow1 IS INITIAL. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. - ENDIF. -*--------------------------------------------------------------------* -* Check for range names -*--------------------------------------------------------------------* - CLEAR: lv_tlen. - lv_tlen = STRLEN( lv_tcol1 ). - IF lv_tlen GT 3. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. - ENDIF. -*--------------------------------------------------------------------* -* Check for valid row -*--------------------------------------------------------------------* - IF lv_trow1 GT 1048576. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. - ENDIF. -*--------------------------------------------------------------------* -* Check for absolute column or row reference -*--------------------------------------------------------------------* - CLEAR: lv_tcol2, - lv_trow2, - lv_abscol, - lv_absrow. - lv_tlen2 = STRLEN( lv_tcol1 ) - 1. - IF lv_tcol1 IS NOT INITIAL. - lv_abscol = lv_tcol1(1). - ENDIF. - IF lv_tlen2 GE 0. - lv_absrow = lv_tcol1+lv_tlen2(1). - ENDIF. - IF lv_abscol EQ '$' AND lv_absrow EQ '$'. - lv_tlen2 = lv_tlen2 - 1. - IF lv_tlen2 > 0. - lv_tcol1 = lv_tcol1+1(lv_tlen2). - ENDIF. - lv_tlen2 = lv_tlen2 + 1. - ELSEIF lv_abscol EQ '$'. - lv_tcol1 = lv_tcol1+1(lv_tlen2). - ELSEIF lv_absrow EQ '$'. - lv_tcol1 = lv_tcol1(lv_tlen2). - ENDIF. -*--------------------------------------------------------------------* -* Check for valid column -*--------------------------------------------------------------------* - TRY. - lv_tcoln = zcl_excel_common=>convert_column2int( lv_tcol1 ) + iv_shift_cols. - CATCH zcx_excel. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. - ENDTRY. -*--------------------------------------------------------------------* -* Check whether there is a referencing problem -*--------------------------------------------------------------------* - lv_trow2 = lv_trow1 + iv_shift_rows. - IF ( lv_tcoln < 1 AND lv_abscol <> '$' ) " Maybe we should add here max-column and max row-tests as well. - OR ( lv_trow2 < 1 AND lv_absrow <> '$' ). " Check how EXCEL behaves in this case -*--------------------------------------------------------------------* -* Referencing problem encountered --> set error -*--------------------------------------------------------------------* - CONCATENATE lv_cur_form lcv_cell_reference_error INTO lv_cur_form. - ELSE. -*--------------------------------------------------------------------* -* No referencing problems --> adjust row and column -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* Adjust column -*--------------------------------------------------------------------* - IF lv_abscol EQ '$'. - CONCATENATE lv_cur_form lv_abscol lv_tcol1 INTO lv_cur_form. - ELSEIF iv_shift_cols EQ 0. - CONCATENATE lv_cur_form lv_tcol1 INTO lv_cur_form. - ELSE. - TRY. - lv_tcol2 = zcl_excel_common=>convert_column2alpha( lv_tcoln ). - CONCATENATE lv_cur_form lv_tcol2 INTO lv_cur_form. - CATCH zcx_excel. - CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. - lv_cnt = lv_cnt + 1. - lv_offset1 = lv_cnt. - lv_cnt2 = lv_cnt + 1. - lv_numchars = 1. - CONTINUE. - ENDTRY. - ENDIF. -*--------------------------------------------------------------------* -* Adjust row -*--------------------------------------------------------------------* - IF lv_absrow EQ '$'. - CONCATENATE lv_cur_form lv_absrow lv_trow1 INTO lv_cur_form. - ELSEIF iv_shift_rows = 0. - CONCATENATE lv_cur_form lv_trow1 INTO lv_cur_form. -* elseif lv_trow2 < 1. -* CONCATENATE lv_cur_form lc_cell_reference_error INTO lv_cur_form. - ELSE. - CONCATENATE lv_cur_form lv_trow2 INTO lv_cur_form. - ENDIF. - ENDIF. - - lv_numchars = 0. - IF lv_tchar CA lcv_operators - OR lv_tchar CA ':)'. - CONCATENATE lv_cur_form lv_tchar INTO lv_cur_form. - ENDIF. - lv_offset1 = lv_cnt2. - ENDIF. - ENDIF. - lv_numchars = lv_numchars + 1. - lv_cnt = lv_cnt + 1. - lv_cnt2 = lv_cnt + 1. - - ENDDO. - - - -*--------------------------------------------------------------------* -* Return resulting formula -*--------------------------------------------------------------------* - IF lv_cur_form IS NOT INITIAL. - MOVE lv_cur_form TO ev_resulting_formula. - ENDIF. - -ENDMETHOD. - - - - - method SHL01. - - DATA: - lv_bit TYPE i, - lv_curr_pos TYPE i VALUE 2, - lv_prev_pos TYPE i VALUE 1. - - DO 15 TIMES. - GET BIT lv_curr_pos OF i_pwd_hash INTO lv_bit. - SET BIT lv_prev_pos OF r_pwd_hash TO lv_bit. - ADD 1 TO lv_curr_pos. - ADD 1 TO lv_prev_pos. - ENDDO. - SET BIT 16 OF r_pwd_hash TO 0. - -endmethod. - - - - - method SHR14. - - DATA: - lv_bit TYPE i, - lv_curr_pos TYPE i, - lv_next_pos TYPE i. - - r_pwd_hash = i_pwd_hash. - - DO 14 TIMES. - lv_curr_pos = 15. - lv_next_pos = 16. - - DO 15 TIMES. - GET BIT lv_curr_pos OF r_pwd_hash INTO lv_bit. - SET BIT lv_next_pos OF r_pwd_hash TO lv_bit. - SUBTRACT 1 FROM lv_curr_pos. - SUBTRACT 1 FROM lv_next_pos. - ENDDO. - SET BIT 1 OF r_pwd_hash TO 0. - ENDDO. - -endmethod. - - - - - - - method SPLIT_FILE. - - DATA: lt_hlp TYPE TABLE OF text255, - ls_hlp TYPE text255. - - DATA: lf_ext(10) TYPE c, - lf_dot_ext(10) TYPE c. - DATA: lf_str TYPE text255, - lf_anz TYPE i, - lf_len TYPE i. -** --------------------------------------------------------------------- - - CLEAR: lt_hlp, - ep_file, - ep_extension, - ep_dotextension. - -** Split the whole file at '.' - SPLIT ip_file AT '.' INTO TABLE lt_hlp. - -** get the extenstion from the last line of table - DESCRIBE TABLE lt_hlp LINES lf_anz. - IF lf_anz <= 1. - ep_file = ip_file. - EXIT. - ENDIF. - - READ TABLE lt_hlp INTO ls_hlp INDEX lf_anz. - ep_extension = ls_hlp. - lf_ext = ls_hlp. - IF NOT lf_ext IS INITIAL. - CONCATENATE '.' lf_ext INTO lf_dot_ext. - ENDIF. - ep_dotextension = lf_dot_ext. - -** get only the filename - lf_len = strlen( ip_file ) - strlen( lf_dot_ext ). - IF lf_len > 0. - ep_file = ip_file(lf_len). - ENDIF. - -endmethod. - - - - - method STRUCTURE_CASE. - DATA: lt_comp_str TYPE abap_component_tab. - - CASE is_component-type->kind. - WHEN cl_abap_typedescr=>kind_elem. "E Elementary Type - INSERT is_component INTO TABLE xt_components. - WHEN cl_abap_typedescr=>kind_table. "T Table - INSERT is_component INTO TABLE xt_components. - WHEN cl_abap_typedescr=>kind_struct. "S Structure - lt_comp_str = structure_recursive( is_component = is_component ). - INSERT LINES OF lt_comp_str INTO TABLE xt_components. - WHEN OTHERS. "cl_abap_typedescr=>kind_ref or cl_abap_typedescr=>kind_class or cl_abap_typedescr=>kind_intf. -* We skip it. for now. - ENDCASE. -endmethod. - - - - - method STRUCTURE_RECURSIVE. - DATA: lo_struct TYPE REF TO cl_abap_structdescr, - lt_components TYPE abap_component_tab, - ls_components TYPE abap_componentdescr. - - REFRESH rt_components. - - lo_struct ?= is_component-type. - lt_components = lo_struct->get_components( ). - - LOOP AT lt_components INTO ls_components. - structure_case( EXPORTING is_component = ls_components - CHANGING xt_components = rt_components ) . - ENDLOOP. - -endmethod. - - - - - method TIME_TO_EXCEL_STRING. - DATA: lv_seconds_in_day TYPE i, - lv_day_fraction TYPE f, - lc_time_baseline TYPE t VALUE '000000', - lc_seconds_in_day TYPE i VALUE 86400. - - lv_seconds_in_day = ip_value - lc_time_baseline. - lv_day_fraction = lv_seconds_in_day / lc_seconds_in_day. - ep_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_day_fraction ). -endmethod. - - - - - - method UNESCAPE_STRING. - - CONSTANTS lcv_regex TYPE string VALUE `^'[^']` & `|` & " Beginning single ' OR - `[^']'$` & `|` & " Trailing single ' OR - `[^']'[^']`. " Single ' somewhere in between - - - DATA: lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class - -*--------------------------------------------------------------------* -* This method is used to extract the "real" string from an escaped string. -* An escaped string can be identified by a beginning ' which must be -* accompanied by a trailing ' -* All '' in between beginning and trailing ' are treated as single ' -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* When allowing clike-input parameters we might encounter trailing -* "real" blanks . These are automatically eliminated when moving -* the input parameter to a string. -*--------------------------------------------------------------------* - ev_unescaped_string = iv_escaped. " Pass through if not escaped - - CHECK ev_unescaped_string IS NOT INITIAL. " Nothing to do if empty - CHECK ev_unescaped_string(1) = `'`. " Nothing to do if not escaped - -*--------------------------------------------------------------------* -* Remove leading and trailing ' -*--------------------------------------------------------------------* - REPLACE REGEX `^'(.*)'$` IN ev_unescaped_string WITH '$1'. - IF sy-subrc <> 0. - lv_errormessage = 'Input not properly escaped - &'(002). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* Any remaining single ' should not be here -*--------------------------------------------------------------------* - FIND REGEX lcv_regex IN ev_unescaped_string. - IF sy-subrc = 0. - lv_errormessage = 'Input not properly escaped - &'(002). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* Replace '' with ' -*--------------------------------------------------------------------* - REPLACE ALL OCCURRENCES OF `''` IN ev_unescaped_string WITH `'`. - - -endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk deleted file mode 100644 index 0958f57..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk +++ /dev/null @@ -1,1769 +0,0 @@ - - - - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - -TYPES: BEGIN OF ts_alv_types, - seoclass TYPE seoclsname, - clsname TYPE seoclsname, - END OF ts_alv_types, - tt_alv_types TYPE HASHED TABLE OF ts_alv_types WITH UNIQUE KEY seoclass. - -TYPES: BEGIN OF ts_sort_values, - fieldname TYPE fieldname, - row_int TYPE zexcel_cell_row, - value TYPE REF TO data, - new TYPE flag, - sort_level TYPE int4, - is_collapsed type flag, - END OF ts_sort_values, - - tt_sort_values TYPE HASHED TABLE OF ts_sort_values WITH UNIQUE KEY fieldname. -TYPES: BEGIN OF ts_subtotal_rows, - row_int TYPE zexcel_cell_row, - row_int_start TYPE zexcel_cell_row, - columnname TYPE fieldname, - END OF ts_subtotal_rows, - - tt_subtotal_rows TYPE HASHED TABLE OF ts_subtotal_rows WITH UNIQUE KEY row_int. - -TYPES: BEGIN OF ts_styles, - type TYPE char1, - alignment TYPE zexcel_alignment, - inttype TYPE inttype, - decimals TYPE int1, - style TYPE REF TO zcl_excel_style, - guid TYPE zexcel_cell_style, - END OF ts_styles, - - tt_styles TYPE HASHED TABLE OF ts_styles WITH UNIQUE KEY type alignment inttype decimals. - -TYPES: BEGIN OF ts_color_styles, - guid_old TYPE zexcel_cell_style, - fontcolor TYPE zexcel_style_color_argb, - fillcolor TYPE zexcel_style_color_argb, - style_new TYPE REF TO zcl_excel_style, - END OF ts_color_styles, - - tt_color_styles TYPE HASHED TABLE OF ts_color_styles WITH UNIQUE KEY guid_old fontcolor fillcolor. - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - ABAP - SLIS - SOI - - - - - - - - - - - - - - - - - - - - - - - - - - - - method ASK_OPTION. - DATA: ls_sval TYPE sval, - lt_sval TYPE STANDARD TABLE OF sval, - l_returncode TYPE string, - lt_fields TYPE ddfields, - ls_fields TYPE dfies. - - FIELD-SYMBOLS: <fs> TYPE ANY. - - rs_option = ws_option. - - CALL FUNCTION 'DDIF_FIELDINFO_GET' - EXPORTING - tabname = 'ZEXCEL_S_CONVERTER_OPTION' -* FIELDNAME = ' ' -* LANGU = sy-langu -* LFIELDNAME = ' ' -* ALL_TYPES = ' ' -* GROUP_NAMES = ' ' -* UCLEN = -* IMPORTING -* X030L_WA = -* DDOBJTYPE = -* DFIES_WA = -* LINES_DESCR = - TABLES - dfies_tab = lt_fields -* FIXED_VALUES = - EXCEPTIONS - not_found = 1 - internal_error = 2 - OTHERS = 3 - . - IF sy-subrc <> 0. -* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO -* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. - ENDIF. - - LOOP AT lt_fields INTO ls_fields. - ASSIGN COMPONENT ls_fields-fieldname OF STRUCTURE ws_option TO <fs>. - IF sy-subrc = 0. - CLEAR ls_sval. - ls_sval-tabname = ls_fields-tabname. - ls_sval-fieldname = ls_fields-fieldname. - ls_sval-value = <fs>. - ls_sval-field_attr = space. - ls_sval-field_obl = space. - ls_sval-comp_code = space. - ls_sval-fieldtext = ls_fields-scrtext_m. - ls_sval-comp_tab = space. - ls_sval-comp_field = space. - ls_sval-novaluehlp = space. - INSERT ls_sval INTO TABLE lt_sval. - ENDIF. - ENDLOOP. - - CALL FUNCTION 'POPUP_GET_VALUES' - EXPORTING -* NO_VALUE_CHECK = space - popup_title = 'Excel creation options'(008) -* START_COLUMN = '5' -* START_ROW = '5' - IMPORTING - returncode = l_returncode - TABLES - fields = lt_sval - EXCEPTIONS - error_in_fields = 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. - ELSE. - IF l_returncode = 'A'. - RAISE EXCEPTION TYPE zcx_excel. - ELSE. - LOOP AT lt_sval INTO ls_sval. - ASSIGN COMPONENT ls_sval-fieldname OF STRUCTURE ws_option TO <fs>. - IF sy-subrc = 0. - <fs> = ls_sval-value. - ENDIF. - ENDLOOP. - set_option( is_option = ws_option ) . - rs_option = ws_option. - ENDIF. - ENDIF. - endmethod. - - - - - method BIND_CELLS. - -* Do we need subtotals with grouping - READ TABLE wt_fieldcatalog TRANSPORTING NO FIELDS WITH KEY is_subtotalled = abap_true. - IF sy-subrc = 0 . - r_freeze_col = loop_subtotal( i_row_int = w_row_int - i_col_int = w_col_int ) . - ELSE. - r_freeze_col = loop_normal( i_row_int = w_row_int - i_col_int = w_col_int ) . - ENDIF. - - endmethod. - - - - - - method BIND_TABLE. - data: lt_field_catalog type zexcel_t_fieldcatalog, - ls_field_catalog type zexcel_s_fieldcatalog, - ls_fcat type zexcel_s_converter_fcat, - lo_col_dim type ref to zcl_excel_worksheet_columndime, - lo_row_dim type ref to zcl_excel_worksheet_rowdimensi, - l_col_int type zexcel_cell_column, - l_col_alpha type zexcel_cell_column_alpha, - ls_settings type zexcel_s_table_settings, - l_line type i. - - field-symbols: <fs_tab> type any table. - - assign wo_data->* to <fs_tab> . - - ls_settings-table_style = i_style_table. - ls_settings-top_left_column = zcl_excel_common=>convert_column2alpha( ip_column = w_col_int ). - ls_settings-top_left_row = w_row_int. - ls_settings-show_row_stripes = ws_layout-is_stripped. - - describe table wt_fieldcatalog lines l_line. - l_line = l_line + 1 + w_col_int. - ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( ip_column = l_line ). - - describe table <fs_tab> lines l_line. - ls_settings-bottom_right_row = l_line + 1 + w_row_int. - sort wt_fieldcatalog by position. - loop at wt_fieldcatalog into ls_fcat. - move-corresponding ls_fcat to ls_field_catalog. - ls_field_catalog-dynpfld = abap_true. - insert ls_field_catalog into table lt_field_catalog. - endloop. - - wo_worksheet->bind_table( - exporting - ip_table = <fs_tab> - it_field_catalog = lt_field_catalog - is_table_settings = ls_settings - importing - es_table_settings = ls_settings - ). - loop at wt_fieldcatalog into ls_fcat. - l_col_int = w_col_int + ls_fcat-position - 1. - l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). -* Freeze panes - if ls_fcat-fix_column = abap_true. - add 1 to r_freeze_col. - endif. -* Now let's check for optimized - if ls_fcat-is_optimized = abap_true. - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_auto_size( ip_auto_size = abap_true ) . - endif. -* Now let's check for visible - if ls_fcat-is_hidden = abap_true. - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_visible( ip_visible = abap_false ) . - endif. - endloop. - - endmethod. - - - method CLASS_CONSTRUCTOR. - DATA: ls_objects TYPE ts_alv_types. - DATA: ls_option TYPE zexcel_s_converter_option, - l_uname TYPE sy-uname. - - GET PARAMETER ID 'ZUS' FIELD l_uname. - IF l_uname IS INITIAL OR l_uname = space. - l_uname = sy-uname. - ENDIF. - -* Object CL_GUI_ALV_GRID - ls_objects-seoclass = 'CL_GUI_ALV_GRID'. - ls_objects-clsname = 'ZCL_EXCEL_CONVERTER_ALV_GRID'. - INSERT ls_objects INTO TABLE wt_objects. - -* Object CL_SALV_TABLE - ls_objects-seoclass = 'CL_SALV_TABLE'. - ls_objects-clsname = 'ZCL_EXCEL_CONVERTER_SALV_TABLE'. - INSERT ls_objects INTO TABLE wt_objects. - -* Object CL_SALV_RESULT - ls_objects-seoclass = 'CL_SALV_EX_RESULT_DATA_TABLE '. - ls_objects-clsname = 'ZCL_EXCEL_CONVERTER_RESULT_EX'. - INSERT ls_objects INTO TABLE wt_objects. -* Object CL_SALV_WD_RESULT - ls_objects-seoclass = 'CL_SALV_WD_RESULT_DATA_TABLE '. - ls_objects-clsname = 'ZCL_EXCEL_CONVERTER_RESULT_WD'. - INSERT ls_objects INTO TABLE wt_objects. - - CONCATENATE 'EXCEL_' sy-uname INTO ws_indx-srtfd. - - IMPORT p1 = ls_option FROM DATABASE indx(xl) TO ws_indx ID ws_indx-srtfd. - - IF sy-subrc = 0. - ws_option = ls_option. - ELSE. - init_option( ) . - ENDIF. - - endmethod. - - - method CLEAN_FIELDCATALOG. - DATA: l_position TYPE int1. - - FIELD-SYMBOLS: <fs_sfcat> TYPE zexcel_s_converter_fcat. - - SORT wt_fieldcatalog BY position col_id. - - CLEAR l_position. - LOOP AT wt_fieldcatalog ASSIGNING <fs_sfcat>. - ADD 1 TO l_position. - <fs_sfcat>-position = l_position. -* Default stype with alignment and format - <fs_sfcat>-style_hdr = get_style( i_type = c_type_hdr - i_alignment = <fs_sfcat>-alignment ). - IF ws_layout-is_stripped = abap_true. - <fs_sfcat>-style_stripped = get_style( i_type = c_type_str - i_alignment = <fs_sfcat>-alignment - i_inttype = <fs_sfcat>-inttype - i_decimals = <fs_sfcat>-decimals ). - ENDIF. - <fs_sfcat>-style_normal = get_style( i_type = c_type_nor - i_alignment = <fs_sfcat>-alignment - i_inttype = <fs_sfcat>-inttype - i_decimals = <fs_sfcat>-decimals ). - <fs_sfcat>-style_subtotal = get_style( i_type = c_type_sub - i_alignment = <fs_sfcat>-alignment - i_inttype = <fs_sfcat>-inttype - i_decimals = <fs_sfcat>-decimals ). - <fs_sfcat>-style_total = get_style( i_type = c_type_tot - i_alignment = <fs_sfcat>-alignment - i_inttype = <fs_sfcat>-inttype - i_decimals = <fs_sfcat>-decimals ). - ENDLOOP. - - endmethod. - - - - - - - - - - - - - method CONVERT. - - IF is_option IS SUPPLIED. - ws_option = is_option. - ENDIF. - - TRY. - execute_converter( EXPORTING io_object = io_alv - it_table = it_table ) . - ENDTRY. - - IF io_worksheet IS SUPPLIED AND io_worksheet IS BOUND. - wo_worksheet = io_worksheet. - ENDIF. - IF co_excel IS SUPPLIED. - IF co_excel IS NOT BOUND. - CREATE OBJECT co_excel. - co_excel->zif_excel_book_properties~creator = sy-uname. - ENDIF. - wo_excel = co_excel. - ENDIF. - -* Move table to data object and clean it up - IF wt_fieldcatalog IS NOT INITIAL. - create_table( ). - ELSE. - wo_data = wo_table . - ENDIF. - - IF wo_excel IS NOT BOUND. - CREATE OBJECT wo_excel. - wo_excel->zif_excel_book_properties~creator = sy-uname. - ENDIF. - IF wo_worksheet IS NOT BOUND. - " Get active sheet - wo_worksheet = wo_excel->get_active_worksheet( ). - wo_worksheet->set_title( ip_title = 'Sheet1'(001) ). - ENDIF. - - IF i_row_int <= 0. - w_row_int = 1. - ELSE. - w_row_int = i_row_int. - ENDIF. - IF i_column_int <= 0. - w_col_int = 1. - ELSE. - w_col_int = i_column_int. - ENDIF. - - create_worksheet( i_table = i_table - i_style_table = i_style_table ) . - - endmethod. - - - - - - method CREATE_COLOR_STYLE. - DATA: ls_styles TYPE ts_styles. - DATA: lo_style TYPE REF TO zcl_excel_style. - - READ TABLE wt_styles INTO ls_styles WITH KEY guid = i_style. - IF sy-subrc = 0. - lo_style = wo_excel->add_new_style( ). -* lo_style->borders = ls_styles-style->borders. -* lo_style->protection = ls_styles-style->protection. - lo_style->font->bold = ls_styles-style->font->bold. - lo_style->alignment->horizontal = ls_styles-style->alignment->horizontal. - lo_style->number_format->format_code = ls_styles-style->number_format->format_code. - - lo_style->font->color-rgb = is_colors-fontcolor. - lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. - lo_style->fill->fgcolor-rgb = is_colors-fillcolor. - - ro_style = lo_style. - ENDIF. - endmethod. - - - - - - - - method CREATE_FORMULAR_SUBTOTAL. - data: l_row_alpha_start type string, - l_row_alpha_end type string, - l_func_num type string. - - l_row_alpha_start = i_row_int_start. - l_row_alpha_end = i_row_int_end. - - l_func_num = get_function_number( i_totals_function = i_totals_function ). - concatenate 'SUBTOTAL(' l_func_num ',' i_column l_row_alpha_start ':' i_column l_row_alpha_end ')' into r_formula. - endmethod. - - - - - - - method CREATE_FORMULAR_TOTAL. - data: l_row_alpha type string, - l_row_e_alpha type string. - - l_row_alpha = w_row_int + 1. - l_row_e_alpha = i_row_int. - - concatenate i_totals_function '(' i_column l_row_alpha ':' i_column l_row_e_alpha ')' into r_formula. - endmethod. - - - - method CREATE_PATH. - DATA: l_sep TYPE c , - l_path TYPE string, - l_return TYPE i . - - CLEAR r_path. - - " Save the file - cl_gui_frontend_services=>get_sapgui_workdir( - CHANGING - sapworkdir = l_path - EXCEPTIONS - get_sapworkdir_failed = 1 - cntl_error = 2 - error_no_gui = 3 - not_supported_by_gui = 4 - ). - IF sy-subrc <> 0. -* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO -* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. - CONCATENATE 'Excel_' w_fcount '.xlsx' INTO r_path. - ELSE. - DO. - ADD 1 TO w_fcount. -*-obtain file separator character--------------------------------------- - CALL METHOD cl_gui_frontend_services=>get_file_separator - CHANGING - file_separator = l_sep - EXCEPTIONS - cntl_error = 1 - error_no_gui = 2 - not_supported_by_gui = 3 - OTHERS = 4. - - IF sy-subrc <> 0. - l_sep = ''. - ENDIF. - - CONCATENATE l_path l_sep 'Excel_' w_fcount '.xlsx' INTO r_path. - - IF cl_gui_frontend_services=>file_exist( file = r_path ) = abap_true. - cl_gui_frontend_services=>file_delete( EXPORTING filename = r_path - CHANGING rc = l_return - EXCEPTIONS OTHERS = 1 ). - IF sy-subrc = 0 . - RETURN. - ENDIF. - ELSE. - RETURN. - ENDIF. - ENDDO. - ENDIF. - - endmethod. - - - - - method CREATE_STYLE_HDR. - data: lo_style type ref to zcl_excel_style. - - lo_style = wo_excel->add_new_style( ). - lo_style->font->bold = abap_true. - lo_style->font->color-rgb = zcl_excel_style_color=>c_white. - lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. - lo_style->fill->fgcolor-rgb = 'FF4F81BD'. - if i_alignment is supplied and i_alignment is not initial. - lo_style->alignment->horizontal = i_alignment. - endif. - ro_style = lo_style . - endmethod. - - - - - - - method CREATE_STYLE_NORMAL. - DATA: lo_style TYPE REF TO zcl_excel_style, - l_format TYPE zexcel_number_format. - - IF i_inttype IS SUPPLIED AND i_inttype IS NOT INITIAL. - l_format = set_cell_format( i_inttype = i_inttype - i_decimals = i_decimals ) . - ENDIF. - IF l_format IS NOT INITIAL OR - ( i_alignment IS SUPPLIED AND i_alignment IS NOT INITIAL ) . - - lo_style = wo_excel->add_new_style( ). - - IF i_alignment IS SUPPLIED AND i_alignment IS NOT INITIAL. - lo_style->alignment->horizontal = i_alignment. - ENDIF. - - IF l_format IS NOT INITIAL. - lo_style->number_format->format_code = l_format. - ENDIF. - - ro_style = lo_style . - - ENDIF. - endmethod. - - - - - - - method CREATE_STYLE_STRIPPED. - data: lo_style type ref to zcl_excel_style. - data: l_format type zexcel_number_format. - - lo_style = wo_excel->add_new_style( ). - lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid. - lo_style->fill->fgcolor-rgb = 'FFDBE5F1'. - if i_alignment is supplied and i_alignment is not initial. - lo_style->alignment->horizontal = i_alignment. - endif. - if i_inttype is supplied and i_inttype is not initial. - l_format = set_cell_format( i_inttype = i_inttype - i_decimals = i_decimals ) . - if l_format is not initial. - lo_style->number_format->format_code = l_format. - endif. - endif. - ro_style = lo_style. - - endmethod. - - - - - - - method CREATE_STYLE_SUBTOTAL. - data: lo_style type ref to zcl_excel_style. - data: l_format type zexcel_number_format. - - lo_style = wo_excel->add_new_style( ). - lo_style->font->bold = abap_true. - - if i_alignment is supplied and i_alignment is not initial. - lo_style->alignment->horizontal = i_alignment. - endif. - if i_inttype is supplied and i_inttype is not initial. - l_format = set_cell_format( i_inttype = i_inttype - i_decimals = i_decimals ) . - if l_format is not initial. - lo_style->number_format->format_code = l_format. - endif. - endif. - - ro_style = lo_style . - - endmethod. - - - - - - - method CREATE_STYLE_TOTAL. - DATA: lo_style TYPE REF TO zcl_excel_style. - DATA: l_format TYPE zexcel_number_format. - - lo_style = wo_excel->add_new_style( ). - lo_style->font->bold = abap_true. - - CREATE OBJECT lo_style->borders->top. - lo_style->borders->top->border_style = zcl_excel_style_border=>c_border_thin. - lo_style->borders->top->border_color-rgb = zcl_excel_style_color=>c_black. - - CREATE OBJECT lo_style->borders->right. - lo_style->borders->right->border_style = zcl_excel_style_border=>c_border_none. - lo_style->borders->right->border_color-rgb = zcl_excel_style_color=>c_black. - - CREATE OBJECT lo_style->borders->down. - lo_style->borders->down->border_style = zcl_excel_style_border=>c_border_double. - lo_style->borders->down->border_color-rgb = zcl_excel_style_color=>c_black. - - CREATE OBJECT lo_style->borders->left. - lo_style->borders->left->border_style = zcl_excel_style_border=>c_border_none. - lo_style->borders->left->border_color-rgb = zcl_excel_style_color=>c_black. - - IF i_alignment IS SUPPLIED AND i_alignment IS NOT INITIAL. - lo_style->alignment->horizontal = i_alignment. - ENDIF. - IF i_inttype IS SUPPLIED AND i_inttype IS NOT INITIAL. - l_format = set_cell_format( i_inttype = i_inttype - i_decimals = i_decimals ) . - IF l_format IS NOT INITIAL. - lo_style->number_format->format_code = l_format. - ENDIF. - ENDIF. - - ro_style = lo_style . - - endmethod. - - - method CREATE_TABLE. - TYPES: BEGIN OF ts_output, - fieldname TYPE fieldname, - function TYPE funcname, - END OF ts_output. - - DATA: lo_data TYPE REF TO data. - DATA: lo_addit TYPE REF TO cl_abap_elemdescr, - lt_components_tab TYPE cl_abap_structdescr=>component_table, - ls_components TYPE abap_componentdescr, - lo_table TYPE REF TO cl_abap_tabledescr, - lo_struc TYPE REF TO cl_abap_structdescr, - lt_fieldcatalog TYPE zexcel_t_converter_fcat. - - FIELD-SYMBOLS: <fs_scat> TYPE zexcel_s_converter_fcat, - <fs_stab> TYPE ANY, - <fs_ttab> TYPE STANDARD TABLE, - <fs> TYPE ANY, - <fs_table> TYPE STANDARD TABLE. - - SORT wt_fieldcatalog BY position. - ASSIGN wo_table->* TO <fs_table>. - - READ TABLE <fs_table> ASSIGNING <fs_stab> INDEX 1. - IF sy-subrc EQ 0 . - LOOP AT wt_fieldcatalog ASSIGNING <fs_scat>. - ASSIGN COMPONENT <fs_scat>-columnname OF STRUCTURE <fs_stab> TO <fs>. - IF sy-subrc = 0. - ls_components-name = <fs_scat>-columnname. - TRY. - lo_addit ?= cl_abap_typedescr=>describe_by_data( <fs> ). - CATCH cx_sy_move_cast_error. - CLEAR lo_addit. - DELETE TABLE wt_fieldcatalog FROM <fs_scat>. - ENDTRY. - IF lo_addit IS BOUND. - ls_components-type = lo_addit . - INSERT ls_components INTO TABLE lt_components_tab. - ENDIF. - ENDIF. - ENDLOOP. - IF lt_components_tab IS NOT INITIAL. - "create new line type - TRY. - lo_struc = cl_abap_structdescr=>create( P_COMPONENTS = lt_components_tab - P_STRICT = abap_false ). - CATCH cx_sy_struct_creation. - RETURN. " We can not do anything in this case. - ENDTRY. - - lo_table = cl_abap_tabledescr=>create( lo_struc ). - - CREATE DATA wo_data TYPE HANDLE lo_table. - CREATE DATA lo_data TYPE HANDLE lo_struc. - - ASSIGN wo_data->* TO <fs_ttab>. - ASSIGN lo_data->* TO <fs_stab>. - LOOP AT <fs_table> ASSIGNING <fs>. - CLEAR <fs_stab>. - MOVE-CORRESPONDING <fs> TO <fs_stab>. - APPEND <fs_stab> TO <fs_ttab>. - ENDLOOP. - ENDIF. - ENDIF. - - endmethod. - - - - - - METHOD create_text_subtotal. - DATA: l_string(256) TYPE c, - l_func TYPE string. - - CASE i_totals_function. - WHEN zcl_excel_table=>totals_function_sum. " Total - l_func = 'Total'(003). - WHEN zcl_excel_table=>totals_function_min. " Minimum - l_func = 'Minimum'(004). - WHEN zcl_excel_table=>totals_function_max. " Maximum - l_func = 'Maximum'(005). - WHEN zcl_excel_table=>totals_function_average. " Mean Value - l_func = 'Average'(006). - WHEN zcl_excel_table=>totals_function_count. " Count - l_func = 'Count'(007). - WHEN OTHERS. - CLEAR l_func. - ENDCASE. - - MOVE i_value TO l_string. - - CONCATENATE l_string l_func INTO r_text SEPARATED BY space. - -ENDMETHOD. - - - - - - method CREATE_WORKSHEET. - DATA: l_freeze_col TYPE i. - DATA: l_guid TYPE oltpguid16. - - IF wo_data IS BOUND AND wo_worksheet IS BOUND. - - wo_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_on. " By default is on - - IF wt_fieldcatalog IS INITIAL. - set_fieldcatalog( ) . - ELSE. - clean_fieldcatalog( ) . - ENDIF. - - IF i_table = abap_true. - l_freeze_col = bind_table( i_style_table = i_style_table ) . - ELSE. -* Let's check for filter. - IF wt_filter IS NOT INITIAL. - wo_autofilter = wo_excel->add_new_autofilter( io_sheet = wo_worksheet ). - l_freeze_col = bind_cells( ) . - set_autofilter_area( ) . - ELSE. - l_freeze_col = bind_cells( ) . - ENDIF. - - ENDIF. - -* Check for freeze panes - IF ws_layout-is_fixed = abap_true. - IF l_freeze_col = 0. - l_freeze_col = w_col_int. - ENDIF. - wo_worksheet->freeze_panes( EXPORTING ip_num_columns = l_freeze_col - ip_num_rows = w_row_int ) . - ENDIF. - ENDIF. - - endmethod. - - - - - - method EXECUTE_CONVERTER. - DATA: lt_fieldcatalog TYPE zexcel_t_fieldcatalog, - ls_fieldcatalog TYPE zexcel_s_converter_fcat, - lo_if TYPE REF TO zif_excel_converter, - ls_types TYPE ts_alv_types, - lo_addit TYPE REF TO cl_abap_classdescr, - lo_addit_superclass type ref to cl_abap_classdescr. - - IF io_object IS BOUND. - TRY. - lo_addit ?= cl_abap_typedescr=>describe_by_object_ref( io_object ). - CATCH cx_sy_move_cast_error. - RAISE EXCEPTION TYPE zcx_excel. - ENDTRY. - ls_types-seoclass = lo_addit->get_relative_name( ). - READ TABLE wt_objects INTO ls_types WITH TABLE KEY seoclass = ls_types-seoclass. - if sy-subrc ne 0. - do. - free lo_addit_superclass. - lo_addit_superclass = lo_addit->get_super_class_type( ). - if lo_addit_superclass is initial. - sy-subrc = '4'. - exit. - endif. - lo_addit = lo_addit_superclass. - ls_types-seoclass = lo_addit->get_relative_name( ). - read table wt_objects into ls_types with table key seoclass = ls_types-seoclass. - if sy-subrc eq 0. - exit. - endif. - enddo. - endif. - if sy-subrc = 0. - CREATE OBJECT lo_if type (ls_types-clsname). - try. - lo_if->create_fieldcatalog( - exporting - is_option = ws_option - io_object = io_object - it_table = it_table - importing - es_layout = ws_layout - et_fieldcatalog = wt_fieldcatalog - eo_table = wo_table - et_colors = wt_colors - et_filter = wt_filter - ). - endtry. -* data lines of highest level. - if ws_layout-max_subtotal_level > 0. add 1 to ws_layout-max_subtotal_level. endif. - else. - RAISE EXCEPTION type zcx_excel. - endif. - else. - refresh wt_fieldcatalog. - get reference of it_table into wo_table. - endif. -endmethod. - - - - - - - method GET_COLOR_STYLE. - DATA: ls_colors TYPE zexcel_s_converter_col, - ls_color_styles TYPE ts_color_styles, - lo_style TYPE REF TO zcl_excel_style. - - r_style = i_style. " Default we change nothing - - IF wt_colors IS NOT INITIAL. -* Full line has color - READ TABLE wt_colors INTO ls_colors WITH KEY rownumber = i_row - columnname = space. - IF sy-subrc = 0. - READ TABLE wt_color_styles INTO ls_color_styles WITH KEY guid_old = i_style - fontcolor = ls_colors-fontcolor - fillcolor = ls_colors-fillcolor. - IF sy-subrc = 0. - r_style = ls_color_styles-style_new->get_guid( ). - ELSE. - lo_style = create_color_style( i_style = i_style - is_colors = ls_colors ) . - r_style = lo_style->get_guid( ) . - ls_color_styles-guid_old = i_style. - ls_color_styles-fontcolor = ls_colors-fontcolor. - ls_color_styles-fillcolor = ls_colors-fillcolor. - ls_color_styles-style_new = lo_style. - INSERT ls_color_styles INTO TABLE wt_color_styles. - ENDIF. - ELSE. -* Only field has color - READ TABLE wt_colors INTO ls_colors WITH KEY rownumber = i_row - columnname = i_fieldname. - IF sy-subrc = 0. - READ TABLE wt_color_styles INTO ls_color_styles WITH KEY guid_old = i_style - fontcolor = ls_colors-fontcolor - fillcolor = ls_colors-fillcolor. - IF sy-subrc = 0. - r_style = ls_color_styles-style_new->get_guid( ). - ELSE. - lo_style = create_color_style( i_style = i_style - is_colors = ls_colors ) . - ls_color_styles-guid_old = i_style. - ls_color_styles-fontcolor = ls_colors-fontcolor. - ls_color_styles-fillcolor = ls_colors-fillcolor. - ls_color_styles-style_new = lo_style. - INSERT ls_color_styles INTO TABLE wt_color_styles. - r_style = ls_color_styles-style_new->get_guid( ). - ENDIF. - ELSE. - r_style = i_style. - ENDIF. - ENDIF. - ELSE. - r_style = i_style. - ENDIF. - - endmethod. - - - - - - method GET_FILE. - data: lo_excel_writer type ref to zif_excel_writer, - lo_excel type ref to zcl_excel. - - data: ls_seoclass type seoclass. - - - if wo_excel is bound. - create object lo_excel_writer type zcl_excel_writer_2007. - e_file = lo_excel_writer->write_file( wo_excel ). - - select single * into ls_seoclass - from seoclass - where clsname = 'CL_BCS_CONVERT'. - - if sy-subrc = 0. - call method (ls_seoclass-clsname)=>xstring_to_solix - exporting - iv_xstring = e_file - receiving - et_solix = et_file. - e_bytecount = xstrlen( e_file ). - else. - " Convert to binary - call function 'SCMS_XSTRING_TO_BINARY' - exporting - buffer = e_file - importing - output_length = e_bytecount - tables - binary_tab = et_file. - endif. - endif. - - endmethod. - - - - - method GET_FUNCTION_NUMBER. -*Number Function -*1 AVERAGE -*2 COUNT -*3 COUNTA -*4 MAX -*5 MIN -*6 PRODUCT -*7 STDEV -*8 STDEVP -*9 SUM -*10 VAR -*11 VARP - - case i_totals_function. - when ZCL_EXCEL_TABLE=>TOTALS_FUNCTION_SUM. " Total - r_function_number = 9. - when ZCL_EXCEL_TABLE=>TOTALS_FUNCTION_MIN. " Minimum - r_function_number = 5. - when ZCL_EXCEL_TABLE=>TOTALS_FUNCTION_MAX. " Maximum - r_function_number = 4. - when ZCL_EXCEL_TABLE=>TOTALS_FUNCTION_AVERAGE. " Mean Value - r_function_number = 1. - when ZCL_EXCEL_TABLE=>TOTALS_FUNCTION_count. " Count - r_function_number = 2. - when others. - clear r_function_number. - endcase. - endmethod. - - - - method GET_OPTION. - - rs_option = ws_option. - - endmethod. - - - - - - - - method GET_STYLE. - DATA: ls_styles TYPE ts_styles, - lo_style TYPE REF TO zcl_excel_style. - - CLEAR r_style. - - READ TABLE wt_styles INTO ls_styles WITH TABLE KEY type = i_type - alignment = i_alignment - inttype = i_inttype - decimals = i_decimals. - IF sy-subrc = 0. - r_style = ls_styles-guid. - ELSE. - CASE i_type. - WHEN c_type_hdr. " Header - lo_style = create_style_hdr( i_alignment = i_alignment ). - WHEN c_type_str. "Stripped - lo_style = create_style_stripped( i_alignment = i_alignment - i_inttype = i_inttype - i_decimals = i_decimals ). - WHEN c_type_nor. "Normal - lo_style = create_style_normal( i_alignment = i_alignment - i_inttype = i_inttype - i_decimals = i_decimals ). - WHEN c_type_sub. "Subtotals - lo_style = create_style_subtotal( i_alignment = i_alignment - i_inttype = i_inttype - i_decimals = i_decimals ). - WHEN c_type_tot. "Totals - lo_style = create_style_total( i_alignment = i_alignment - i_inttype = i_inttype - i_decimals = i_decimals ). - ENDCASE. - IF lo_style IS NOT INITIAL. - r_style = lo_style->get_guid( ). - ls_styles-type = i_type. - ls_styles-alignment = i_alignment. - ls_styles-inttype = i_inttype. - ls_styles-decimals = i_decimals. - ls_styles-guid = r_style. - ls_styles-style = lo_style. - INSERT ls_styles INTO TABLE wt_styles. - ENDIF. - ENDIF. - endmethod. - - - method INIT_OPTION. - - ws_option-filter = abap_true. - ws_option-hidenc = abap_true. - ws_option-subtot = abap_true. - - endmethod. - - - - - - - method LOOP_NORMAL. - DATA: lo_data TYPE REF TO data, - l_row_header TYPE zexcel_cell_row VALUE 2, - l_col_header TYPE zexcel_cell_column_alpha VALUE 'B', - l_row_int_start TYPE zexcel_cell_row, - l_row_int_end TYPE zexcel_cell_row, - l_row_int TYPE zexcel_cell_row, - l_col_int TYPE zexcel_cell_column, - l_col_alpha TYPE zexcel_cell_column_alpha, - l_col_alpha_start TYPE zexcel_cell_column_alpha, - l_cell_value TYPE zexcel_cell_value, - l_s_color TYPE abap_bool, - lo_col_dim TYPE REF TO zcl_excel_worksheet_columndime, - lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi, - l_formula TYPE zexcel_cell_formula, - l_style TYPE zexcel_cell_style, - l_cells TYPE i, - l_count TYPE i, - l_table_row TYPE i. - - FIELD-SYMBOLS: <fs_stab> TYPE ANY, - <fs_tab> TYPE STANDARD TABLE, - <fs_sfcat> TYPE zexcel_s_converter_fcat, - <fs_fldval> TYPE ANY, - <fs_cell_value> TYPE zexcel_cell_value. - - ASSIGN wo_data->* TO <fs_tab> . - - DESCRIBE TABLE wt_fieldcatalog LINES l_cells. - DESCRIBE TABLE <fs_tab> LINES l_count. - l_cells = l_cells * l_count. - -* It is better to loop column by column - LOOP AT wt_fieldcatalog ASSIGNING <fs_sfcat>. - l_row_int = i_row_int. - l_col_int = i_col_int + <fs_sfcat>-position - 1. - -* Freeze panes - IF <fs_sfcat>-fix_column = abap_true. - ADD 1 TO r_freeze_col. - ENDIF. - l_s_color = abap_true. - - l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). - -* Only if the Header is required create it. - IF ws_option-hidehd IS INITIAL. - " First of all write column header - l_cell_value = <fs_sfcat>-scrtext_m. - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = l_cell_value - ip_style = <fs_sfcat>-style_hdr ). - ADD 1 TO l_row_int. - ENDIF. - LOOP AT <fs_tab> ASSIGNING <fs_stab>. - l_table_row = sy-tabix. -* Now the cell values - ASSIGN COMPONENT <fs_sfcat>-columnname OF STRUCTURE <fs_stab> TO <fs_fldval>. -* Now let's write the cell values - IF ws_layout-is_stripped = abap_true AND l_s_color = abap_true. - l_style = get_color_style( i_row = l_table_row - i_fieldname = <fs_sfcat>-columnname - i_style = <fs_sfcat>-style_stripped ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = <fs_fldval> - ip_style = l_style ). - CLEAR l_s_color. - ELSE. - l_style = get_color_style( i_row = l_table_row - i_fieldname = <fs_sfcat>-columnname - i_style = <fs_sfcat>-style_normal ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = <fs_fldval> - ip_style = l_style ). - l_s_color = abap_true. - ENDIF. - READ TABLE wt_filter TRANSPORTING NO FIELDS WITH TABLE KEY rownumber = l_table_row - columnname = <fs_sfcat>-columnname. - IF sy-subrc = 0. - wo_worksheet->get_cell( EXPORTING - ip_column = l_col_alpha - ip_row = l_row_int - IMPORTING - ep_value = l_cell_value ). - wo_autofilter->set_value( i_column = l_col_int - i_value = l_cell_value ). - ENDIF. - ADD 1 TO l_row_int. - ENDLOOP. -* Now let's check for optimized - IF <fs_sfcat>-is_optimized = abap_true . - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_auto_size( ip_auto_size = abap_true ) . - ENDIF. -* Now let's check for visible - IF <fs_sfcat>-is_hidden = abap_true. - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_visible( ip_visible = abap_false ) . - ENDIF. -* Now let's check for total versus subtotal. - IF <fs_sfcat>-totals_function IS NOT INITIAL. - l_row_int_end = l_row_int - 1. - - l_formula = create_formular_total( i_row_int = l_row_int_end - i_column = l_col_alpha - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_formula = l_formula - ip_style = <fs_sfcat>-style_total ). - ENDIF. - ENDLOOP. - endmethod. - - - - - - - method LOOP_SUBTOTAL. - - DATA: lo_data TYPE REF TO data, - l_row_header TYPE zexcel_cell_row VALUE 2, - l_col_header TYPE zexcel_cell_column_alpha VALUE 'B', - l_row_int_start TYPE zexcel_cell_row, - l_row_int_end TYPE zexcel_cell_row, - l_row_int TYPE zexcel_cell_row, - l_col_int TYPE zexcel_cell_column, - l_col_alpha TYPE zexcel_cell_column_alpha, - l_col_alpha_start TYPE zexcel_cell_column_alpha, - l_cell_value TYPE zexcel_cell_value, - l_s_color TYPE abap_bool, - lo_col_dim TYPE REF TO zcl_excel_worksheet_columndime, - lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi, - l_formula TYPE zexcel_cell_formula, - l_style TYPE zexcel_cell_style, - l_subtotalled TYPE flag, - l_text TYPE string, - ls_sort_values TYPE ts_sort_values, - ls_subtotal_rows TYPE ts_subtotal_rows, - l_sort_level TYPE int4, - l_hidden TYPE int4, - l_line TYPE i, - l_guid TYPE guid_22, - l_tabix TYPE sy-tabix, - l_cells TYPE i, - l_count TYPE i, - l_table_row TYPE i, - lt_fcat TYPE zexcel_t_converter_fcat. - - FIELD-SYMBOLS: <fs_stab> TYPE ANY, - <fs_tab> TYPE STANDARD TABLE, - <fs_sfcat> TYPE zexcel_s_converter_fcat, - <fs_fldval> TYPE ANY, - <fs_sortval> TYPE ANY, - <fs_sortv> TYPE ts_sort_values, - <fs_cell_value> TYPE zexcel_cell_value. - - ASSIGN wo_data->* TO <fs_tab> . - - REFRESH: wt_sort_values, - wt_subtotal_rows. - - DESCRIBE TABLE wt_fieldcatalog LINES l_cells. - DESCRIBE TABLE <fs_tab> LINES l_count. - l_cells = l_cells * l_count. - - READ TABLE <fs_tab> ASSIGNING <fs_stab> INDEX 1. - IF sy-subrc = 0. - l_row_int = i_row_int + 1. - lt_fcat = wt_fieldcatalog. - SORT lt_fcat BY sort_level DESCENDING. - LOOP AT lt_fcat ASSIGNING <fs_sfcat> WHERE is_subtotalled = abap_true. - ASSIGN COMPONENT <fs_sfcat>-columnname OF STRUCTURE <fs_stab> TO <fs_fldval>. - ls_sort_values-fieldname = <fs_sfcat>-columnname. - ls_sort_values-row_int = l_row_int. - ls_sort_values-sort_level = <fs_sfcat>-sort_level. - ls_sort_values-is_collapsed = <fs_sfcat>-is_collapsed. - CREATE DATA ls_sort_values-value LIKE <fs_fldval>. - ASSIGN ls_sort_values-value->* TO <fs_sortval>. - <fs_sortval> = <fs_fldval>. - INSERT ls_sort_values INTO TABLE wt_sort_values. - ENDLOOP. - ENDIF. - l_row_int = i_row_int. -* Let's check if we need to hide a sort level. - DESCRIBE TABLE wt_sort_values LINES l_line. - IF l_line <= 1. - CLEAR l_hidden. - ELSE. - LOOP AT wt_sort_values INTO ls_sort_values WHERE is_collapsed = abap_false. - IF l_hidden < ls_sort_values-sort_level. - l_hidden = ls_sort_values-sort_level. - ENDIF. - ENDLOOP. - ENDIF. - ADD 1 TO l_hidden. " As this is the first level we show. -* First loop without formular only addtional rows with subtotal text. - LOOP AT <fs_tab> ASSIGNING <fs_stab>. - ADD 1 TO l_row_int. " 1 is for header row. - l_row_int_start = l_row_int. - SORT lt_fcat BY sort_level DESCENDING. - LOOP AT lt_fcat ASSIGNING <fs_sfcat> WHERE is_subtotalled = abap_true. - l_col_int = i_col_int + <fs_sfcat>-position - 1. - l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). -* Now the cell values - ASSIGN COMPONENT <fs_sfcat>-columnname OF STRUCTURE <fs_stab> TO <fs_fldval>. - IF sy-subrc = 0. - READ TABLE wt_sort_values ASSIGNING <fs_sortv> WITH TABLE KEY fieldname = <fs_sfcat>-columnname. - IF sy-subrc = 0. - ASSIGN <fs_sortv>-value->* TO <fs_sortval>. - IF <fs_sortval> <> <fs_fldval> OR <fs_sortv>-new = abap_true. -* First let's remmember the subtotal values as it has to appear later. - ls_subtotal_rows-row_int = l_row_int. - ls_subtotal_rows-row_int_start = <fs_sortv>-row_int. - ls_subtotal_rows-columnname = <fs_sfcat>-columnname. - INSERT ls_subtotal_rows INTO TABLE wt_subtotal_rows. -* Now let's write the subtotal line - l_cell_value = create_text_subtotal( i_value = <fs_sortval> - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = l_cell_value - ip_abap_type = cl_abap_typedescr=>typekind_string - ip_style = <fs_sfcat>-style_subtotal ). - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_outline_level( ip_outline_level = <fs_sfcat>-sort_level ) . - IF <fs_sfcat>-is_collapsed = abap_true. - IF <fs_sfcat>-sort_level > l_hidden. - lo_row_dim->set_visible( ip_visible = abap_false ) . - ENDIF. - lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ) . - ENDIF. -* Now let's change the key - ADD 1 TO l_row_int. - <fs_sortval> = <fs_fldval>. - <fs_sortv>-new = abap_false. - l_line = <fs_sortv>-sort_level. - LOOP AT wt_sort_values ASSIGNING <fs_sortv> WHERE sort_level >= l_line. - <fs_sortv>-row_int = l_row_int. - ENDLOOP. - ENDIF. - ENDIF. - ENDIF. - ENDLOOP. - ENDLOOP. - ADD 1 TO l_row_int. - l_row_int_start = l_row_int. - SORT lt_fcat BY sort_level DESCENDING. - LOOP AT lt_fcat ASSIGNING <fs_sfcat> WHERE is_subtotalled = abap_true. - l_col_int = i_col_int + <fs_sfcat>-position - 1. - l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). - READ TABLE wt_sort_values ASSIGNING <fs_sortv> WITH TABLE KEY fieldname = <fs_sfcat>-columnname. - IF sy-subrc = 0. - ASSIGN <fs_sortv>-value->* TO <fs_sortval>. - ls_subtotal_rows-row_int = l_row_int. - ls_subtotal_rows-row_int_start = <fs_sortv>-row_int. - ls_subtotal_rows-columnname = <fs_sfcat>-columnname. - INSERT ls_subtotal_rows INTO TABLE wt_subtotal_rows. -* First let's write the value as it has to appear. - l_cell_value = create_text_subtotal( i_value = <fs_sortval> - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = l_cell_value - ip_abap_type = cl_abap_typedescr=>typekind_string - ip_style = <fs_sfcat>-style_subtotal ). - - l_sort_level = <fs_sfcat>-sort_level. - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_outline_level( ip_outline_level = l_sort_level ) . - IF <fs_sfcat>-is_collapsed = abap_true. - IF <fs_sfcat>-sort_level > l_hidden. - lo_row_dim->set_visible( ip_visible = abap_false ) . - ENDIF. - lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ) . - ENDIF. - ADD 1 TO l_row_int. - ENDIF. - ENDLOOP. -* Let's write the Grand total - l_sort_level = 0. - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_outline_level( ip_outline_level = l_sort_level ) . -* lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ) . Not on grand total - - l_text = create_text_subtotal( i_value = 'Grand'(002) - i_totals_function = <fs_sfcat>-totals_function ). - - l_col_alpha_start = zcl_excel_common=>convert_column2alpha( i_col_int ). - wo_worksheet->set_cell( ip_column = l_col_alpha_start - ip_row = l_row_int - ip_value = l_text - ip_abap_type = cl_abap_typedescr=>typekind_string - ip_style = <fs_sfcat>-style_subtotal ). - -* It is better to loop column by column second time around -* Second loop with formular and data. - LOOP AT wt_fieldcatalog ASSIGNING <fs_sfcat>. - l_row_int = i_row_int. - l_col_int = i_col_int + <fs_sfcat>-position - 1. -* Freeze panes - IF <fs_sfcat>-fix_column = abap_true. - ADD 1 TO r_freeze_col. - ENDIF. - l_s_color = abap_true. - l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). - " First of all write column header - l_cell_value = <fs_sfcat>-scrtext_m. - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = l_cell_value - ip_abap_type = cl_abap_typedescr=>typekind_string - ip_style = <fs_sfcat>-style_hdr ). - ADD 1 TO l_row_int. - LOOP AT <fs_tab> ASSIGNING <fs_stab>. - l_table_row = sy-tabix. -* Now the cell values - ASSIGN COMPONENT <fs_sfcat>-columnname OF STRUCTURE <fs_stab> TO <fs_fldval>. -* Let's check for subtotal lines - DO. - READ TABLE wt_subtotal_rows TRANSPORTING NO FIELDS WITH TABLE KEY row_int = l_row_int. - IF sy-subrc = 0. - IF <fs_sfcat>-is_subtotalled = abap_false AND - <fs_sfcat>-totals_function IS NOT INITIAL. - DO. - READ TABLE wt_subtotal_rows INTO ls_subtotal_rows WITH TABLE KEY row_int = l_row_int. - IF sy-subrc = 0. - l_row_int_start = ls_subtotal_rows-row_int_start. - l_row_int_end = l_row_int - 1. - - l_formula = create_formular_subtotal( i_row_int_start = l_row_int_start - i_row_int_end = l_row_int_end - i_column = l_col_alpha - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_formula = l_formula - ip_style = <fs_sfcat>-style_subtotal ). - IF <fs_sfcat>-is_collapsed = abap_true. - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ). - IF <fs_sfcat>-sort_level > l_hidden. - lo_row_dim->set_visible( ip_visible = abap_false ) . - ENDIF. - ENDIF. - ADD 1 TO l_row_int. - ELSE. - EXIT. - ENDIF. - ENDDO. - ELSE. - ADD 1 TO l_row_int. - ENDIF. - ELSE. - EXIT. - ENDIF. - ENDDO. -* Let's set the row dimension values - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_outline_level( ip_outline_level = ws_layout-max_subtotal_level ) . - IF <fs_sfcat>-is_collapsed = abap_true. - lo_row_dim->set_visible( ip_visible = abap_false ) . - lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ) . - ENDIF. -* Now let's write the cell values - IF ws_layout-is_stripped = abap_true AND l_s_color = abap_true. - l_style = get_color_style( i_row = l_table_row - i_fieldname = <fs_sfcat>-columnname - i_style = <fs_sfcat>-style_stripped ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = <fs_fldval> - ip_style = l_style ). - CLEAR l_s_color. - ELSE. - l_style = get_color_style( i_row = l_table_row - i_fieldname = <fs_sfcat>-columnname - i_style = <fs_sfcat>-style_normal ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = <fs_fldval> - ip_style = l_style ). - l_s_color = abap_true. - ENDIF. - READ TABLE wt_filter TRANSPORTING NO FIELDS WITH TABLE KEY rownumber = l_table_row - columnname = <fs_sfcat>-columnname. - IF sy-subrc = 0. - wo_worksheet->get_cell( EXPORTING - ip_column = l_col_alpha - ip_row = l_row_int - IMPORTING - ep_value = l_cell_value ). - wo_autofilter->set_value( i_column = l_col_int - i_value = l_cell_value ). - ENDIF. - ADD 1 TO l_row_int. - ENDLOOP. -* Let's check for subtotal lines - DO. - READ TABLE wt_subtotal_rows TRANSPORTING NO FIELDS WITH TABLE KEY row_int = l_row_int. - IF sy-subrc = 0. - IF <fs_sfcat>-is_subtotalled = abap_false AND - <fs_sfcat>-totals_function IS NOT INITIAL. - DO. - READ TABLE wt_subtotal_rows INTO ls_subtotal_rows WITH TABLE KEY row_int = l_row_int. - IF sy-subrc = 0. - l_row_int_start = ls_subtotal_rows-row_int_start. - l_row_int_end = l_row_int - 1. - - l_formula = create_formular_subtotal( i_row_int_start = l_row_int_start - i_row_int_end = l_row_int_end - i_column = l_col_alpha - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_formula = l_formula - ip_style = <fs_sfcat>-style_subtotal ). - IF <fs_sfcat>-is_collapsed = abap_true. - lo_row_dim = wo_worksheet->get_row_dimension( ip_row = l_row_int ). - lo_row_dim->set_collapsed( ip_collapsed = <fs_sfcat>-is_collapsed ). - ENDIF. - ADD 1 TO l_row_int. - ELSE. - EXIT. - ENDIF. - ENDDO. - ELSE. - ADD 1 TO l_row_int. - ENDIF. - ELSE. - EXIT. - ENDIF. - ENDDO. -* Now let's check for Grand total - IF <fs_sfcat>-is_subtotalled = abap_false AND - <fs_sfcat>-totals_function IS NOT INITIAL. - l_row_int_start = i_row_int + 1. - l_row_int_end = l_row_int - 1. - - l_formula = create_formular_subtotal( i_row_int_start = l_row_int_start - i_row_int_end = l_row_int_end - i_column = l_col_alpha - i_totals_function = <fs_sfcat>-totals_function ). - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_formula = l_formula - ip_style = <fs_sfcat>-style_subtotal ). - ENDIF. -* Now let's check for optimized - IF <fs_sfcat>-is_optimized = abap_true. - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_auto_size( ip_auto_size = abap_true ) . - ENDIF. -* Now let's check for visible - IF <fs_sfcat>-is_hidden = abap_true. - lo_col_dim = wo_worksheet->get_column_dimension( ip_column = l_col_alpha ). - lo_col_dim->set_visible( ip_visible = abap_false ) . - ENDIF. - ENDLOOP. - - endmethod. - - - method OPEN_FILE. - data: l_bytecount type i, - lt_file type solix_tab, - l_dir type string, - l_sep type c. - - field-symbols: <fs_data> type any table. - - assign wo_data->* to <fs_data>. - -* catch zcx_excel . -*endtry. - if wo_excel is bound. - get_file( importing e_bytecount = l_bytecount - et_file = lt_file ) . - - l_dir = create_path( ) . - - cl_gui_frontend_services=>gui_download( exporting bin_filesize = l_bytecount - filename = l_dir - filetype = 'BIN' - changing data_tab = lt_file ). - cl_gui_frontend_services=>execute( - exporting - document = l_dir -* application = -* parameter = -* default_directory = -* maximized = -* minimized = -* synchronous = -* operation = 'OPEN' - exceptions - cntl_error = 1 - error_no_gui = 2 - bad_parameter = 3 - file_not_found = 4 - path_not_found = 5 - file_extension_unknown = 6 - error_execute_failed = 7 - synchronous_failed = 8 - not_supported_by_gui = 9 - ). - if sy-subrc <> 0. - message id sy-msgid type sy-msgty number sy-msgno - with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. - endif. - - endif. - - - endmethod. - - - method SET_AUTOFILTER_AREA. - DATA: ls_area TYPE zexcel_s_autofilter_area, - l_lines TYPE i, - lt_values TYPE zexcel_t_autofilter_values, - ls_values TYPE zexcel_s_autofilter_values. - -* Let's check for filter. - IF wo_autofilter IS BOUND. - ls_area-row_start = 1. - lt_values = wo_autofilter->get_values( ) . - SORT lt_values BY column ASCENDING. - DESCRIBE TABLE lt_values LINES l_lines. - READ TABLE lt_values INTO ls_values INDEX 1. - IF sy-subrc = 0. - ls_area-col_start = ls_values-column. - ENDIF. - READ TABLE lt_values INTO ls_values INDEX l_lines. - IF sy-subrc = 0. - ls_area-col_end = ls_values-column. - ENDIF. - wo_autofilter->set_filter_area( is_area = ls_area ) . - ENDIF. - - endmethod. - - - - - - method SET_CELL_FORMAT. - DATA: l_format TYPE zexcel_number_format. - - CLEAR r_format. - CASE i_inttype. - WHEN cl_abap_typedescr=>typekind_date. - r_format = wo_worksheet->get_default_excel_date_format( ). - WHEN cl_abap_typedescr=>typekind_time. - r_format = wo_worksheet->get_default_excel_time_format( ). - WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed. - IF i_decimals > 0 . - l_format = '#,##0.'. - DO i_decimals TIMES. - CONCATENATE l_format '0' INTO l_format. - ENDDO. - r_format = l_format. - ENDIF. - WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2. - r_format = '#,##0'. - ENDCASE. - - endmethod. - - - method SET_FIELDCATALOG. - - DATA: lr_data TYPE REF TO data, - lo_structdescr TYPE REF TO cl_abap_structdescr, - lt_dfies TYPE ddfields, - ls_dfies TYPE dfies, - ls_fieldcatalog TYPE zexcel_s_fieldcatalog. - DATA: ls_fcat TYPE zexcel_s_converter_fcat. - - FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE. - - ASSIGN wo_data->* TO <fs_tab> . - - CREATE DATA lr_data LIKE LINE OF <fs_tab>. - - lo_structdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ). - - lt_dfies = zcl_excel_common=>describe_structure( io_struct = lo_structdescr ). - - LOOP AT lt_dfies INTO ls_dfies. - MOVE-CORRESPONDING ls_dfies TO ls_fcat. - ls_fcat-columnname = ls_dfies-fieldname. - INSERT ls_fcat INTO TABLE wt_fieldcatalog. - ENDLOOP. - - clean_fieldcatalog( ). - - endmethod. - - - - method SET_OPTION. - - IF ws_indx-begdt IS INITIAL. - ws_indx-begdt = sy-datum. - ENDIF. - - ws_indx-aedat = sy-datum. - ws_indx-usera = sy-uname. - ws_indx-pgmid = sy-cprog. - - EXPORT p1 = is_option TO DATABASE indx(xl) FROM ws_indx ID ws_indx-srtfd. - - IF sy-subrc = 0. - ws_option = is_option. - ENDIF. - - endmethod. - - - - method WRITE_FILE. - data: l_bytecount type i, - lt_file type solix_tab, - l_dir type string. - - field-symbols: <fs_data> type any table. - - assign wo_data->* to <fs_data>. - -* catch zcx_excel . -*endtry. - if wo_excel is bound. - get_file( importing e_bytecount = l_bytecount - et_file = lt_file ) . - if i_path is initial. - l_dir = create_path( ) . - else. - l_dir = i_path. - endif. - cl_gui_frontend_services=>gui_download( exporting bin_filesize = l_bytecount - filename = l_dir - filetype = 'BIN' - changing data_tab = lt_file ). - endif. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk deleted file mode 100644 index 0cb1366..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk +++ /dev/null @@ -1,595 +0,0 @@ - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature -TYPES: BEGIN OF ts_col_converter, - col TYPE lvc_col, - int TYPE lvc_int, - inv TYPE lvc_inv, - fontcolor TYPE zexcel_style_color_argb, - fillcolor TYPE zexcel_style_color_argb, - END OF ts_col_converter, - - tt_col_converter TYPE HASHED TABLE OF ts_col_converter WITH UNIQUE KEY col int inv. - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - ABAP - KKBLO - - - - - - - - - - method APPLY_SORT. - DATA: lt_otab TYPE abap_sortorder_tab, - ls_otab TYPE abap_sortorder. - - FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE, - <fs_sort> TYPE lvc_s_sort. - - CREATE DATA eo_table LIKE it_table. - ASSIGN eo_table->* TO <fs_table>. - - <fs_table> = it_table. - - SORT wt_sort BY spos. - LOOP AT wt_sort ASSIGNING <fs_sort>. - IF <fs_sort>-up = abap_true. - ls_otab-name = <fs_sort>-fieldname. - ls_otab-descending = abap_false. -* ls_otab-astext = abap_true. " not only text fields - INSERT ls_otab INTO TABLE lt_otab. - ENDIF. - IF <fs_sort>-down = abap_true. - ls_otab-name = <fs_sort>-fieldname. - ls_otab-descending = abap_true. -* ls_otab-astext = abap_true. " not only text fields - INSERT ls_otab INTO TABLE lt_otab. - ENDIF. - ENDLOOP. - IF lt_otab IS NOT INITIAL. - SORT <fs_table> BY (lt_otab). - ENDIF. - - endmethod. - - - method CLASS_CONSTRUCTOR. -* let's fill the color conversion routines. - DATA: ls_color TYPE ts_col_converter. -* 0 all combination the same - ls_color-col = 0. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 0. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 0. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 0. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - -* Blue - ls_color-col = 1. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFB0E4FC'. " 176 228 252 blue - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 1. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFB0E4FC'. " 176 228 252 blue - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 1. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FF5FCBFE'. " 095 203 254 Int blue - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 1. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FF5FCBFE'. " 095 203 254 - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 - INSERT ls_color INTO TABLE wt_colors. - -* Gray - ls_color-col = 2. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. - ls_color-fillcolor = 'FFE5EAF0'. " 229 234 240 gray - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 2. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFE5EAF0'. " 229 234 240 gray - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 2. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFD8E8F4'. " 216 234 244 int gray - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 2. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FFD8E8F4'. " 216 234 244 int gray - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - -*Yellow - ls_color-col = 3. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFEFEB8'. " 254 254 184 yellow - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 3. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFFEFEB8'. " 254 254 184 yellow - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 3. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFF9ED5D'. " 249 237 093 int yellow - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 3. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FFF9ED5D'. " 249 237 093 int yellow - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - -* light blue - ls_color-col = 4. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFCEE7FB'. " 206 231 251 light blue - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 4. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFCEE7FB'. " 206 231 251 light blue - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 4. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FF9ACCEF'. " 154 204 239 int light blue - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 4. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FF9ACCEF'. " 154 204 239 int light blue - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - -* Green - ls_color-col = 5. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFCEF8AE'. " 206 248 174 Green - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 5. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFCEF8AE'. " 206 248 174 Green - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 5. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FF7AC769'. " 122 199 105 int Green - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 5. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FF7AC769'. " 122 199 105 int Green - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - -* Red - ls_color-col = 6. - ls_color-int = 0. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFDBBBC'. " 253 187 188 Red - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 6. - ls_color-int = 0. - ls_color-inv = 1. - ls_color-fontcolor = 'FFFDBBBC'. " 253 187 188 Red - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 6. - ls_color-int = 1. - ls_color-inv = 0. - ls_color-fontcolor = 'FF000000'. " 000 000 000 Black - ls_color-fillcolor = 'FFFB6B6B'. " 251 107 107 int Red - INSERT ls_color INTO TABLE wt_colors. - - ls_color-col = 6. - ls_color-int = 1. - ls_color-inv = 1. - ls_color-fontcolor = 'FFFB6B6B'. " 251 107 107 int Red - ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White - INSERT ls_color INTO TABLE wt_colors. - - endmethod. - - - - - method GET_COLOR. - DATA: ls_con_col TYPE zexcel_s_converter_col, - ls_color TYPE ts_col_converter, - l_line TYPE i, - l_color(4) TYPE c. - FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE, - <fs_stab> TYPE ANY, - <fs> TYPE ANY, - <fs_tcol> TYPE lvc_t_scol, - <fs_scol> TYPE lvc_s_scol, - <ft_slis> type standard table, - <fs_slis> type any. - -* Loop trough the table to set the color properties of each line. The color properties field is -* Char 4 and the characters is set as follows: -* Char 1 = C = This is a color property -* Char 2 = 6 = Color code (1 - 7) -* Char 3 = Intensified on/of = 1 = on -* Char 4 = Inverse display = 0 = of - - ASSIGN io_table->* TO <fs_tab>. - - IF ws_layo-info_fname IS NOT INITIAL OR - ws_layo-ctab_fname IS NOT INITIAL. - LOOP AT <fs_tab> ASSIGNING <fs_stab>. - l_line = sy-tabix. - IF ws_layo-info_fname IS NOT INITIAL. - ASSIGN COMPONENT ws_layo-info_fname OF STRUCTURE <fs_stab> TO <fs>. - IF sy-subrc = 0. - IF <fs> IS NOT INITIAL. - l_color = <fs>. - IF l_color(1) = 'C'. - READ TABLE wt_colors INTO ls_color WITH TABLE KEY col = l_color+1(1) - int = l_color+2(1) - inv = l_color+3(1). - IF sy-subrc = 0. - ls_con_col-rownumber = l_line. - ls_con_col-columnname = space. - ls_con_col-fontcolor = ls_color-fontcolor. - ls_con_col-fillcolor = ls_color-fillcolor. - INSERT ls_con_col INTO TABLE et_colors. - ENDIF. - ENDIF. - ENDIF. - ENDIF. - ENDIF. - if ws_layo-ctab_fname is not initial. - - assign component ws_layo-ctab_fname of structure <fs_stab> to <ft_slis>. - if sy-subrc = 0. - loop at <ft_slis> assigning <fs_slis>. - assign component 'COLOR' of structure <fs_slis> to <fs>. - if sy-subrc = 0. - if <fs> is not initial. - field-symbols: <col> type any, - <int> type any, - <inv> type any, - <fname> type any, - <nokeycol> type any. - assign component 'COL' of structure <fs> to <col>. - assign component 'INT' of structure <fs> to <int>. - assign component 'INV' of structure <fs> to <inv>. - read table wt_colors into ls_color with table key col = <col> - int = <int> - inv = <inv>. - if sy-subrc = 0. - ls_con_col-rownumber = l_line. - assign component 'FNAME' of structure <fs_slis> to <fname>. - if sy-subrc ne 0. - assign component 'FIELDNAME' of structure <fs_slis> to <fname>. - if sy-subrc eq 0. - ls_con_col-columnname = <fname>. - endif. - else. - ls_con_col-columnname = <fname>. - endif. - - ls_con_col-fontcolor = ls_color-fontcolor. - ls_con_col-fillcolor = ls_color-fillcolor. - assign component 'NOKEYCOL' of structure <fs_slis> to <nokeycol>. - if sy-subrc eq 0. - ls_con_col-nokeycol = <nokeycol>. - endif. - insert ls_con_col into table et_colors. - endif. - endif. - endif. - endloop. - endif. - endif. - ENDLOOP. - ENDIF. - endmethod. - - - - - METHOD get_filter. - DATA: ls_filt TYPE lvc_s_filt, - l_line TYPE i, - ls_filter TYPE zexcel_s_converter_fil. - DATA: lo_addit TYPE REF TO cl_abap_elemdescr, - lt_components_tab TYPE cl_abap_structdescr=>component_table, - ls_components TYPE abap_componentdescr, - lo_table TYPE REF TO cl_abap_tabledescr, - lo_struc TYPE REF TO cl_abap_structdescr, - lo_trange TYPE REF TO data, - lo_srange TYPE REF TO data, - lo_ltabdata TYPE REF TO data. - - FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE, - <fs_ltab> TYPE STANDARD TABLE, - <fs_stab> TYPE any, - <fs> TYPE any, - <fs1> TYPE any, - <fs_srange> TYPE any, - <fs_trange> TYPE STANDARD TABLE. - - IF ws_option-filter = abap_false. - REFRESH et_filter. - RETURN. - ENDIF. - - ASSIGN xo_table->* TO <fs_tab>. - - CREATE DATA lo_ltabdata LIKE <fs_tab>. - ASSIGN lo_ltabdata->* TO <fs_ltab>. - - LOOP AT wt_filt INTO ls_filt. - LOOP AT <fs_tab> ASSIGNING <fs_stab>. - l_line = sy-tabix. - ASSIGN COMPONENT ls_filt-fieldname OF STRUCTURE <fs_stab> TO <fs>. - IF sy-subrc = 0. - IF l_line = 1. - REFRESH lt_components_tab. - ls_components-name = 'SIGN'. - lo_addit ?= cl_abap_typedescr=>describe_by_data( ls_filt-sign ). - ls_components-type = lo_addit . - INSERT ls_components INTO TABLE lt_components_tab. - ls_components-name = 'OPTION'. - lo_addit ?= cl_abap_typedescr=>describe_by_data( ls_filt-option ). - ls_components-type = lo_addit . - INSERT ls_components INTO TABLE lt_components_tab. - ls_components-name = 'LOW'. - lo_addit ?= cl_abap_typedescr=>describe_by_data( <fs> ). - ls_components-type = lo_addit . - INSERT ls_components INTO TABLE lt_components_tab. - ls_components-name = 'HIGH'. - lo_addit ?= cl_abap_typedescr=>describe_by_data( <fs> ). - ls_components-type = lo_addit . - INSERT ls_components INTO TABLE lt_components_tab. - "create new line type - TRY. - lo_struc = cl_abap_structdescr=>create( p_components = lt_components_tab - p_strict = abap_false ). - CATCH cx_sy_struct_creation. - CONTINUE. - ENDTRY. - lo_table = cl_abap_tabledescr=>create( lo_struc ). - - CREATE DATA lo_trange TYPE HANDLE lo_table. - CREATE DATA lo_srange TYPE HANDLE lo_struc. - - ASSIGN lo_trange->* TO <fs_trange>. - ASSIGN lo_srange->* TO <fs_srange>. - ENDIF. - REFRESH <fs_trange>. - ASSIGN COMPONENT 'SIGN' OF STRUCTURE <fs_srange> TO <fs1>. - <fs1> = ls_filt-sign. - ASSIGN COMPONENT 'OPTION' OF STRUCTURE <fs_srange> TO <fs1>. - <fs1> = ls_filt-option. - ASSIGN COMPONENT 'LOW' OF STRUCTURE <fs_srange> TO <fs1>. - <fs1> = ls_filt-low. - ASSIGN COMPONENT 'HIGH' OF STRUCTURE <fs_srange> TO <fs1>. - <fs1> = ls_filt-high. - INSERT <fs_srange> INTO TABLE <fs_trange>. - IF <fs> IN <fs_trange>. - IF ws_option-filter = abap_true. - ls_filter-rownumber = l_line. - ls_filter-columnname = ls_filt-fieldname. - INSERT ls_filter INTO TABLE et_filter. - ELSE. - INSERT <fs_stab> INTO TABLE <fs_ltab>. - ENDIF. - ENDIF. - ENDIF. - ENDLOOP. - IF ws_option-filter = abap_undefined. - <fs_tab> = <fs_ltab>. - REFRESH <fs_ltab>. - ENDIF. - ENDLOOP. - -ENDMETHOD. - - - - - method UPDATE_CATALOG. - DATA: ls_fieldcatalog TYPE zexcel_s_converter_fcat, - ls_ref TYPE salv_s_ddic_reference, - ls_fcat TYPE lvc_s_fcat, - ls_sort TYPE lvc_s_sort, - l_decimals TYPE lvc_decmls. - - FIELD-SYMBOLS: <fs_scat> TYPE zexcel_s_converter_fcat. - - IF ws_layo-zebra IS NOT INITIAL. - cs_layout-is_stripped = abap_true. - ENDIF. - IF ws_layo-no_keyfix IS INITIAL OR - ws_layo-no_keyfix = '0'. - cs_layout-is_fixed = abap_true. - ENDIF. - - LOOP AT wt_fcat INTO ls_fcat. - CLEAR: ls_fieldcatalog, - l_decimals. - CASE ws_option-hidenc. - WHEN abap_false. " We make hiden columns visible - CLEAR ls_fcat-no_out. - WHEN abap_true. -* We convert column and hide it. - WHEN abap_undefined. "We don't convert hiden columns - IF ls_fcat-no_out = abap_true. - ls_fcat-tech = abap_true. - ENDIF. - ENDCASE. - IF ls_fcat-tech = abap_false. - ls_fieldcatalog-tabname = ls_fcat-tabname. - ls_fieldcatalog-fieldname = ls_fcat-fieldname . - ls_fieldcatalog-columnname = ls_fcat-fieldname . - ls_fieldcatalog-position = ls_fcat-col_pos. - ls_fieldcatalog-col_id = ls_fcat-col_id. - ls_fieldcatalog-convexit = ls_fcat-convexit. - ls_fieldcatalog-inttype = ls_fcat-inttype. - ls_fieldcatalog-scrtext_s = ls_fcat-scrtext_s . - ls_fieldcatalog-scrtext_m = ls_fcat-scrtext_m . - ls_fieldcatalog-scrtext_l = ls_fcat-scrtext_l. - l_decimals = ls_fcat-decimals_o. - IF l_decimals IS NOT INITIAL. - ls_fieldcatalog-decimals = l_decimals. - ELSE. - ls_fieldcatalog-decimals = ls_fcat-decimals . - ENDIF. - CASE ws_option-subtot. - WHEN abap_false. " We ignore subtotals - CLEAR ls_fcat-do_sum. - WHEN abap_true. " We convert subtotals and detail - - WHEN abap_undefined. " We should only take subtotals and displayed detail -* for now abap_true - ENDCASE. - CASE ls_fcat-do_sum. - WHEN abap_true. - ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_sum. - WHEN 'A'. - ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_min. - WHEN 'B' . - ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_max. - WHEN 'C' . - ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_average. - WHEN OTHERS. - CLEAR ls_fieldcatalog-totals_function . - ENDCASE. - ls_fieldcatalog-fix_column = ls_fcat-fix_column. - IF ws_layo-cwidth_opt IS INITIAL. - IF ls_fcat-col_opt IS NOT INITIAL. - ls_fieldcatalog-is_optimized = abap_true. - ENDIF. - ELSE. - ls_fieldcatalog-is_optimized = abap_true. - ENDIF. - IF ls_fcat-no_out IS NOT INITIAL. - ls_fieldcatalog-is_hidden = abap_true. - ls_fieldcatalog-position = ls_fieldcatalog-col_id. " We hide based on orginal data structure - ENDIF. -* Alignment in each cell - CASE ls_fcat-just. - WHEN 'R'. - ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_right. - WHEN 'L'. - ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_left. - WHEN 'C'. - ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_center. - WHEN OTHERS. - CLEAR ls_fieldcatalog-alignment. - ENDCASE. -* Check for subtotals. - READ TABLE wt_sort INTO ls_sort WITH KEY fieldname = ls_fcat-fieldname. - IF sy-subrc = 0 AND ws_option-subtot <> abap_false. - ls_fieldcatalog-sort_level = 0 . -* IF ls_fieldcatalog-totals_function IS INITIAL. " Not clear why not -* CLEAR ls_fieldcatalog-is_subtotalled. -* ELSE. - ls_fieldcatalog-is_subtotalled = ls_sort-subtot. -* ENDIF. - ls_fieldcatalog-is_collapsed = ls_sort-expa. - IF ls_fieldcatalog-is_subtotalled = abap_true. - ls_fieldcatalog-sort_level = ls_sort-spos. - ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_sum. " we need function for text - ENDIF. - ENDIF. - APPEND ls_fieldcatalog TO ct_fieldcatalog. - ENDIF. - ENDLOOP. - - SORT ct_fieldcatalog BY sort_level ASCENDING. - cs_layout-max_subtotal_level = 0. - LOOP AT ct_fieldcatalog ASSIGNING <fs_scat> WHERE sort_level > 0. - cs_layout-max_subtotal_level = cs_layout-max_subtotal_level + 1. - <fs_scat>-sort_level = cs_layout-max_subtotal_level. - ENDLOOP. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk deleted file mode 100644 index fbc965f..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk +++ /dev/null @@ -1,62 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - method ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT. - data: lo_alv type REF TO cl_gui_alv_grid. - - try. - lo_alv ?= io_object. - catch cx_sy_move_cast_error . - raise exception type zcx_excel. - endtry. - -endmethod. - - - METHOD zif_excel_converter~create_fieldcatalog. - DATA: lo_alv TYPE REF TO cl_gui_alv_grid. - - TRY. - zif_excel_converter~can_convert_object( io_object = io_object ). - ENDTRY. - - ws_option = is_option. - - lo_alv ?= io_object. - - CLEAR: es_layout, - et_fieldcatalog. - - IF lo_alv IS BOUND. - lo_alv->get_frontend_fieldcatalog( IMPORTING et_fieldcatalog = wt_fcat ). - lo_alv->get_frontend_layout( IMPORTING es_layout = ws_layo ). - lo_alv->get_sort_criteria( IMPORTING et_sort = wt_sort ) . - lo_alv->get_filter_criteria( IMPORTING et_filter = wt_filt ) . - - apply_sort( EXPORTING it_table = it_table - IMPORTING eo_table = eo_table ) . - - get_color( EXPORTING io_table = eo_table - IMPORTING et_colors = et_colors ) . - - get_filter( IMPORTING et_filter = et_filter - CHANGING xo_table = eo_table ) . - - update_catalog( CHANGING cs_layout = es_layout - ct_fieldcatalog = et_fieldcatalog ). - ENDIF. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk deleted file mode 100644 index 45ace47..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk +++ /dev/null @@ -1,40 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - method GET_TABLE. - DATA: lo_object TYPE REF TO object, - ls_seoclass TYPE seoclass, - l_method TYPE string. - - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'IF_SALV_BS_DATA_SOURCE'. - - IF sy-subrc = 0. - l_method = 'GET_TABLE_REF'. - lo_object ?= io_object. - CALL METHOD lo_object->(l_method) - RECEIVING - value = ro_data. - ELSE. - l_method = 'GET_REF_TO_TABLE'. - lo_object ?= io_object. - CALL METHOD lo_object->(l_method) - RECEIVING - value = ro_data. - ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk deleted file mode 100644 index 442fc90..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk +++ /dev/null @@ -1,79 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - METHOD ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT. - - DATA: lo_result TYPE REF TO cl_salv_ex_result_data_table. - - TRY. - lo_result ?= io_object. - CATCH cx_sy_move_cast_error . - RAISE EXCEPTION TYPE zcx_excel. - ENDTRY. - -ENDMETHOD. - - - METHOD zif_excel_converter~create_fieldcatalog. - DATA: lo_result TYPE REF TO cl_salv_ex_result_data_table, - lo_ex_cm TYPE REF TO cl_salv_ex_cm, - lo_data TYPE REF TO data. - - FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE. - - TRY. - zif_excel_converter~can_convert_object( io_object = io_object ). - ENDTRY. - - ws_option = is_option. - - lo_result ?= io_object. - - CLEAR: es_layout, - et_fieldcatalog. - - IF lo_result IS BOUND. - lo_data = get_table( io_object = lo_result->r_model->r_data ). - IF lo_data IS BOUND. - ASSIGN lo_data->* TO <fs_table> . - - lo_ex_cm ?= lo_result->r_model->r_model. - ws_layo = lo_ex_cm->s_layo. -* T_DRDN Instance Attribute Public Type LVC_T_DROP - wt_fcat = lo_ex_cm->t_fcat. - wt_filt = lo_ex_cm->t_filt. -* T_HYPE Instance Attribute Public Type LVC_T_HYPE -* T_SELECTED_CELLS Instance Attribute Public Type LVC_T_CELL -* T_SELECTED_COLUMNS Instance Attribute Public Type LVC_T_COL - wt_sort = lo_ex_cm->t_sort. - - apply_sort( EXPORTING it_table = <fs_table> - IMPORTING eo_table = eo_table ) . - - get_color( EXPORTING io_table = eo_table - IMPORTING et_colors = et_colors ) . - - get_filter( IMPORTING et_filter = et_filter - CHANGING xo_table = eo_table ) . - - update_catalog( CHANGING cs_layout = es_layout - ct_fieldcatalog = et_fieldcatalog ). - else. -* We have a problem and should stop here. - ENDIF. - ENDIF. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk deleted file mode 100644 index f7ce9c0..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk +++ /dev/null @@ -1,238 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - METHOD ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT. - - DATA: lo_result TYPE REF TO cl_salv_wd_result_data_table. - - TRY. - lo_result ?= io_object. - CATCH cx_sy_move_cast_error . - RAISE EXCEPTION TYPE zcx_excel. - ENDTRY. - -ENDMETHOD. - - - METHOD zif_excel_converter~create_fieldcatalog. - DATA: lo_result TYPE REF TO cl_salv_wd_result_data_table, - lo_data TYPE REF TO data. - - FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE. - - TRY. - zif_excel_converter~can_convert_object( io_object = io_object ). - ENDTRY. - - ws_option = is_option. - - lo_result ?= io_object. - - CLEAR: es_layout, - et_fieldcatalog. - - IF lo_result IS BOUND. - lo_data = get_table( io_object = lo_result->r_model->r_data ). - IF lo_data IS BOUND. - ASSIGN lo_data->* TO <fs_table> . - - wo_config ?= lo_result->r_model->r_model. - - IF wo_config IS BOUND. - wt_fields = wo_config->if_salv_wd_field_settings~get_fields( ) . - wt_columns = wo_config->if_salv_wd_column_settings~get_columns( ) . - ENDIF. - - create_wt_fcat( io_table = lo_data ). - create_wt_sort( ). - create_wt_filt( ). - - apply_sort( EXPORTING it_table = <fs_table> - IMPORTING eo_table = eo_table ) . - -* get_color( EXPORTING io_table = eo_table -* IMPORTING et_colors = et_colors ) . - - get_filter( IMPORTING et_filter = et_filter - CHANGING xo_table = eo_table ) . - - update_catalog( CHANGING cs_layout = es_layout - ct_fieldcatalog = et_fieldcatalog ). - ELSE. -* We have a problem and should stop here - ENDIF. - ENDIF. -ENDMETHOD. - - - - method CREATE_WT_FCAT. - DATA: lr_data TYPE REF TO data, - lo_structdescr TYPE REF TO cl_abap_structdescr, - lt_dfies TYPE ddfields, - ls_dfies TYPE dfies, - lv_sytabix TYPE sytabix. - - DATA: ls_fcat TYPE lvc_s_fcat. - - FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE. - - ASSIGN io_table->* TO <fs_tab> . - CREATE DATA lr_data LIKE LINE OF <fs_tab>. - - lo_structdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ). - - lt_dfies = zcl_excel_common=>describe_structure( io_struct = lo_structdescr ). - - loop at lt_dfies into ls_dfies. - MOVE-CORRESPONDING ls_dfies TO ls_fcat. -* ls_fcat-columnname = ls_dfies-fieldname. - ls_fcat-col_pos = ls_dfies-position. - ls_fcat-key = ls_dfies-keyflag. - get_fields_info( CHANGING xs_fcat = ls_fcat ) . - - ls_fcat-col_opt = abap_true. - - get_columns_info( CHANGING xs_fcat = ls_fcat ) . - - INSERT ls_fcat INTO TABLE wt_fcat. - endloop. - - endmethod. - - - method CREATE_WT_FILT. -* No neeed for superclass. -* Only for WD - DATA: lt_otab TYPE abap_sortorder_tab, - ls_otab TYPE abap_sortorder. - DATA: lt_filters TYPE salv_wd_t_filter_rule_ref, - ls_filt TYPE lvc_s_filt. - - FIELD-SYMBOLS: <fs_fields> TYPE salv_wd_s_field_ref, - <fs_filter> TYPE salv_wd_s_filter_rule_ref. - - LOOP AT wt_fields ASSIGNING <fs_fields>. - REFRESH lt_filters. - lt_filters = <fs_fields>-r_field->if_salv_wd_filter~get_filter_rules( ) . - LOOP AT lt_filters ASSIGNING <fs_filter>. - ls_filt-fieldname = <fs_fields>-fieldname. - IF <fs_filter>-r_filter_rule->get_included( ) = abap_true. - ls_filt-sign = 'I'. - ELSE. - ls_filt-sign = 'E'. - ENDIF. - ls_filt-option = <fs_filter>-r_filter_rule->get_operator( ). - ls_filt-high = <fs_filter>-r_filter_rule->get_high_value( ) . - ls_filt-low = <fs_filter>-r_filter_rule->get_low_value( ) . - INSERT ls_filt INTO TABLE wt_filt. - ENDLOOP. - ENDLOOP. - - endmethod. - - - method CREATE_WT_SORT. - DATA: lo_sort TYPE REF TO cl_salv_wd_sort_rule, - l_sort_order TYPE salv_wd_constant, - ls_sort TYPE lvc_s_sort. - - FIELD-SYMBOLS: <fs_fields> TYPE salv_wd_s_field_ref. - - LOOP AT wt_fields ASSIGNING <fs_fields>. - lo_sort = <fs_fields>-r_field->if_salv_wd_sort~get_sort_rule( ) . - IF lo_sort IS BOUND. - l_sort_order = lo_sort->get_sort_order( ). - IF l_sort_order <> if_salv_wd_c_sort=>sort_order. - CLEAR ls_sort. - ls_sort-spos = lo_sort->get_sort_position( ). - ls_sort-fieldname = <fs_fields>-fieldname. -* ls_sort-GROUP - ls_sort-subtot = lo_sort->get_group_aggregation( ). -* ls_sort-COMP -* ls_sort-EXPA -* ls_sort-SELTEXT -* ls_sort-OBLIGATORY -* ls_sort-LEVEL -* ls_sort-NO_OUT - IF l_sort_order = if_salv_wd_c_sort=>sort_order_ascending. - ls_sort-up = abap_true. - ELSE. - ls_sort-down = abap_true. - ENDIF. - INSERT ls_sort INTO TABLE wt_sort. - ENDIF. - ENDIF. - ENDLOOP. - - endmethod. - - - - method GET_COLUMNS_INFO. - DATA: l_numc2 TYPE salv_wd_constant. - - - FIELD-SYMBOLS: <fs_column> TYPE salv_wd_s_column_ref. - - READ TABLE wt_columns ASSIGNING <fs_column> WITH KEY id = xs_fcat-fieldname . - IF sy-subrc = 0. - xs_fcat-col_pos = <fs_column>-r_column->get_position( ) . - l_numc2 = <fs_column>-r_column->get_fixed_position( ). - IF l_numc2 = '02'. - xs_fcat-fix_column = abap_true . - ENDIF. - l_numc2 = <fs_column>-r_column->get_visible( ). - IF l_numc2 = '01'. - xs_fcat-no_out = abap_true . - ENDIF. - ENDIF. - - endmethod. - - - - method GET_FIELDS_INFO. - DATA: lo_aggr TYPE REF TO cl_salv_wd_aggr_rule, - l_aggrtype TYPE salv_wd_constant. - - FIELD-SYMBOLS: <fs_fields> TYPE salv_wd_s_field_ref. - - READ TABLE wt_fields ASSIGNING <fs_fields> WITH KEY fieldname = xs_fcat-fieldname. - IF sy-subrc = 0. - lo_aggr = <fs_fields>-r_field->if_salv_wd_aggr~get_aggr_rule( ) . - IF lo_aggr IS BOUND. - l_aggrtype = lo_aggr->get_aggregation_type( ) . - CASE l_aggrtype. - WHEN if_salv_wd_c_aggregation=>aggrtype_total. - xs_fcat-do_sum = abap_true. - WHEN if_salv_wd_c_aggregation=>aggrtype_minimum. - xs_fcat-do_sum = 'A'. - WHEN if_salv_wd_c_aggregation=>aggrtype_maximum . - xs_fcat-do_sum = 'B'. - WHEN if_salv_wd_c_aggregation=>aggrtype_average . - xs_fcat-do_sum = 'C'. - WHEN OTHERS. - CLEAR xs_fcat-do_sum . - ENDCASE. - ENDIF. - ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk deleted file mode 100644 index a39d4dc..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk +++ /dev/null @@ -1,242 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - METHOD zif_excel_converter~can_convert_object. - - DATA: lo_salv TYPE REF TO cl_salv_table. - - TRY. - lo_salv ?= io_object. - CATCH cx_sy_move_cast_error . - RAISE EXCEPTION TYPE zcx_excel. - ENDTRY. - -ENDMETHOD. - - - METHOD zif_excel_converter~create_fieldcatalog. - DATA: lo_salv TYPE REF TO cl_salv_table. - - TRY. - zif_excel_converter~can_convert_object( io_object = io_object ). - ENDTRY. - - ws_option = is_option. - - lo_salv ?= io_object. - - CLEAR: es_layout, - et_fieldcatalog, - et_colors . - - IF lo_salv IS BOUND. - load_data( EXPORTING io_salv = lo_salv - it_table = it_table ). - apply_sort( EXPORTING it_table = it_table - IMPORTING eo_table = eo_table ) . - - get_color( EXPORTING io_table = eo_table - IMPORTING et_colors = et_colors ) . - - get_filter( IMPORTING et_filter = et_filter - CHANGING xo_table = eo_table ) . - - update_catalog( CHANGING cs_layout = es_layout - ct_fieldcatalog = et_fieldcatalog ). - ENDIF. -ENDMETHOD. - - - - - method LOAD_DATA. - DATA: lo_columns TYPE REF TO cl_salv_columns_table, - lo_aggregations TYPE REF TO cl_salv_aggregations, - lo_sorts TYPE REF TO cl_salv_sorts, - lo_filters TYPE REF TO cl_salv_filters, - lo_functional TYPE REF TO cl_salv_functional_settings, - lo_display TYPE REF TO cl_salv_display_settings, - lo_selections TYPE REF TO cl_salv_selections. - - DATA: ls_vari TYPE disvariant, - lo_layout TYPE REF TO cl_salv_layout. - - DATA: lr_form_tol TYPE REF TO cl_salv_form, - lr_form_eol TYPE REF TO cl_salv_form. - - DATA lt_kkblo_fieldcat TYPE kkblo_t_fieldcat. - DATA ls_kkblo_layout TYPE kkblo_layout. - DATA lt_kkblo_filter TYPE kkblo_t_filter. - DATA lt_kkblo_sort TYPE kkblo_t_sortinfo. - - lo_layout = io_salv->get_layout( ) . - lo_columns = io_salv->get_columns( ). - lo_aggregations = io_salv->get_aggregations( ) . - lo_sorts = io_salv->get_sorts( ) . - lo_filters = io_salv->get_filters( ) . - lo_display = io_salv->get_display_settings( ) . - lo_functional = io_salv->get_functional_settings( ) . - - REFRESH: wt_fcat, - wt_sort, - wt_filt. - -* First update metadata if we can. - IF io_salv->is_offline( ) = abap_false. - io_salv->get_metadata( ) . - ELSE. -* If we are offline we need to build this. - cl_salv_controller_metadata=>get_variant( - EXPORTING - r_layout = lo_layout - CHANGING - s_variant = ls_vari ). - ENDIF. - -*... get the column information - wt_fcat = cl_salv_controller_metadata=>get_lvc_fieldcatalog( - r_columns = lo_columns - r_aggregations = lo_aggregations ). - -*... get the layout information - cl_salv_controller_metadata=>get_lvc_layout( - EXPORTING - r_functional_settings = lo_functional - r_display_settings = lo_display - r_columns = lo_columns - r_aggregations = lo_aggregations - CHANGING - s_layout = ws_layo ). - -* the fieldcatalog is not complete yet! - CALL FUNCTION 'LVC_FIELDCAT_COMPLETE' - EXPORTING - i_complete = 'X' - i_refresh_buffer = space - i_buffer_active = space - is_layout = ws_layo - i_test = '1' - i_fcat_complete = 'X' - IMPORTING -* E_EDIT = - es_layout = ws_layo - CHANGING - ct_fieldcat = wt_fcat. - - IF ls_vari IS NOT INITIAL AND io_salv->is_offline( ) = abap_true. - CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO' - EXPORTING - it_fieldcat_lvc = wt_fcat - is_layout_lvc = ws_layo - IMPORTING - et_fieldcat_kkblo = lt_kkblo_fieldcat - es_layout_kkblo = ls_kkblo_layout - TABLES - it_data = it_table - EXCEPTIONS - it_data_missing = 1 - it_fieldcat_lvc_missing = 2 - OTHERS = 3. - 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 'LT_VARIANT_LOAD' - EXPORTING -* I_TOOL = 'LT' - i_tabname = '1' -* I_TABNAME_SLAVE = - i_dialog = ' ' -* I_USER_SPECIFIC = ' ' -* I_DEFAULT = 'X' -* I_NO_REPTEXT_OPTIMIZE = -* I_VIA_GRID = - i_fcat_complete = 'X' - IMPORTING -* E_EXIT = - et_fieldcat = lt_kkblo_fieldcat - et_sort = lt_kkblo_sort - et_filter = lt_kkblo_filter - CHANGING - cs_layout = ls_kkblo_layout - ct_default_fieldcat = lt_kkblo_fieldcat - cs_variant = ls_vari - EXCEPTIONS - wrong_input = 1 - fc_not_complete = 2 - not_found = 3 - OTHERS = 4 - . - 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 'LVC_TRANSFER_FROM_KKBLO' - EXPORTING -* I_TECH_COMPLETE = -* I_STRUCTURE_NAME = - it_fieldcat_kkblo = lt_kkblo_fieldcat - it_sort_kkblo = lt_kkblo_sort - it_filter_kkblo = lt_kkblo_filter -* IT_SPECIAL_GROUPS_KKBLO = -* IT_FILTERED_ENTRIES_KKBLO = -* IT_GROUPLEVELS_KKBLO = -* IS_SUBTOT_OPTIONS_KKBLO = - is_layout_kkblo = ls_kkblo_layout -* IS_REPREP_ID_KKBLO = -* I_CALLBACK_PROGRAM_KKBLO = -* IT_ADD_FIELDCAT = -* IT_EXCLUDING_KKBLO = -* IT_EXCEPT_QINFO_KKBLO = - IMPORTING - et_fieldcat_lvc = wt_fcat - et_sort_lvc = wt_sort - et_filter_lvc = wt_filt -* ET_SPECIAL_GROUPS_LVC = -* ET_FILTER_INDEX_LVC = -* ET_GROUPLEVELS_LVC = -* ES_TOTAL_OPTIONS_LVC = - es_layout_lvc = ws_layo -* ES_VARIANT_LVC = -* E_VARIANT_SAVE_LVC = -* ES_PRINT_INFO_LVC = -* ES_REPREP_LVC = -* E_REPREP_ACTIVE_LVC = -* ET_EXCLUDING_LVC = -* ET_EXCEPT_QINFO_LVC = - TABLES - it_data = it_table - EXCEPTIONS - it_data_missing = 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. - - ELSE. -* ... get the sort information - wt_sort = cl_salv_controller_metadata=>get_lvc_sort( lo_sorts ). - -* ... get the filter information - wt_filt = cl_salv_controller_metadata=>get_lvc_filter( lo_filters ). - ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI.slnk b/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI.slnk deleted file mode 100644 index 36bf987..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI.slnk +++ /dev/null @@ -1,11 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - diff --git a/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI_BUTTON.slnk b/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI_BUTTON.slnk deleted file mode 100644 index f17b68e..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_CUSTOMUI_BUTTON.slnk +++ /dev/null @@ -1,12 +0,0 @@ - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - diff --git a/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATION.slnk b/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATION.slnk deleted file mode 100644 index 5b144a3..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATION.slnk +++ /dev/null @@ -1,70 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - " Initialise instance variables - formula1 = ''. - formula2 = ''. - type = me->c_type_none. - errorstyle = me->c_style_stop. - operator = ''. - allowblank = abap_false. - showdropdown = abap_false. - showinputmessage = abap_true. - showerrormessage = abap_true. - errortitle = ''. - error = ''. - prompttitle = ''. - prompt = ''. -* inizialize dimension range - cell_row = 1. - cell_column = 'A'. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATIONS.slnk b/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATIONS.slnk deleted file mode 100644 index 5ddc8e5..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_DATA_VALIDATIONS.slnk +++ /dev/null @@ -1,56 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - method ADD. - data_validations->add( ip_data_validation ). - endmethod. - - - method CLEAR. - data_validations->clear( ). - endmethod. - - - method CONSTRUCTOR. - - CREATE OBJECT data_validations. - - endmethod. - - - - method GET_ITERATOR. - eo_iterator ?= data_validations->if_object_collection~get_iterator( ). - endmethod. - - - - method IS_EMPTY. - is_empty = data_validations->if_object_collection~is_empty( ). - endmethod. - - - - method REMOVE. - data_validations->remove( ip_data_validation ). - endmethod. - - - - method SIZE. - ep_size = data_validations->if_object_collection~size( ). - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk b/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk deleted file mode 100644 index 4922614..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk +++ /dev/null @@ -1,1062 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - METHOD constructor. - -* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases -* IMPORTING -* ev_guid_16 = me->guid. - me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call - - IF ip_title IS NOT INITIAL. - title = ip_title. - ELSE. - title = me->guid. - ENDIF. - - me->type = ip_type. - -* inizialize dimension range - anchor = anchor_one_cell. - from_loc-col = 1. - from_loc-row = 1. -ENDMETHOD. - - - - method CREATE_MEDIA_NAME. - -* if media name is initial, create unique name - CHECK media_name IS INITIAL. - - index = ip_index. - CONCATENATE me->type index INTO media_name. - CONDENSE media_name NO-GAPS. - endmethod. - - - - - - METHOD emu2pixel. -* suppose 96 DPI - IF ip_dpi IS SUPPLIED. -* r_emu = ip_pixel * 914400 / ip_dpi. - r_pixel = ip_emu * ip_dpi / 914400. - ELSE. -* suppose 96 DPI -* r_emu = ip_pixel * 914400 / 96. - r_pixel = ip_emu * 96 / 914400. - ENDIF. -ENDMETHOD. - - - - method GET_FROM_COL. - r_from_col = me->from_loc-col. - endmethod. - - - - method GET_FROM_ROW. - r_from_row = me->from_loc-row. - endmethod. - - - - method GET_GUID. - - ep_guid = me->guid. - - endmethod. - - - - method GET_HEIGHT_EMU_STR. - r_height = pixel2emu( size-height ). - CONDENSE r_height NO-GAPS. - endmethod. - - - - method GET_INDEX. - rp_index = me->index. - endmethod. - - - - METHOD get_media. - - DATA: lv_language TYPE sylangu. - DATA: lt_bin_mime TYPE sdokcntbins. - DATA: lt_mime TYPE tsfmime, - lv_filesize TYPE i, - lv_filesizec(10). - - CASE media_source. - WHEN c_media_source_xstring. - r_media = media. - WHEN c_media_source_www. - CALL FUNCTION 'WWWDATA_IMPORT' - EXPORTING - key = media_key_www - TABLES - mime = lt_mime - EXCEPTIONS - OTHERS = 1. - - CALL FUNCTION 'WWWPARAMS_READ' - EXPORTING - relid = media_key_www-relid - objid = media_key_www-objid - name = 'filesize' - IMPORTING - value = lv_filesizec. - - lv_filesize = lv_filesizec. - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filesize - IMPORTING - buffer = r_media - TABLES - binary_tab = lt_mime - EXCEPTIONS - failed = 1 - OTHERS = 2. - WHEN c_media_source_mime. - lv_language = sy-langu. - cl_wb_mime_repository=>load_mime( EXPORTING - io = me->io - IMPORTING - filesize = lv_filesize - bin_data = lt_bin_mime - CHANGING - language = lv_language ). - - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filesize - IMPORTING - buffer = r_media - TABLES - binary_tab = lt_bin_mime - EXCEPTIONS - failed = 1 - OTHERS = 2. - ENDCASE. -ENDMETHOD. - - - - method GET_MEDIA_NAME. - CONCATENATE media_name `.` media_type INTO r_name. - endmethod. - - - - method GET_MEDIA_TYPE. - r_type = media_type. - endmethod. - - - - method GET_NAME. - r_name = title. - endmethod. - - - - method GET_POSITION. - rp_position-anchor = anchor. - rp_position-from = from_loc. - rp_position-to = to_loc. - rp_position-size = size. - endmethod. - - - - method GET_TO_COL. - r_to_col = me->to_loc-col. - endmethod. - - - - method GET_TO_ROW. - r_to_row = me->to_loc-row. - endmethod. - - - - method GET_TYPE. - rp_type = me->type. - endmethod. - - - - method GET_WIDTH_EMU_STR. - r_width = pixel2emu( size-width ). - CONDENSE r_width NO-GAPS. - endmethod. - - - - method LOAD_CHART_ATTRIBUTES. - DATA: node TYPE REF TO if_ixml_element. - DATA: node2 TYPE REF TO if_ixml_element. - DATA: node3 TYPE REF TO if_ixml_element. - DATA: node4 TYPE REF TO if_ixml_element. - DATA: iterator TYPE REF TO if_ixml_node_iterator. - - DATA: chartspace TYPE REF TO if_ixml_node_collection. - DATA: coll_length TYPE i. - DATA: chartelem TYPE REF TO if_ixml_element. - - DATA lo_barchart TYPE REF TO zcl_excel_graph_bars. - DATA lo_piechart TYPE REF TO zcl_excel_graph_pie. - DATA lo_linechart TYPE REF TO zcl_excel_graph_line. - - TYPES: BEGIN OF t_prop, - val TYPE string, - rtl TYPE string, - lang TYPE string, - formatcode TYPE string, - sourcelinked TYPE string, - END OF t_prop. - - TYPES: BEGIN OF t_pagemargins, - b TYPE string, - l TYPE string, - r TYPE string, - t TYPE string, - header TYPE string, - footer TYPE string, - END OF t_pagemargins. - - DATA ls_prop TYPE t_prop. - DATA ls_pagemargins TYPE t_pagemargins. - - DATA lo_collection TYPE REF TO if_ixml_node_collection. - DATA lo_node TYPE REF TO if_ixml_node. - DATA lo_iterator TYPE REF TO if_ixml_node_iterator. - DATA lv_idx TYPE i. - DATA lv_order TYPE i. - DATA lv_invertifnegative TYPE string. - DATA lv_symbol TYPE string. - DATA lv_smooth TYPE c. - DATA lv_sername TYPE string. - DATA lv_label TYPE string. - DATA lv_value TYPE string. - DATA lv_axid TYPE string. - DATA lv_orientation TYPE string. - DATA lv_delete TYPE string. - DATA lv_axpos TYPE string. - DATA lv_formatcode TYPE string. - DATA lv_sourcelinked TYPE string. - DATA lv_majortickmark TYPE string. - DATA lv_minortickmark TYPE string. - DATA lv_ticklblpos TYPE string. - DATA lv_crossax TYPE string. - DATA lv_crosses TYPE string. - DATA lv_auto TYPE string. - DATA lv_lblalgn TYPE string. - DATA lv_lbloffset TYPE string. - DATA lv_nomultilvllbl TYPE string. - DATA lv_crossbetween TYPE string. - - node ?= ip_chart->if_ixml_node~get_first_child( ). - CHECK node IS NOT INITIAL. - - CASE me->graph_type. - WHEN c_graph_bars. - CREATE OBJECT lo_barchart. - me->graph = lo_barchart. - WHEN c_graph_pie. - CREATE OBJECT lo_piechart. - me->graph = lo_piechart. - WHEN c_graph_line. - CREATE OBJECT lo_linechart. - me->graph = lo_linechart. - WHEN OTHERS. - ENDCASE. - - "Fill properties - node2 ?= node->find_from_name( name = 'date1904' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_1904val = ls_prop-val. - node2 ?= node->find_from_name( name = 'lang' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_langval = ls_prop-val. - node2 ?= node->find_from_name( name = 'roundedCorners' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_roundedcornersval = ls_prop-val. - - "style - node2 ?= node->find_from_name( name = 'style' namespace = 'c14' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_c14styleval = ls_prop-val. - node2 ?= node->find_from_name( name = 'style' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_styleval = ls_prop-val. - "---------------------------Read graph properties - node2 ?= node->find_from_name( name = 'autoTitleDeleted' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_autotitledeletedval = ls_prop-val. - - "plotArea - CASE me->graph_type. - WHEN c_graph_bars. - node2 ?= node->find_from_name( name = 'barDir' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_bardirval = ls_prop-val. - node2 ?= node->find_from_name( name = 'grouping' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_groupingval = ls_prop-val. - node2 ?= node->find_from_name( name = 'varyColors' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_varycolorsval = ls_prop-val. - - "Load series - CALL METHOD node->get_elements_by_tag_name - EXPORTING -* depth = 0 - name = 'ser' -* namespace = '' - RECEIVING - rval = lo_collection. - CALL METHOD lo_collection->create_iterator - RECEIVING - rval = lo_iterator. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - WHILE lo_node IS BOUND. - node3 ?= node2->find_from_name( name = 'idx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_idx = ls_prop-val. - node3 ?= node2->find_from_name( name = 'order' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_order = ls_prop-val. - node3 ?= node2->find_from_name( name = 'invertIfNegative' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_invertifnegative = ls_prop-val. - node3 ?= node2->find_from_name( name = 'v' namespace = 'c' ). - IF node3 IS BOUND. - lv_sername = node3->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'strRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_label = node4->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'numRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_value = node4->get_value( ). - ENDIF. - CALL METHOD lo_barchart->create_serie - EXPORTING - ip_idx = lv_idx - ip_order = lv_order - ip_invertifnegative = lv_invertifnegative - ip_lbl = lv_label - ip_ref = lv_value - ip_sername = lv_sername. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - ENDWHILE. - "note: numCache avoided - node2 ?= node->find_from_name( name = 'showLegendKey' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showlegendkeyval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showVal' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showvalval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showCatName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showcatnameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showSerName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showsernameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showPercent' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showpercentval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showBubbleSize' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_showbubblesizeval = ls_prop-val. - node2 ?= node->find_from_name( name = 'gapWidth' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_gapwidthval = ls_prop-val. - - "Load axes - node2 ?= node->find_from_name( name = 'barChart' namespace = 'c' ). - CALL METHOD node2->get_elements_by_tag_name - EXPORTING -* depth = 0 - name = 'axId' -* namespace = '' - RECEIVING - rval = lo_collection. - CALL METHOD lo_collection->create_iterator - RECEIVING - rval = lo_iterator. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - WHILE lo_node IS BOUND. - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lv_axid = ls_prop-val. - IF sy-index EQ 1. "catAx - node2 ?= node->find_from_name( name = 'catAx' namespace = 'c' ). - node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_orientation = ls_prop-val. - node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_delete = ls_prop-val. - node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_axpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_formatcode = ls_prop-formatcode. - lv_sourcelinked = ls_prop-sourcelinked. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_majortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_minortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_ticklblpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossax = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crosses = ls_prop-val. - node3 ?= node2->find_from_name( name = 'auto' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_auto = ls_prop-val. - node3 ?= node2->find_from_name( name = 'lblAlgn' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_lblalgn = ls_prop-val. - node3 ?= node2->find_from_name( name = 'lblOffset' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_lbloffset = ls_prop-val. - node3 ?= node2->find_from_name( name = 'noMultiLvlLbl' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_nomultilvllbl = ls_prop-val. - CALL METHOD lo_barchart->create_ax - EXPORTING - ip_axid = lv_axid - ip_type = zcl_excel_graph_bars=>c_catax - ip_orientation = lv_orientation - ip_delete = lv_delete - ip_axpos = lv_axpos - ip_formatcode = lv_formatcode - ip_sourcelinked = lv_sourcelinked - ip_majortickmark = lv_majortickmark - ip_minortickmark = lv_minortickmark - ip_ticklblpos = lv_ticklblpos - ip_crossax = lv_crossax - ip_crosses = lv_crosses - ip_auto = lv_auto - ip_lblalgn = lv_lblalgn - ip_lbloffset = lv_lbloffset - ip_nomultilvllbl = lv_nomultilvllbl. - ELSEIF sy-index EQ 2. "valAx - node2 ?= node->find_from_name( name = 'valAx' namespace = 'c' ). - node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_orientation = ls_prop-val. - node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_delete = ls_prop-val. - node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_axpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_formatcode = ls_prop-formatcode. - lv_sourcelinked = ls_prop-sourcelinked. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_majortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_minortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_ticklblpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossax = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crosses = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossBetween' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossbetween = ls_prop-val. - CALL METHOD lo_barchart->create_ax - EXPORTING - ip_axid = lv_axid - ip_type = zcl_excel_graph_bars=>c_valax - ip_orientation = lv_orientation - ip_delete = lv_delete - ip_axpos = lv_axpos - ip_formatcode = lv_formatcode - ip_sourcelinked = lv_sourcelinked - ip_majortickmark = lv_majortickmark - ip_minortickmark = lv_minortickmark - ip_ticklblpos = lv_ticklblpos - ip_crossax = lv_crossax - ip_crosses = lv_crosses - ip_crossbetween = lv_crossbetween. - ENDIF. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - ENDWHILE. - - WHEN c_graph_pie. - node2 ?= node->find_from_name( name = 'varyColors' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_varycolorsval = ls_prop-val. - - "Load series - CALL METHOD node->get_elements_by_tag_name - EXPORTING -* depth = 0 - name = 'ser' -* namespace = '' - RECEIVING - rval = lo_collection. - CALL METHOD lo_collection->create_iterator - RECEIVING - rval = lo_iterator. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - WHILE lo_node IS BOUND. - node3 ?= node2->find_from_name( name = 'idx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_idx = ls_prop-val. - node3 ?= node2->find_from_name( name = 'order' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_order = ls_prop-val. - node3 ?= node2->find_from_name( name = 'v' namespace = 'c' ). - IF node3 IS BOUND. - lv_sername = node3->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'strRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_label = node4->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'numRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_value = node4->get_value( ). - ENDIF. - CALL METHOD lo_piechart->create_serie - EXPORTING - ip_idx = lv_idx - ip_order = lv_order - ip_lbl = lv_label - ip_ref = lv_value - ip_sername = lv_sername. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - ENDWHILE. - - "note: numCache avoided - node2 ?= node->find_from_name( name = 'showLegendKey' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showlegendkeyval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showVal' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showvalval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showCatName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showcatnameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showSerName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showsernameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showPercent' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showpercentval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showBubbleSize' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showbubblesizeval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showLeaderLines' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_showleaderlinesval = ls_prop-val. - node2 ?= node->find_from_name( name = 'firstSliceAng' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_firstsliceangval = ls_prop-val. - WHEN c_graph_line. - node2 ?= node->find_from_name( name = 'grouping' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_groupingval = ls_prop-val. - node2 ?= node->find_from_name( name = 'varyColors' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_varycolorsval = ls_prop-val. - - "Load series - CALL METHOD node->get_elements_by_tag_name - EXPORTING -* depth = 0 - name = 'ser' -* namespace = '' - RECEIVING - rval = lo_collection. - CALL METHOD lo_collection->create_iterator - RECEIVING - rval = lo_iterator. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - WHILE lo_node IS BOUND. - node3 ?= node2->find_from_name( name = 'idx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_idx = ls_prop-val. - node3 ?= node2->find_from_name( name = 'order' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_order = ls_prop-val. - node3 ?= node2->find_from_name( name = 'symbol' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_symbol = ls_prop-val. - node3 ?= node2->find_from_name( name = 'smooth' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_smooth = ls_prop-val. - node3 ?= node2->find_from_name( name = 'v' namespace = 'c' ). - IF node3 IS BOUND. - lv_sername = node3->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'strRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_label = node4->get_value( ). - ENDIF. - node3 ?= node2->find_from_name( name = 'numRef' namespace = 'c' ). - IF node3 IS BOUND. - node4 ?= node3->find_from_name( name = 'f' namespace = 'c' ). - lv_value = node4->get_value( ). - ENDIF. - CALL METHOD lo_linechart->create_serie - EXPORTING - ip_idx = lv_idx - ip_order = lv_order - ip_symbol = lv_symbol - ip_smooth = lv_smooth - ip_lbl = lv_label - ip_ref = lv_value - ip_sername = lv_sername. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - ENDWHILE. - "note: numCache avoided - node2 ?= node->find_from_name( name = 'showLegendKey' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showlegendkeyval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showVal' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showvalval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showCatName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showcatnameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showSerName' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showsernameval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showPercent' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showpercentval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showBubbleSize' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_showbubblesizeval = ls_prop-val. - - node ?= node->find_from_name( name = 'lineChart' namespace = 'c' ). - node2 ?= node->find_from_name( name = 'marker' namespace = 'c' DEPTH = '1' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->NS_MARKERVAL = ls_prop-val. - node2 ?= node->find_from_name( name = 'smooth' namespace = 'c' DEPTH = '1' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->NS_SMOOTHVAL = ls_prop-val. - node ?= ip_chart->if_ixml_node~get_first_child( ). - CHECK node IS NOT INITIAL. - - "Load axes - node2 ?= node->find_from_name( name = 'lineChart' namespace = 'c' ). - CALL METHOD node2->get_elements_by_tag_name - EXPORTING -* depth = 0 - name = 'axId' -* namespace = '' - RECEIVING - rval = lo_collection. - CALL METHOD lo_collection->create_iterator - RECEIVING - rval = lo_iterator. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - WHILE lo_node IS BOUND. - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lv_axid = ls_prop-val. - IF sy-index EQ 1. "catAx - node2 ?= node->find_from_name( name = 'catAx' namespace = 'c' ). - node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_orientation = ls_prop-val. - node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_delete = ls_prop-val. - node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_axpos = ls_prop-val. -* node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). -* zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). -* lv_formatcode = ls_prop-formatcode. -* lv_sourcelinked = ls_prop-sourcelinked. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_majortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_minortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_ticklblpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossax = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crosses = ls_prop-val. - node3 ?= node2->find_from_name( name = 'auto' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_auto = ls_prop-val. - node3 ?= node2->find_from_name( name = 'lblAlgn' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_lblalgn = ls_prop-val. - node3 ?= node2->find_from_name( name = 'lblOffset' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_lbloffset = ls_prop-val. - node3 ?= node2->find_from_name( name = 'noMultiLvlLbl' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_nomultilvllbl = ls_prop-val. - CALL METHOD lo_linechart->create_ax - EXPORTING - ip_axid = lv_axid - ip_type = zcl_excel_graph_line=>c_catax - ip_orientation = lv_orientation - ip_delete = lv_delete - ip_axpos = lv_axpos - ip_formatcode = lv_formatcode - ip_sourcelinked = lv_sourcelinked - ip_majortickmark = lv_majortickmark - ip_minortickmark = lv_minortickmark - ip_ticklblpos = lv_ticklblpos - ip_crossax = lv_crossax - ip_crosses = lv_crosses - ip_auto = lv_auto - ip_lblalgn = lv_lblalgn - ip_lbloffset = lv_lbloffset - ip_nomultilvllbl = lv_nomultilvllbl. - ELSEIF sy-index EQ 2. "valAx - node2 ?= node->find_from_name( name = 'valAx' namespace = 'c' ). - node3 ?= node2->find_from_name( name = 'orientation' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_orientation = ls_prop-val. - node3 ?= node2->find_from_name( name = 'delete' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_delete = ls_prop-val. - node3 ?= node2->find_from_name( name = 'axPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_axpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'numFmt' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_formatcode = ls_prop-formatcode. - lv_sourcelinked = ls_prop-sourcelinked. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_majortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'majorTickMark' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_minortickmark = ls_prop-val. - node3 ?= node2->find_from_name( name = 'tickLblPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_ticklblpos = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossAx' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossax = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crosses' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crosses = ls_prop-val. - node3 ?= node2->find_from_name( name = 'crossBetween' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = ls_prop ). - lv_crossbetween = ls_prop-val. - CALL METHOD lo_linechart->create_ax - EXPORTING - ip_axid = lv_axid - ip_type = zcl_excel_graph_line=>c_valax - ip_orientation = lv_orientation - ip_delete = lv_delete - ip_axpos = lv_axpos - ip_formatcode = lv_formatcode - ip_sourcelinked = lv_sourcelinked - ip_majortickmark = lv_majortickmark - ip_minortickmark = lv_minortickmark - ip_ticklblpos = lv_ticklblpos - ip_crossax = lv_crossax - ip_crosses = lv_crosses - ip_crossbetween = lv_crossbetween. - ENDIF. - lo_node = lo_iterator->get_next( ). - IF lo_node IS BOUND. - node2 ?= lo_node->query_interface( ixml_iid_element ). - ENDIF. - ENDWHILE. - WHEN OTHERS. - ENDCASE. - - "legend - CASE me->graph_type. - WHEN c_graph_bars. - node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_legendposval = ls_prop-val. - node2 ?= node->find_from_name( name = 'overlay' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_barchart->ns_overlayval = ls_prop-val. - WHEN c_graph_line. - node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_legendposval = ls_prop-val. - node2 ?= node->find_from_name( name = 'overlay' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_linechart->ns_overlayval = ls_prop-val. - WHEN c_graph_pie. - node2 ?= node->find_from_name( name = 'legendPos' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_legendposval = ls_prop-val. - node2 ?= node->find_from_name( name = 'overlay' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_overlayval = ls_prop-val. - node2 ?= node->find_from_name( name = 'pPr' namespace = 'a' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_pprrtl = ls_prop-rtl. - node2 ?= node->find_from_name( name = 'endParaRPr' namespace = 'a' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - lo_piechart->ns_endpararprlang = ls_prop-lang. - - WHEN OTHERS. - ENDCASE. - - node2 ?= node->find_from_name( name = 'plotVisOnly' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_plotvisonlyval = ls_prop-val. - node2 ?= node->find_from_name( name = 'dispBlanksAs' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_dispblanksasval = ls_prop-val. - node2 ?= node->find_from_name( name = 'showDLblsOverMax' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_prop ). - me->graph->ns_showdlblsovermaxval = ls_prop-val. - "--------------------- - - node2 ?= node->find_from_name( name = 'pageMargins' namespace = 'c' ). - zcl_excel_reader_2007=>fill_struct_from_attributes( EXPORTING ip_element = node2 CHANGING cp_structure = ls_pagemargins ). - me->graph->pagemargins = ls_pagemargins. - - - endmethod. - - - - - - method PIXEL2EMU. -* suppose 96 DPI - IF ip_dpi IS SUPPLIED. - r_emu = ip_pixel * 914400 / ip_dpi. - ELSE. -* suppose 96 DPI - r_emu = ip_pixel * 914400 / 96. - ENDIF. - endmethod. - - - - - - - method SET_MEDIA. - IF ip_media IS SUPPLIED. - media = ip_media. - ENDIF. - media_type = ip_media_type. - media_source = c_media_source_xstring. - IF ip_width IS SUPPLIED. - size-width = ip_width. - ENDIF. - IF ip_height IS SUPPLIED. - size-height = ip_height. - ENDIF. - endmethod. - - - - - - METHOD set_media_mime. - - DATA: lv_language TYPE sylangu. - - io = ip_io. - media_source = c_media_source_mime. - size-width = ip_width. - size-height = ip_height. - - lv_language = sy-langu. - cl_wb_mime_repository=>load_mime( EXPORTING - io = ip_io - IMPORTING - filename = media_name - "mimetype = media_type - CHANGING - language = lv_language ). - - SPLIT media_name AT '.' INTO media_name media_type. - -ENDMETHOD. - - - - - - method SET_MEDIA_WWW. - DATA: lv_value(20). - - media_key_www = ip_key. - media_source = c_media_source_www. - - CALL FUNCTION 'WWWPARAMS_READ' - EXPORTING - relid = media_key_www-relid - objid = media_key_www-objid - name = 'fileextension' - IMPORTING - value = lv_value. - media_type = lv_value. - SHIFT media_type LEFT DELETING LEADING '.'. - - size-width = ip_width. - size-height = ip_height. - endmethod. - - - - - - - method SET_POSITION. - from_loc-col = zcl_excel_common=>convert_column2int( ip_from_col ) - 1. - IF ip_coloff IS SUPPLIED. - from_loc-col_offset = ip_coloff. - ENDIF. - from_loc-row = ip_from_row - 1. - IF ip_rowoff IS SUPPLIED. - from_loc-row_offset = ip_rowoff. - ENDIF. - anchor = anchor_one_cell. - endmethod. - - - - - - method SET_POSITION2. - - data: lv_anchor type zexcel_drawing_anchor. - lv_anchor = ip_anchor. - - IF lv_anchor IS INITIAL. - IF ip_to IS NOT INITIAL. - lv_anchor = anchor_two_cell. - ELSE. - lv_anchor = anchor_one_cell. - ENDIF. - ENDIF. - - CASE lv_anchor. - WHEN anchor_absolute OR anchor_one_cell. - CLEAR: me->to_loc. - WHEN anchor_two_cell. - CLEAR: me->size. - ENDCASE. - - me->from_loc = ip_from. - me->to_loc = ip_to. - me->anchor = lv_anchor. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_DRAWINGS.slnk b/ZA2X/CLAS/ZCL_EXCEL_DRAWINGS.slnk deleted file mode 100644 index 2c3756d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_DRAWINGS.slnk +++ /dev/null @@ -1,89 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - method ADD. - DATA: lv_index TYPE i. - - drawings->add( ip_drawing ). - lv_index = drawings->if_object_collection~size( ). - ip_drawing->create_media_name( - ip_index = lv_index ). - endmethod. - - - method CLEAR. - - drawings->clear( ). - endmethod. - - - - method CONSTRUCTOR. - - CREATE OBJECT drawings. - type = ip_type. - - endmethod. - - - - - method GET. - - DATA lv_index TYPE i. - lv_index = ip_index. - eo_drawing ?= drawings->if_object_collection~get( lv_index ). - endmethod. - - - - method GET_ITERATOR. - - eo_iterator ?= drawings->if_object_collection~get_iterator( ). - endmethod. - - - - method GET_TYPE. - rp_type = me->type. - endmethod. - - - - method INCLUDE. - drawings->add( ip_drawing ). - endmethod. - - - - method IS_EMPTY. - - is_empty = drawings->if_object_collection~is_empty( ). - endmethod. - - - - method REMOVE. - - drawings->remove( ip_drawing ). - endmethod. - - - - method SIZE. - - ep_size = drawings->if_object_collection~size( ). - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk deleted file mode 100644 index 84f5cab..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH.slnk +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - "Load default values - me->pagemargins-b = '0.75'. - me->pagemargins-l = '0.7'. - me->pagemargins-r = '0.7'. - me->pagemargins-t = '0.75'. - me->pagemargins-header = '0.3'. - me->pagemargins-footer = '0.3'. - endmethod. - - - - - - - - - - - - - - - - - - - - method CREATE_SERIE. - DATA ls_serie TYPE s_series. - - DATA: lv_start_row_c TYPE char7, - lv_stop_row_c TYPE char7. - - - IF ip_lbl IS NOT SUPPLIED. - lv_stop_row_c = ip_lbl_to_row. - SHIFT lv_stop_row_c RIGHT DELETING TRAILING space. - SHIFT lv_stop_row_c LEFT DELETING LEADING space. - lv_start_row_c = ip_lbl_from_row. - SHIFT lv_start_row_c RIGHT DELETING TRAILING space. - SHIFT lv_start_row_c LEFT DELETING LEADING space. - ls_serie-lbl = ip_sheet. - ls_serie-lbl = zcl_excel_common=>escape_string( ip_value = ls_serie-lbl ). - CONCATENATE ls_serie-lbl '!$' ip_lbl_from_col '$' lv_start_row_c ':$' ip_lbl_to_col '$' lv_stop_row_c INTO ls_serie-lbl. - CLEAR: lv_start_row_c, lv_stop_row_c. - ELSE. - ls_serie-lbl = ip_lbl. - ENDIF. - IF ip_ref IS NOT SUPPLIED. - lv_stop_row_c = ip_ref_to_row. - SHIFT lv_stop_row_c RIGHT DELETING TRAILING space. - SHIFT lv_stop_row_c LEFT DELETING LEADING space. - lv_start_row_c = ip_ref_from_row. - SHIFT lv_start_row_c RIGHT DELETING TRAILING space. - SHIFT lv_start_row_c LEFT DELETING LEADING space. - ls_serie-ref = ip_sheet. - ls_serie-ref = zcl_excel_common=>escape_string( ip_value = ls_serie-ref ). - CONCATENATE ls_serie-ref '!$' ip_ref_from_col '$' lv_start_row_c ':$' ip_ref_to_col '$' lv_stop_row_c INTO ls_serie-ref. - CLEAR: lv_start_row_c, lv_stop_row_c. - ELSE. - ls_serie-ref = ip_ref. - ENDIF. - ls_serie-idx = ip_idx. - ls_serie-order = ip_order. - ls_serie-invertifnegative = ip_invertifnegative. - ls_serie-symbol = ip_symbol. - ls_serie-smooth = ip_smooth. - ls_serie-sername = ip_sername. - APPEND ls_serie TO me->series. - SORT me->series BY order ASCENDING. - endmethod. - - - - method SET_PRINT_LBL. - me->print_label = ip_value. - endmethod. - - - - method SET_STYLE. - me->ns_c14styleval = ip_style-c14style. - CONDENSE me->ns_c14styleval NO-GAPS. - me->ns_styleval = ip_style-cstyle. - CONDENSE me->ns_styleval NO-GAPS. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk deleted file mode 100644 index ba3f71d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_BARS.slnk +++ /dev/null @@ -1,256 +0,0 @@ - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CREATE_AX. - DATA ls_ax TYPE s_ax. - ls_ax-type = ip_type. - - if ip_type = c_catax. - if ip_axid is SUPPLIED. - ls_ax-axid = ip_axid. - else. - ls_ax-axid = '1'. - endif. - if ip_orientation is SUPPLIED. - ls_ax-orientation = ip_orientation. - else. - ls_ax-orientation = 'minMax'. - endif. - if ip_delete is SUPPLIED. - ls_ax-delete = ip_delete. - else. - ls_ax-delete = '0'. - endif. - if ip_axpos is SUPPLIED. - ls_ax-axpos = ip_axpos. - else. - ls_ax-axpos = 'b'. - endif. - if ip_formatcode is SUPPLIED. - ls_ax-formatcode = ip_formatcode. - else. - ls_ax-formatcode = 'General'. - endif. - if ip_sourcelinked is SUPPLIED. - ls_ax-sourcelinked = ip_sourcelinked. - else. - ls_ax-sourcelinked = '1'. - endif. - if ip_majorTickMark is SUPPLIED. - ls_ax-majorTickMark = ip_majorTickMark. - else. - ls_ax-majorTickMark = 'out'. - endif. - if ip_minorTickMark is SUPPLIED. - ls_ax-minorTickMark = ip_minorTickMark. - else. - ls_ax-minorTickMark = 'none'. - endif. - if ip_ticklblpos is SUPPLIED. - ls_ax-ticklblpos = ip_ticklblpos. - else. - ls_ax-ticklblpos = 'nextTo'. - endif. - if ip_crossax is SUPPLIED. - ls_ax-crossax = ip_crossax. - else. - ls_ax-crossax = '2'. - endif. - if ip_crosses is SUPPLIED. - ls_ax-crosses = ip_crosses. - else. - ls_ax-crosses = 'autoZero'. - endif. - if ip_auto is SUPPLIED. - ls_ax-auto = ip_auto. - else. - ls_ax-auto = '1'. - endif. - if ip_lblAlgn is SUPPLIED. - ls_ax-lblAlgn = ip_lblAlgn. - else. - ls_ax-lblAlgn = 'ctr'. - endif. - if ip_lblOffset is SUPPLIED. - ls_ax-lblOffset = ip_lblOffset. - else. - ls_ax-lblOffset = '100'. - endif. - if ip_noMultiLvlLbl is SUPPLIED. - ls_ax-noMultiLvlLbl = ip_noMultiLvlLbl. - else. - ls_ax-noMultiLvlLbl = '0'. - endif. - elseif ip_type = c_valax. - if ip_axid is SUPPLIED. - ls_ax-axid = ip_axid. - else. - ls_ax-axid = '2'. - endif. - if ip_orientation is SUPPLIED. - ls_ax-orientation = ip_orientation. - else. - ls_ax-orientation = 'minMax'. - endif. - if ip_delete is SUPPLIED. - ls_ax-delete = ip_delete. - else. - ls_ax-delete = '0'. - endif. - if ip_axpos is SUPPLIED. - ls_ax-axpos = ip_axpos. - else. - ls_ax-axpos = 'l'. - endif. - if ip_formatcode is SUPPLIED. - ls_ax-formatcode = ip_formatcode. - else. - ls_ax-formatcode = 'General'. - endif. - if ip_sourcelinked is SUPPLIED. - ls_ax-sourcelinked = ip_sourcelinked. - else. - ls_ax-sourcelinked = '1'. - endif. - if ip_majorTickMark is SUPPLIED. - ls_ax-majorTickMark = ip_majorTickMark. - else. - ls_ax-majorTickMark = 'out'. - endif. - if ip_minorTickMark is SUPPLIED. - ls_ax-minorTickMark = ip_minorTickMark. - else. - ls_ax-minorTickMark = 'none'. - endif. - if ip_ticklblpos is SUPPLIED. - ls_ax-ticklblpos = ip_ticklblpos. - else. - ls_ax-ticklblpos = 'nextTo'. - endif. - if ip_crossax is SUPPLIED. - ls_ax-crossax = ip_crossax. - else. - ls_ax-crossax = '1'. - endif. - if ip_crosses is SUPPLIED. - ls_ax-crosses = ip_crosses. - else. - ls_ax-crosses = 'autoZero'. - endif. - if ip_crossBetween is SUPPLIED. - ls_ax-crossBetween = ip_crossBetween. - else. - ls_ax-crossBetween = 'between'. - endif. - endif. - - APPEND ls_ax TO me->axes. - sort me->axes by axid ascending. - endmethod. - - - - method SET_SHOW_CAT_NAME. - ns_showcatnameval = ip_value. - endmethod. - - - - method SET_SHOW_LEGEND_KEY. - ns_showlegendkeyval = ip_value. - endmethod. - - - - method SET_SHOW_PERCENT. - ns_showpercentval = ip_value. - endmethod. - - - - method SET_SHOW_SER_NAME. - ns_showsernameval = ip_value. - endmethod. - - - - method SET_SHOW_VALUES. - ns_showvalval = ip_value. - endmethod. - - - - method SET_VARYCOLOR. - ns_varycolorsval = ip_value. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk deleted file mode 100644 index 275d76e..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_LINE.slnk +++ /dev/null @@ -1,254 +0,0 @@ - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CREATE_AX. - DATA ls_ax TYPE s_ax. - ls_ax-type = ip_type. - - IF ip_type = c_catax. - IF ip_axid IS SUPPLIED. - ls_ax-axid = ip_axid. - ELSE. - ls_ax-axid = '1'. - ENDIF. - IF ip_orientation IS SUPPLIED. - ls_ax-orientation = ip_orientation. - ELSE. - ls_ax-orientation = 'minMax'. - ENDIF. - IF ip_delete IS SUPPLIED. - ls_ax-delete = ip_delete. - ELSE. - ls_ax-delete = '0'. - ENDIF. - IF ip_axpos IS SUPPLIED. - ls_ax-axpos = ip_axpos. - ELSE. - ls_ax-axpos = 'b'. - ENDIF. - IF ip_formatcode IS SUPPLIED. - ls_ax-formatcode = ip_formatcode. - ELSE. - ls_ax-formatcode = 'General'. - ENDIF. - IF ip_sourcelinked IS SUPPLIED. - ls_ax-sourcelinked = ip_sourcelinked. - ELSE. - ls_ax-sourcelinked = '1'. - ENDIF. - IF ip_majortickmark IS SUPPLIED. - ls_ax-majortickmark = ip_majortickmark. - ELSE. - ls_ax-majortickmark = 'out'. - ENDIF. - IF ip_minortickmark IS SUPPLIED. - ls_ax-minortickmark = ip_minortickmark. - ELSE. - ls_ax-minortickmark = 'none'. - ENDIF. - IF ip_ticklblpos IS SUPPLIED. - ls_ax-ticklblpos = ip_ticklblpos. - ELSE. - ls_ax-ticklblpos = 'nextTo'. - ENDIF. - IF ip_crossax IS SUPPLIED. - ls_ax-crossax = ip_crossax. - ELSE. - ls_ax-crossax = '2'. - ENDIF. - IF ip_crosses IS SUPPLIED. - ls_ax-crosses = ip_crosses. - ELSE. - ls_ax-crosses = 'autoZero'. - ENDIF. - IF ip_auto IS SUPPLIED. - ls_ax-auto = ip_auto. - ELSE. - ls_ax-auto = '1'. - ENDIF. - IF ip_lblalgn IS SUPPLIED. - ls_ax-lblalgn = ip_lblalgn. - ELSE. - ls_ax-lblalgn = 'ctr'. - ENDIF. - IF ip_lbloffset IS SUPPLIED. - ls_ax-lbloffset = ip_lbloffset. - ELSE. - ls_ax-lbloffset = '100'. - ENDIF. - IF ip_nomultilvllbl IS SUPPLIED. - ls_ax-nomultilvllbl = ip_nomultilvllbl. - ELSE. - ls_ax-nomultilvllbl = '0'. - ENDIF. - ELSEIF ip_type = c_valax. - IF ip_axid IS SUPPLIED. - ls_ax-axid = ip_axid. - ELSE. - ls_ax-axid = '2'. - ENDIF. - IF ip_orientation IS SUPPLIED. - ls_ax-orientation = ip_orientation. - ELSE. - ls_ax-orientation = 'minMax'. - ENDIF. - IF ip_delete IS SUPPLIED. - ls_ax-delete = ip_delete. - ELSE. - ls_ax-delete = '0'. - ENDIF. - IF ip_axpos IS SUPPLIED. - ls_ax-axpos = ip_axpos. - ELSE. - ls_ax-axpos = 'l'. - ENDIF. - IF ip_formatcode IS SUPPLIED. - ls_ax-formatcode = ip_formatcode. - ELSE. - ls_ax-formatcode = 'General'. - ENDIF. - IF ip_sourcelinked IS SUPPLIED. - ls_ax-sourcelinked = ip_sourcelinked. - ELSE. - ls_ax-sourcelinked = '1'. - ENDIF. - IF ip_majortickmark IS SUPPLIED. - ls_ax-majortickmark = ip_majortickmark. - ELSE. - ls_ax-majortickmark = 'out'. - ENDIF. - IF ip_minortickmark IS SUPPLIED. - ls_ax-minortickmark = ip_minortickmark. - ELSE. - ls_ax-minortickmark = 'none'. - ENDIF. - IF ip_ticklblpos IS SUPPLIED. - ls_ax-ticklblpos = ip_ticklblpos. - ELSE. - ls_ax-ticklblpos = 'nextTo'. - ENDIF. - IF ip_crossax IS SUPPLIED. - ls_ax-crossax = ip_crossax. - ELSE. - ls_ax-crossax = '1'. - ENDIF. - IF ip_crosses IS SUPPLIED. - ls_ax-crosses = ip_crosses. - ELSE. - ls_ax-crosses = 'autoZero'. - ENDIF. - IF ip_crossbetween IS SUPPLIED. - ls_ax-crossbetween = ip_crossbetween. - ELSE. - ls_ax-crossbetween = 'between'. - ENDIF. - ENDIF. - - APPEND ls_ax TO me->axes. - SORT me->axes BY axid ASCENDING. - endmethod. - - - - method SET_SHOW_CAT_NAME. - ns_showcatnameval = ip_value. - endmethod. - - - - method SET_SHOW_LEGEND_KEY. - ns_showlegendkeyval = ip_value. - endmethod. - - - - method SET_SHOW_PERCENT. - ns_showpercentval = ip_value. - endmethod. - - - - method SET_SHOW_SER_NAME. - ns_showsernameval = ip_value. - endmethod. - - - - method SET_SHOW_VALUES. - ns_showvalval = ip_value. - endmethod. - - - - method SET_VARYCOLOR. - ns_varycolorsval = ip_value. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk b/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk deleted file mode 100644 index 9a8f2b1..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_GRAPH_PIE.slnk +++ /dev/null @@ -1,67 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - method SET_SHOW_CAT_NAME. - ns_showcatnameval = ip_value. - endmethod. - - - - method SET_SHOW_LEADER_LINES. - ns_showleaderlinesval = ip_value. - endmethod. - - - - method SET_SHOW_LEGEND_KEY. - ns_showlegendkeyval = ip_value. - endmethod. - - - - method SET_SHOW_PERCENT. - ns_showpercentval = ip_value. - endmethod. - - - - method SET_SHOW_SER_NAME. - ns_showsernameval = ip_value. - endmethod. - - - - method SET_SHOW_VALUES. - ns_showvalval = ip_value. - endmethod. - - - - method SET_VARYCOLOR. - ns_varycolorsval = ip_value. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_HYPERLINK.slnk b/ZA2X/CLAS/ZCL_EXCEL_HYPERLINK.slnk deleted file mode 100644 index 22ed096..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_HYPERLINK.slnk +++ /dev/null @@ -1,79 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - method CREATE. - data: lo_hyperlink type REF TO zcl_excel_hyperlink. - - create OBJECT lo_hyperlink. - - lo_hyperlink->location = iv_url. - lo_hyperlink->internal = iv_internal. - - ov_link = lo_hyperlink. - endmethod. - - - - - method CREATE_EXTERNAL_LINK. - - ov_link = zcl_excel_hyperlink=>create( iv_url = iv_url - iv_internal = abap_false ). - endmethod. - - - - - method CREATE_INTERNAL_LINK. - ov_link = zcl_excel_hyperlink=>create( iv_url = iv_location - iv_internal = abap_true ). - endmethod. - - - - method GET_REF. - ev_ref = row. - CONDENSE ev_ref. - CONCATENATE column ev_ref INTO ev_ref. - endmethod. - - - - method GET_URL. - ev_url = me->location. - endmethod. - - - - method IS_INTERNAL. - ev_ret = me->internal. - endmethod. - - - - - - method SET_CELL_REFERENCE. - me->column = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column - me->row = ip_row. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_LEGACY_PALETTE.slnk b/ZA2X/CLAS/ZCL_EXCEL_LEGACY_PALETTE.slnk deleted file mode 100644 index 143b6c7..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_LEGACY_PALETTE.slnk +++ /dev/null @@ -1,144 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - method CONSTRUCTOR. - " default Excel palette based on - " http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.indexedcolors.aspx - - APPEND '00000000' TO colors. - APPEND '00FFFFFF' TO colors. - APPEND '00FF0000' TO colors. - APPEND '0000FF00' TO colors. - APPEND '000000FF' TO colors. - APPEND '00FFFF00' TO colors. - APPEND '00FF00FF' TO colors. - APPEND '0000FFFF' TO colors. - APPEND '00000000' TO colors. - APPEND '00FFFFFF' TO colors. - - APPEND '00FF0000' TO colors. - APPEND '0000FF00' TO colors. - APPEND '000000FF' TO colors. - APPEND '00FFFF00' TO colors. - APPEND '00FF00FF' TO colors. - APPEND '0000FFFF' TO colors. - APPEND '00800000' TO colors. - APPEND '00008000' TO colors. - APPEND '00000080' TO colors. - APPEND '00808000' TO colors. - - APPEND '00800080' TO colors. - APPEND '00008080' TO colors. - APPEND '00C0C0C0' TO colors. - APPEND '00808080' TO colors. - APPEND '009999FF' TO colors. - APPEND '00993366' TO colors. - APPEND '00FFFFCC' TO colors. - APPEND '00CCFFFF' TO colors. - APPEND '00660066' TO colors. - APPEND '00FF8080' TO colors. - - APPEND '000066CC' TO colors. - APPEND '00CCCCFF' TO colors. - APPEND '00000080' TO colors. - APPEND '00FF00FF' TO colors. - APPEND '00FFFF00' TO colors. - APPEND '0000FFFF' TO colors. - APPEND '00800080' TO colors. - APPEND '00800000' TO colors. - APPEND '00008080' TO colors. - APPEND '000000FF' TO colors. - - APPEND '0000CCFF' TO colors. - APPEND '00CCFFFF' TO colors. - APPEND '00CCFFCC' TO colors. - APPEND '00FFFF99' TO colors. - APPEND '0099CCFF' TO colors. - APPEND '00FF99CC' TO colors. - APPEND '00CC99FF' TO colors. - APPEND '00FFCC99' TO colors. - APPEND '003366FF' TO colors. - APPEND '0033CCCC' TO colors. - - APPEND '0099CC00' TO colors. - APPEND '00FFCC00' TO colors. - APPEND '00FF9900' TO colors. - APPEND '00FF6600' TO colors. - APPEND '00666699' TO colors. - APPEND '00969696' TO colors. - APPEND '00003366' TO colors. - APPEND '00339966' TO colors. - APPEND '00003300' TO colors. - APPEND '00333300' TO colors. - - APPEND '00993300' TO colors. - APPEND '00993366' TO colors. - APPEND '00333399' TO colors. - APPEND '00333333' TO colors. - - endmethod. - - - - - - method GET_COLOR. - DATA: lv_index type i. - - lv_index = ip_index + 1. - READ TABLE colors INTO ep_color INDEX lv_index. - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Invalid color index'. - ENDIF. - endmethod. - - - - method GET_COLORS. - ep_colors = colors. - endmethod. - - - - method IS_MODIFIED. - ep_modified = modified. - endmethod. - - - - - method SET_COLOR. - DATA: lv_index TYPE i. - - FIELD-SYMBOLS: <lv_color> LIKE LINE OF colors. - - lv_index = ip_index + 1. - READ TABLE colors ASSIGNING <lv_color> INDEX lv_index. - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Invalid color index'. - ENDIF. - - IF <lv_color> <> ip_color. - modified = abap_true. - <lv_color> = ip_color. - ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk b/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk deleted file mode 100644 index c959881..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk +++ /dev/null @@ -1,52 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - METHOD guid_create. - - TRY. - rv_guid_16 = cl_system_uuid=>if_system_uuid_static~create_uuid_x16( ). - CATCH cx_uuid_error. - ENDTRY. - -*--------------------------------------------------------------------* -* If you are on a release that does not yet have the class cl_system_uuid -* please use the following coding instead which is using the function -* call that was used before but which has been flagged as obsolete -* in newer SAP releases -*--------------------------------------------------------------------* -* -* CALL FUNCTION 'GUID_CREATE' -* IMPORTING -* ev_guid_16 = rv_guid_16. - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_PROPERTIES.slnk b/ZA2X/CLAS/ZCL_EXCEL_PROPERTIES.slnk deleted file mode 100644 index bc419ee..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_PROPERTIES.slnk +++ /dev/null @@ -1,73 +0,0 @@ - - - class ZCL_EXCEL_PROPERTIES definition - public - final - create public . - -public section. -*"* public components of class ZCL_EXCEL_PROPERTIES -*"* do not include other source files here!!! - - data CREATOR type ZEXCEL_CREATOR value 'Ivan Femia'. "#EC NOTEXT . - data LASTMODIFIEDBY type ZEXCEL_CREATOR value 'Ivan Femia'. "#EC NOTEXT . - data CREATED type TIMESTAMPL . - data MODIFIED type TIMESTAMPL . - data TITLE type ZEXCEL_TITLE value 'abap2xlsx'. "#EC NOTEXT . - data SUBJECT type ZEXCEL_SUBJECT . - data DESCRIPTION type ZEXCEL_DESCRIPTION value 'Created using abap2xlsx'. "#EC NOTEXT . - data KEYWORDS type ZEXCEL_KEYWORDS . - data CATEGORY type ZEXCEL_CATEGORY . - data COMPANY type ZEXCEL_COMPANY value 'abap2xlsx'. "#EC NOTEXT . - data APPLICATION type ZEXCEL_APPLICATION value 'Microsoft Excel'. "#EC NOTEXT . - data DOCSECURITY type ZEXCEL_DOCSECURITY value '0'. "#EC NOTEXT . - data SCALECROP type ZEXCEL_SCALECROP value ''. "#EC NOTEXT . - data LINKSUPTODATE type FLAG . - data SHAREDDOC type FLAG . - data HYPERLINKSCHANGED type FLAG . - data APPVERSION type ZEXCEL_APPVERSION value '12.0000'. "#EC NOTEXT . - - methods CONSTRUCTOR . - *"* protected components of class ZABAP_EXCEL_PROPERTIES -*"* do not include other source files here!!! -protected section. - *"* private components of class ZCL_EXCEL_PROPERTIES -*"* do not include other source files here!!! -private section. - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - - DATA: lv_timestamp TYPE timestampl. - - GET TIME STAMP FIELD lv_timestamp. - created = lv_timestamp. - modified = lv_timestamp. - -endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_RANGE.slnk b/ZA2X/CLAS/ZCL_EXCEL_RANGE.slnk deleted file mode 100644 index 4b9a9bb..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_RANGE.slnk +++ /dev/null @@ -1,59 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - method GET_GUID. - - ep_guid = me->guid. - - endmethod. - - - - method GET_VALUE. - - ep_value = me->value. - - endmethod. - - - - method SET_RANGE_VALUE. - me->value = ip_value. - endmethod. - - - - - - - - method SET_VALUE. - DATA: lv_start_row_c TYPE char7, - lv_stop_row_c TYPE char7, - lv_value TYPE string. - lv_stop_row_c = ip_stop_row. - SHIFT lv_stop_row_c RIGHT DELETING TRAILING space. - SHIFT lv_stop_row_c LEFT DELETING LEADING space. - lv_start_row_c = ip_start_row. - SHIFT lv_start_row_c RIGHT DELETING TRAILING space. - SHIFT lv_start_row_c LEFT DELETING LEADING space. - lv_value = ip_sheet_name. - me->value = zcl_excel_common=>escape_string( ip_value = lv_value ). - - CONCATENATE me->value '!$' ip_start_column '$' lv_start_row_c ':$' ip_stop_column '$' lv_stop_row_c INTO me->value. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_RANGES.slnk b/ZA2X/CLAS/ZCL_EXCEL_RANGES.slnk deleted file mode 100644 index dd4a028..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_RANGES.slnk +++ /dev/null @@ -1,62 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - method ADD. - ranges->add( ip_range ). - endmethod. - - - method CLEAR. - ranges->clear( ). - endmethod. - - - method CONSTRUCTOR. - - - CREATE OBJECT ranges. - - endmethod. - - - - - method GET. - eo_range ?= ranges->if_object_collection~get( ip_index ). - endmethod. - - - - method GET_ITERATOR. - eo_iterator ?= ranges->if_object_collection~get_iterator( ). - endmethod. - - - - method IS_EMPTY. - is_empty = ranges->if_object_collection~is_empty( ). - endmethod. - - - - method REMOVE. - ranges->remove( ip_range ). - endmethod. - - - - method SIZE. - ep_size = ranges->if_object_collection~size( ). - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk deleted file mode 100644 index 4294704..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ /dev/null @@ -1,3990 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - TYPES: BEGIN OF t_relationship, - id TYPE string, - type TYPE string, - target TYPE string, - END OF t_relationship. - -* - CLASS lcl_abap_zip_archive DEFINITION - INHERITING FROM lcl_zip_archive - CREATE PRIVATE. - PUBLIC SECTION. - CLASS-METHODS create - IMPORTING i_data TYPE xstring - RETURNING value(r_zip) TYPE REF TO lcl_zip_archive - RAISING zcx_excel. - METHODS read REDEFINITION. - PRIVATE SECTION. - DATA: abap_zip TYPE REF TO cl_abap_zip. - METHODS constructor IMPORTING i_data TYPE xstring - RAISING zcx_excel. - ENDCLASS. "lcl_abap_zip_archive DEFINITION - -* - CLASS lcl_alternate_zip_archive DEFINITION - INHERITING FROM lcl_zip_archive - CREATE PRIVATE. - PUBLIC SECTION. - CLASS-METHODS create - IMPORTING i_data TYPE xstring - i_alternate_zip_class TYPE seoclsname - RETURNING value(r_zip) TYPE REF TO lcl_zip_archive - RAISING zcx_excel. - METHODS read REDEFINITION. - PRIVATE SECTION. - DATA: alternate_zip TYPE REF TO object. - METHODS constructor - IMPORTING i_data TYPE xstring - i_alternate_zip_class TYPE seoclsname - RAISING zcx_excel. - ENDCLASS. "lcl_alternate_zip_archive DEFINITION - -* - CLASS lcl_abap_zip_archive IMPLEMENTATION. - METHOD create. - CREATE OBJECT r_zip TYPE lcl_abap_zip_archive - EXPORTING - i_data = i_data. - ENDMETHOD. "create - METHOD constructor. - DATA: lv_errormessage TYPE string. - super->constructor( ). - CREATE OBJECT abap_zip. - abap_zip->load( - EXPORTING - zip = i_data - EXCEPTIONS - zip_parse_error = 1 - OTHERS = 2 ). - IF sy-subrc <> 0. - lv_errormessage = 'ZIP parse error'(002). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ENDMETHOD. "constructor - METHOD read. - DATA: lv_errormessage TYPE string. - CALL METHOD abap_zip->get - EXPORTING - name = i_filename - IMPORTING - content = r_content - EXCEPTIONS - zip_index_error = 1 - zip_decompression_error = 2 - OTHERS = 3. - IF sy-subrc <> 0. - lv_errormessage = 'File not found in zip-archive'(003). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ENDMETHOD. "read - ENDCLASS. "lcl_abap_zip_archive IMPLEMENTATION - -* - CLASS lcl_alternate_zip_archive IMPLEMENTATION. - METHOD create. - CREATE OBJECT r_zip TYPE lcl_alternate_zip_archive - EXPORTING - i_alternate_zip_class = i_alternate_zip_class - i_data = i_data. - ENDMETHOD. "create - METHOD constructor. - DATA: lv_errormessage TYPE string. - super->constructor( ). - CREATE OBJECT alternate_zip TYPE (i_alternate_zip_class). - TRY. - CALL METHOD alternate_zip->('LOAD') - EXPORTING - zip = i_data - EXCEPTIONS - zip_parse_error = 1 - OTHERS = 2. - CATCH cx_sy_dyn_call_illegal_method. - lv_errormessage = 'Method LOAD missing in alternative zipclass'. "#EC NOTEXT This is a workaround until class CL_ABAP_ZIP is fixed - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDTRY. - - IF sy-subrc <> 0. - lv_errormessage = 'ZIP parse error'(002). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ENDMETHOD. "constructor - METHOD read. - DATA: lv_errormessage TYPE string. - TRY. - CALL METHOD alternate_zip->('GET') - EXPORTING - name = i_filename - IMPORTING - content = r_content " Contents - EXCEPTIONS - zip_index_error = 1 - zip_decompression_error = 2 - OTHERS = 3. - CATCH cx_sy_dyn_call_illegal_method. - lv_errormessage = 'Method GET missing in alternative zipclass'. "#EC NOTEXT This is a workaround until class CL_ABAP_ZIP is fixed - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDTRY. - IF sy-subrc <> 0. - lv_errormessage = 'File not found in zip-archive'(003). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ENDMETHOD. "read - ENDCLASS. "lcl_alternate_zip_archive IMPLEMENTATION - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - -* -class lcl_zip_archive definition abstract. - public section. - methods read abstract - importing i_filename type csequence - returning value(r_content) type xstring " Remember copy-on-write! - raising zcx_excel. -endclass. - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - IXML - - - - - - - METHOD zif_excel_reader~load. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Map Document Properties to ZCL_EXCEL -*--------------------------------------------------------------------* - - CONSTANTS: lcv_core_properties TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', - lcv_office_document TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'. - - DATA: lo_rels TYPE REF TO if_ixml_document, - lo_node TYPE REF TO if_ixml_element, - ls_relationship TYPE t_relationship. - -*--------------------------------------------------------------------* -* §1 Create EXCEL-Object we want to return to caller - -* §2 We need to read the the file "\\_rels\.rels" because it tells -* us where in this folder structure the data for the workbook -* is located in the xlsx zip-archive -* -* The xlsx Zip-archive has generally the following folder structure: -* <root> | -* |--> _rels -* |--> doc_Props -* |--> xl | -* |--> _rels -* |--> theme -* |--> worksheets - -* §3 Extracting from this the path&file where the workbook is located -* Following is an example how this file could be set up -* <?xml version="1.0" encoding="UTF-8" standalone="true"?> -* <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> -* <Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId3"/> -* <Relationship Target="docProps/core.xml" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Id="rId2"/> -* <Relationship Target="xl/workbook.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Id="rId1"/> -* </Relationships> -*--------------------------------------------------------------------* - - -*--------------------------------------------------------------------* -* §1 Create EXCEL-Object we want to return to caller -*--------------------------------------------------------------------* - IF iv_zcl_excel_classname IS INITIAL. - CREATE OBJECT r_excel. - ELSE. - CREATE OBJECT r_excel TYPE (iv_zcl_excel_classname). - ENDIF. - - zip = create_zip_archive( i_xlsx_binary = i_excel2007 - i_use_alternate_zip = i_use_alternate_zip ). - -*--------------------------------------------------------------------* -* §2 Get file in folderstructure -*--------------------------------------------------------------------* - lo_rels = get_ixml_from_zip_archive( '_rels/.rels' ). - -*--------------------------------------------------------------------* -* §3 Cycle through the Relationship Tags and use the ones we need -*--------------------------------------------------------------------* - lo_node ?= lo_rels->find_from_name( 'Relationship' ). "#EC NOTEXT - WHILE lo_node IS BOUND. - - fill_struct_from_attributes( EXPORTING - ip_element = lo_node - CHANGING - cp_structure = ls_relationship ). - CASE ls_relationship-type. - - WHEN lcv_office_document. -*--------------------------------------------------------------------* -* Parse workbook - main part here -*--------------------------------------------------------------------* - load_workbook( iv_workbook_full_filename = ls_relationship-target - io_excel = r_excel ). - - WHEN lcv_core_properties. - " 2do§1 Map Document Properties to ZCL_EXCEL - - WHEN OTHERS. - - ENDCASE. - lo_node ?= lo_node->get_next( ). - - ENDWHILE. - - -ENDMETHOD. - - - METHOD zif_excel_reader~load_file. - - DATA: lv_excel_data TYPE xstring. - -*--------------------------------------------------------------------* -* Read file into binary string -*--------------------------------------------------------------------* - IF i_from_applserver = abap_true. - lv_excel_data = read_from_applserver( i_filename ). - ELSE. - lv_excel_data = read_from_local_file( i_filename ). - ENDIF. - -*--------------------------------------------------------------------* -* Parse Excel data into ZCL_EXCEL object from binary string -*--------------------------------------------------------------------* - r_excel = zif_excel_reader~load( i_excel2007 = lv_excel_data - i_use_alternate_zip = i_use_alternate_zip - iv_zcl_excel_classname = iv_zcl_excel_classname ). - -ENDMETHOD. - - - - - - - METHOD create_zip_archive. - CASE i_use_alternate_zip. - WHEN space. - e_zip = lcl_abap_zip_archive=>create( i_xlsx_binary ). - WHEN OTHERS. - e_zip = lcl_alternate_zip_archive=>create( i_data = i_xlsx_binary - i_alternate_zip_class = i_use_alternate_zip ). - ENDCASE. -ENDMETHOD. - - - - - METHOD fill_row_outlines. - - TYPES: BEGIN OF lts_row_data, - row TYPE i, - outline_level TYPE i, - END OF lts_row_data, - ltt_row_data TYPE SORTED TABLE OF lts_row_data WITH UNIQUE KEY row. - - DATA: lt_row_dimensions TYPE zexcel_t_worksheet_rowdimensio, - - lt_row_data TYPE ltt_row_data, - ls_row_data LIKE LINE OF lt_row_data, - lt_collapse_rows TYPE HASHED TABLE OF i WITH UNIQUE KEY table_line, - - lv_collapsed TYPE abap_bool, - - lv_outline_level TYPE i, - lv_next_consecutive_row TYPE i, - lt_outline_rows TYPE zcl_excel_worksheet=>mty_ts_outlines_row, - ls_outline_row LIKE LINE OF lt_outline_rows, - - lv_row_offset TYPE i, - lv_row_collapse_flag TYPE i. - - - FIELD-SYMBOLS: <ls_row_dimension> LIKE LINE OF lt_row_dimensions, - <ls_row_data> LIKE LINE OF lt_row_data. - -* First collect information about outlines ( outline leven and collapsed state ) - lt_row_dimensions = io_worksheet->get_row_dimensions( ). - LOOP AT lt_row_dimensions ASSIGNING <ls_row_dimension>. - - ls_row_data-row = <ls_row_dimension>-row. - ls_row_data-outline_level = <ls_row_dimension>-row_dimension->get_outline_level( ). - IF ls_row_data-outline_level IS NOT INITIAL. - INSERT ls_row_data INTO TABLE lt_row_data. - ENDIF. - - lv_collapsed = <ls_row_dimension>-row_dimension->get_collapsed( ). - IF lv_collapsed = abap_true. - INSERT <ls_row_dimension>-row INTO TABLE lt_collapse_rows. - ENDIF. - - ENDLOOP. - -* Now parse this information - we need consecutive rows - any gap will create a new outline - DO 7 TIMES. " max number of outlines allowed - lv_outline_level = sy-index. - CLEAR lv_next_consecutive_row. - CLEAR ls_outline_row. - LOOP AT lt_row_data ASSIGNING <ls_row_data> WHERE outline_level >= lv_outline_level. - - IF lv_next_consecutive_row <> <ls_row_data>-row " A gap --> close all open outlines - AND lv_next_consecutive_row IS NOT INITIAL. " First time in loop. - INSERT ls_outline_row INTO TABLE lt_outline_rows. - CLEAR: ls_outline_row. - ENDIF. - - IF ls_outline_row-row_from IS INITIAL. - ls_outline_row-row_from = <ls_row_data>-row. - ENDIF. - ls_outline_row-row_to = <ls_row_data>-row. - - lv_next_consecutive_row = <ls_row_data>-row + 1. - - ENDLOOP. - IF ls_outline_row-row_from IS NOT INITIAL. - INSERT ls_outline_row INTO TABLE lt_outline_rows. - ENDIF. - ENDDO. - -* lt_outline_rows holds all outline information -* we now need to determine whether the outline is collapsed or not - LOOP AT lt_outline_rows INTO ls_outline_row. - - IF io_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_off. - lv_row_collapse_flag = ls_outline_row-row_from - 1. - ELSE. - lv_row_collapse_flag = ls_outline_row-row_to + 1. - ENDIF. - READ TABLE lt_collapse_rows TRANSPORTING NO FIELDS WITH TABLE KEY table_line = lv_row_collapse_flag. - IF sy-subrc = 0. - ls_outline_row-collapsed = abap_true. - ENDIF. - io_worksheet->set_row_outline( iv_row_from = ls_outline_row-row_from - iv_row_to = ls_outline_row-row_to - iv_collapsed = ls_outline_row-collapsed ). - - ENDLOOP. - -* Finally purge outline information ( collapsed state, outline leve) from row_dimensions, since we want to keep these in the outline-table - LOOP AT lt_row_dimensions ASSIGNING <ls_row_dimension>. - - <ls_row_dimension>-row_dimension->set_outline_level( 0 ). - <ls_row_dimension>-row_dimension->set_collapsed( abap_false ). - - ENDLOOP. - -ENDMETHOD. - - - - - method fill_struct_from_attributes. -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-07 -* - ... -* changes: renaming variables to naming conventions -* aligning code -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* - - data: lv_name type string, - lo_attributes type ref to if_ixml_named_node_map, - lo_attribute type ref to if_ixml_attribute, - lo_iterator type ref to if_ixml_node_iterator. - - field-symbols: <component> type any. - -*--------------------------------------------------------------------* -* The values of named attributes of a tag are being read and moved into corresponding -* fields of given structure -* Behaves like move-corresonding tag to structure - -* Example: -* <Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId3"/> -* Here the attributes are Target, Type and Id. Thus if the passed -* structure has fieldnames Id and Target these would be filled with -* "rId3" and "docProps/app.xml" respectively -*--------------------------------------------------------------------* - clear cp_structure. - - lo_attributes = ip_element->get_attributes( ). - lo_iterator = lo_attributes->create_iterator( ). - lo_attribute ?= lo_iterator->get_next( ). - while lo_attribute is bound. - - lv_name = lo_attribute->get_name( ). - translate lv_name to upper case. - assign component lv_name of structure cp_structure to <component>. - if sy-subrc = 0. - <component> = lo_attribute->get_value( ). - endif. - lo_attribute ?= lo_iterator->get_next( ). - - endwhile. - - -endmethod. - - - - - - METHOD get_dxf_style_guid. - DATA: lo_ixml_dxf_children TYPE REF TO if_ixml_node_list, - lo_ixml_iterator_dxf_children TYPE REF TO if_ixml_node_iterator, - lo_ixml_dxf_child TYPE REF TO if_ixml_element, - - lv_dxf_child_type TYPE string, - - lo_ixml_element TYPE REF TO if_ixml_element, - lo_ixml_element2 TYPE REF TO if_ixml_element, - lv_val TYPE string. - - DATA: ls_cstyle TYPE zexcel_s_cstyle_complete, - ls_cstylex TYPE zexcel_s_cstylex_complete. - - - - lo_ixml_dxf_children = io_ixml_dxf->get_children( ). - lo_ixml_iterator_dxf_children = lo_ixml_dxf_children->create_iterator( ). - lo_ixml_dxf_child ?= lo_ixml_iterator_dxf_children->get_next( ). - WHILE lo_ixml_dxf_child IS BOUND. - - lv_dxf_child_type = lo_ixml_dxf_child->get_name( ). - CASE lv_dxf_child_type. - - WHEN 'font'. -*--------------------------------------------------------------------* -* italic -*--------------------------------------------------------------------* - lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'i' ). - IF lo_ixml_element IS BOUND. - CLEAR lv_val. - lv_val = lo_ixml_element->get_attribute_ns( 'val' ). - IF lv_val <> '0'. - ls_cstyle-font-italic = 'X'. - ls_cstylex-font-italic = 'X'. - ENDIF. - - ENDIF. -*--------------------------------------------------------------------* -* bold -*--------------------------------------------------------------------* - lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'b' ). - IF lo_ixml_element IS BOUND. - CLEAR lv_val. - lv_val = lo_ixml_element->get_attribute_ns( 'val' ). - IF lv_val <> '0'. - ls_cstyle-font-bold = 'X'. - ls_cstylex-font-bold = 'X'. - ENDIF. - - ENDIF. -*--------------------------------------------------------------------* -* strikethrough -*--------------------------------------------------------------------* - lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'strike' ). - IF lo_ixml_element IS BOUND. - CLEAR lv_val. - lv_val = lo_ixml_element->get_attribute_ns( 'val' ). - IF lv_val <> '0'. - ls_cstyle-font-strikethrough = 'X'. - ls_cstylex-font-strikethrough = 'X'. - ENDIF. - - ENDIF. -*--------------------------------------------------------------------* -* color -*--------------------------------------------------------------------* - lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'color' ). - IF lo_ixml_element IS BOUND. - CLEAR lv_val. - lv_val = lo_ixml_element->get_attribute_ns( 'rgb' ). - ls_cstyle-font-color-rgb = lv_val. - ls_cstylex-font-color-rgb = 'X'. - ENDIF. - - WHEN 'fill'. - lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'patternFill' ). - IF lo_ixml_element IS BOUND. - lo_ixml_element2 = lo_ixml_element->find_from_name( 'bgColor' ). - IF lo_ixml_element2 IS BOUND. - CLEAR lv_val. - lv_val = lo_ixml_element2->get_attribute_ns( 'rgb' ). - IF lv_val IS NOT INITIAL. - ls_cstyle-fill-filltype = zcl_excel_style_fill=>c_fill_solid. - ls_cstyle-fill-bgcolor-rgb = lv_val. - ls_cstylex-fill-filltype = 'X'. - ls_cstylex-fill-bgcolor-rgb = 'X'. - ENDIF. - ENDIF. - CLEAR lv_val. - lv_val = lo_ixml_element2->get_attribute_ns( 'theme' ). - IF lv_val IS NOT INITIAL. - ls_cstyle-fill-filltype = zcl_excel_style_fill=>c_fill_solid. - ls_cstyle-fill-bgcolor-theme = lv_val. - ls_cstylex-fill-filltype = 'X'. - ls_cstylex-fill-bgcolor-theme = 'X'. - ENDIF. - ENDIF. - -* 2do - borders into dxf-styles. Here and in writerclass -* WHEN 'border'. -* lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'left' ). -* IF lo_ixml_element IS BOUND. -* CLEAR lv_val. -* lv_val = lo_ixml_element2->get_attribute_ns( 'style' ). -* IF lv_val IS NOT INITIAL. -* ls_cstyle-borders-left-border_style = lv_val. -* ls_cstylex-borders-left-border_style = 'X'. -* ENDIF. -* ENDIF. - - ENDCASE. - - lo_ixml_dxf_child ?= lo_ixml_iterator_dxf_children->get_next( ). - - ENDWHILE. - - - - - rv_style_guid = io_excel->get_static_cellstyle_guid( ip_cstyle_complete = ls_cstyle - ip_cstylex_complete = ls_cstylex ). - - -ENDMETHOD. - - - - - - METHOD get_from_zip_archive. - - ASSERT zip IS BOUND. " zip object has to exist at this point - - r_content = zip->read( i_filename ). - -ENDMETHOD. - - - - - - - METHOD get_ixml_from_zip_archive. - - DATA: lv_content TYPE xstring, - lo_ixml TYPE REF TO if_ixml, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_istream TYPE REF TO if_ixml_istream, - lo_parser TYPE REF TO if_ixml_parser. - -*--------------------------------------------------------------------* -* Load XML file from archive into an input stream, -* and parse that stream into an ixml object -*--------------------------------------------------------------------* - lv_content = me->get_from_zip_archive( i_filename ). - lo_ixml = cl_ixml=>create( ). - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_istream = lo_streamfactory->create_istream_xstring( lv_content ). - r_ixml = lo_ixml->create_document( ). - lo_parser = lo_ixml->create_parser( stream_factory = lo_streamfactory - istream = lo_istream - document = r_ixml ). - lo_parser->set_normalizing( is_normalizing ). - lo_parser->set_validating( mode = if_ixml_parser=>co_no_validation ). - lo_parser->parse( ). - -ENDMETHOD. - - - - - - METHOD load_drawing_anchor. - - TYPES: BEGIN OF t_c_nv_pr, - name TYPE string, - id TYPE string, - END OF t_c_nv_pr. - - TYPES: BEGIN OF t_blip, - cstate TYPE string, - embed TYPE string, - END OF t_blip. - - TYPES: BEGIN OF t_chart, - id TYPE string, - END OF t_chart. - - TYPES: BEGIN OF t_ext, - cx TYPE string, - cy TYPE string, - END OF t_ext. - - CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', - lc_xml_attr_true_int TYPE string VALUE '1'. - CONSTANTS: lc_rel_chart TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', - lc_rel_image TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'. - - DATA: lo_drawing TYPE REF TO zcl_excel_drawing, - node TYPE REF TO if_ixml_element, - node2 TYPE REF TO if_ixml_element, - node3 TYPE REF TO if_ixml_element, - node4 TYPE REF TO if_ixml_element, - - ls_upper TYPE zexcel_drawing_location, - ls_lower TYPE zexcel_drawing_location, - ls_size TYPE zexcel_drawing_size, - ext TYPE t_ext, - lv_content TYPE xstring, - lv_relation_id TYPE string, - lv_title TYPE string, - - cnvpr TYPE t_c_nv_pr, - blip TYPE t_blip, - chart TYPE t_chart, - drawing_type TYPE zexcel_drawing_type, - - rel_drawing TYPE t_rel_drawing. - - node ?= io_anchor_element->find_from_name( name = 'from' namespace = 'xdr' ). - CHECK node IS NOT INITIAL. - node2 ?= node->find_from_name( name = 'col' namespace = 'xdr' ). - ls_upper-col = node2->get_value( ). - node2 ?= node->find_from_name( name = 'row' namespace = 'xdr' ). - ls_upper-row = node2->get_value( ). - node2 ?= node->find_from_name( name = 'colOff' namespace = 'xdr' ). - ls_upper-col_offset = node2->get_value( ). - node2 ?= node->find_from_name( name = 'rowOff' namespace = 'xdr' ). - ls_upper-row_offset = node2->get_value( ). - - node ?= io_anchor_element->find_from_name( name = 'ext' namespace = 'xdr' ). - IF node IS INITIAL. - CLEAR ls_size. - ELSE. - me->fill_struct_from_attributes( EXPORTING ip_element = node CHANGING cp_structure = ext ). - ls_size-width = ext-cx. - ls_size-height = ext-cy. - TRY. - ls_size-width = zcl_excel_drawing=>emu2pixel( ls_size-width ). - CATCH cx_root. - ENDTRY. - TRY. - ls_size-height = zcl_excel_drawing=>emu2pixel( ls_size-height ). - CATCH cx_root. - ENDTRY. - ENDIF. - - node ?= io_anchor_element->find_from_name( name = 'to' namespace = 'xdr' ). - IF node IS INITIAL. - CLEAR ls_lower. - ELSE. - node2 ?= node->find_from_name( name = 'col' namespace = 'xdr' ). - ls_lower-col = node2->get_value( ). - node2 ?= node->find_from_name( name = 'row' namespace = 'xdr' ). - ls_lower-row = node2->get_value( ). - node2 ?= node->find_from_name( name = 'colOff' namespace = 'xdr' ). - ls_lower-col_offset = node2->get_value( ). - node2 ?= node->find_from_name( name = 'rowOff' namespace = 'xdr' ). - ls_lower-row_offset = node2->get_value( ). - ENDIF. - - node ?= io_anchor_element->find_from_name( name = 'pic' namespace = 'xdr' ). - IF node IS NOT INITIAL. - node2 ?= node->find_from_name( name = 'nvPicPr' namespace = 'xdr' ). - CHECK node2 IS NOT INITIAL. - node3 ?= node2->find_from_name( name = 'cNvPr' namespace = 'xdr' ). - CHECK node3 IS NOT INITIAL. - me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = cnvpr ). - lv_title = cnvpr-name. - - node2 ?= node->find_from_name( name = 'blipFill' namespace = 'xdr' ). - CHECK node2 IS NOT INITIAL. - node3 ?= node2->find_from_name( name = 'blip' namespace = 'a' ). - CHECK node3 IS NOT INITIAL. - me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = blip ). - lv_relation_id = blip-embed. - - drawing_type = zcl_excel_drawing=>type_image. - ENDIF. - - node ?= io_anchor_element->find_from_name( name = 'graphicFrame' namespace = 'xdr' ). - IF node IS NOT INITIAL. - node2 ?= node->find_from_name( name = 'nvGraphicFramePr' namespace = 'xdr' ). - CHECK node2 IS NOT INITIAL. - node3 ?= node2->find_from_name( name = 'cNvPr' namespace = 'xdr' ). - CHECK node3 IS NOT INITIAL. - me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = cnvpr ). - lv_title = cnvpr-name. - - node2 ?= node->find_from_name( name = 'graphic' namespace = 'a' ). - CHECK node2 IS NOT INITIAL. - node3 ?= node2->find_from_name( name = 'graphicData' namespace = 'a' ). - CHECK node3 IS NOT INITIAL. - node4 ?= node2->find_from_name( name = 'chart' namespace = 'c' ). - CHECK node4 IS NOT INITIAL. - me->fill_struct_from_attributes( EXPORTING ip_element = node4 CHANGING cp_structure = chart ). - lv_relation_id = chart-id. - - drawing_type = zcl_excel_drawing=>type_chart. - ENDIF. - - lo_drawing = io_worksheet->excel->add_new_drawing( - ip_type = drawing_type - ip_title = lv_title ). - io_worksheet->add_drawing( lo_drawing ). - - lo_drawing->set_position2( - EXPORTING - ip_from = ls_upper - ip_to = ls_lower ). - - READ TABLE it_related_drawings INTO rel_drawing - WITH KEY id = lv_relation_id. - - lo_drawing->set_media( - EXPORTING - ip_media = rel_drawing-content - ip_media_type = rel_drawing-file_ext - ip_width = ls_size-width - ip_height = ls_size-height ). - - IF drawing_type = zcl_excel_drawing=>type_chart. - "-------------Added by Alessandro Iannacci - Should load chart attributes - lo_drawing->load_chart_attributes( rel_drawing-content_xml ). - ENDIF. - -ENDMETHOD. - - - - - - METHOD load_dxf_styles. - - DATA: lo_styles_xml TYPE REF TO if_ixml_document, - lo_node_dxfs TYPE REF TO if_ixml_element, - - lo_nodes_dxf TYPE REF TO if_ixml_node_collection, - lo_iterator_dxf TYPE REF TO if_ixml_node_iterator, - lo_node_dxf TYPE REF TO if_ixml_element, - - lv_dxf_count TYPE i. - - FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF mt_dxf_styles. - -*--------------------------------------------------------------------* -* Look for dxfs-node -*--------------------------------------------------------------------* - lo_styles_xml = me->get_ixml_from_zip_archive( iv_path ). - lo_node_dxfs = lo_styles_xml->find_from_name( 'dxfs' ). - CHECK lo_node_dxfs IS BOUND. - - -*--------------------------------------------------------------------* -* loop through all dxf-nodes and create style for each -*--------------------------------------------------------------------* - lo_nodes_dxf ?= lo_node_dxfs->get_elements_by_tag_name( 'dxf' ). - lo_iterator_dxf = lo_nodes_dxf->create_iterator( ). - lo_node_dxf ?= lo_iterator_dxf->get_next( ). - WHILE lo_node_dxf IS BOUND. - - APPEND INITIAL LINE TO mt_dxf_styles ASSIGNING <ls_dxf_style>. - <ls_dxf_style>-dxf = lv_dxf_count. " We start counting at 0 - ADD 1 TO lv_dxf_count. " prepare next entry - - <ls_dxf_style>-guid = get_dxf_style_guid( io_ixml_dxf = lo_node_dxf - io_excel = io_excel ). - lo_node_dxf ?= lo_iterator_dxf->get_next( ). - - ENDWHILE. - - -ENDMETHOD. - - - - - method LOAD_SHARED_STRINGS. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Support partial formatting of strings in cells -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-11 -* - ... -* changes: renaming variables to naming conventions -* renaming variables to indicate what they are used for -* aligning code -* adding comments to explain what we are trying to achieve -* rewriting code for better readibility -*--------------------------------------------------------------------* - - - - DATA: - lo_shared_strings_xml TYPE REF TO if_ixml_document, - lo_node_si TYPE REF TO if_ixml_element, - lo_node_si_child TYPE REF TO if_ixml_element, - lo_node_r_child_t TYPE REF TO if_ixml_element, - lv_tag_name TYPE string, - lv_node_value TYPE string. - - FIELD-SYMBOLS: <lv_shared_string> LIKE LINE OF me->shared_strings. - -*--------------------------------------------------------------------* - -* §1 Parse shared strings file and get into internal table -* So far I have encountered 2 ways how a string can be represented in the shared strings file -* §1.1 - "simple" strings -* §1.2 - rich text formatted strings - -* Following is an example how this file could be set up; 2 strings in simple formatting, 3rd string rich textformatted - - -* <?xml version="1.0" encoding="UTF-8" standalone="true"?> -* <sst uniqueCount="6" count="6" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> -* <si> -* <t>This is a teststring 1</t> -* </si> -* <si> -* <t>This is a teststring 2</t> -* </si> -* <si> -* <r> -* <t>T</t> -* </r> -* <r> -* <rPr> -* <sz val="11"/> -* <color rgb="FFFF0000"/> -* <rFont val="Calibri"/> -* <family val="2"/> -* <scheme val="minor"/> -* </rPr> -* <t xml:space="preserve">his is a </t> -* </r> -* <r> -* <rPr> -* <sz val="11"/> -* <color theme="1"/> -* <rFont val="Calibri"/> -* <family val="2"/> -* <scheme val="minor"/> -* </rPr> -* <t>teststring 3</t> -* </r> -* </si> -* </sst> -*--------------------------------------------------------------------* - - lo_shared_strings_xml = me->get_ixml_from_zip_archive( i_filename = ip_path - is_normalizing = space ). " NO!!! normalizing - otherwise leading blanks will be omitted and that is not really desired for the stringtable - lo_node_si ?= lo_shared_strings_xml->find_from_name( 'si' ). - WHILE lo_node_si IS BOUND. - - APPEND INITIAL LINE TO me->shared_strings ASSIGNING <lv_shared_string>. " Each <si>-entry in the xml-file must lead to an entry in our stringtable - lo_node_si_child ?= lo_node_si->get_first_child( ). - IF lo_node_si_child IS BOUND. - lv_tag_name = lo_node_si_child->get_name( ). - IF lv_tag_name = 't'. -*--------------------------------------------------------------------* -* §1.1 - "simple" strings -* Example: see above -*--------------------------------------------------------------------* - <lv_shared_string> = lo_node_si_child->get_value( ). - ELSE. -*--------------------------------------------------------------------* -* §1.2 - rich text formatted strings -* it is sufficient to strip the <t>...</t> tag from each <r>-tag and concatenate these -* as long as rich text formatting is not supported (2do§1) ignore all info about formatting -* Example: see above -*--------------------------------------------------------------------* - WHILE lo_node_si_child IS BOUND. " actually these children of <si> are <r>-tags - - lo_node_r_child_t ?= lo_node_si_child->find_from_name( 't' ). " extract the <t>...</t> part of each <r>-tag - IF lo_node_r_child_t IS BOUND. - lv_node_value = lo_node_r_child_t->get_value( ). - CONCATENATE <lv_shared_string> lv_node_value INTO <lv_shared_string> RESPECTING BLANKS. - ENDIF. - - lo_node_si_child ?= lo_node_si_child->get_next( ). - - ENDWHILE. - ENDIF. - ENDIF. - - lo_node_si ?= lo_node_si->get_next( ). - ENDWHILE. - - endmethod. - - - - - - METHOD load_styles. - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (wip ) 2012-11-25 -* - ... -* changes: renaming variables and types to naming conventions -* aligning code -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* - TYPES: BEGIN OF lty_xf, - applyalignment TYPE string, - applyborder TYPE string, - applyfill TYPE string, - applyfont TYPE string, - applynumberformat TYPE string, - applyprotection TYPE string, - borderid TYPE string, - fillid TYPE string, - fontid TYPE string, - numfmtid TYPE string, - pivotbutton TYPE string, - quoteprefix TYPE string, - xfid TYPE string, - END OF lty_xf. - - TYPES: BEGIN OF lty_alignment, - horizontal TYPE string, - indent TYPE string, - justifylastline TYPE string, - readingorder TYPE string, - relativeindent TYPE string, - shrinktofit TYPE string, - textrotation TYPE string, - vertical TYPE string, - wraptext TYPE string, - END OF lty_alignment. - - TYPES: BEGIN OF lty_protection, - hidden TYPE string, - locked TYPE string, - END OF lty_protection. - - DATA: lo_styles_xml TYPE REF TO if_ixml_document, - lo_style TYPE REF TO zcl_excel_style, - - lt_num_formats TYPE zcl_excel_style_number_format=>t_num_formats, - lt_fills TYPE t_fills, - lt_borders TYPE t_borders, - lt_fonts TYPE t_fonts, - - ls_num_format TYPE zcl_excel_style_number_format=>t_num_format , - ls_fill TYPE REF TO zcl_excel_style_fill, - ls_cell_border TYPE REF TO zcl_excel_style_borders, - ls_font TYPE REF TO zcl_excel_style_font, - - lo_node_cellxfs TYPE REF TO if_ixml_element, - lo_node_cellxfs_xf TYPE REF TO if_ixml_element, - lo_node_cellxfs_xf_alignment TYPE REF TO if_ixml_element, - lo_node_cellxfs_xf_protection TYPE REF TO if_ixml_element, - - lo_nodes_xf TYPE REF TO if_ixml_node_collection, - lo_iterator_cellxfs TYPE REF TO if_ixml_node_iterator, - - ls_xf TYPE lty_xf, - ls_alignment TYPE lty_alignment, - ls_protection TYPE lty_protection, - lv_index TYPE i. - -*--------------------------------------------------------------------* -* To build a complete style that fully describes how a cell looks like -* we need the various parts -* §1 - Numberformat -* §2 - Fillstyle -* §3 - Borders -* §4 - Font -* §5 - Alignment -* §6 - Protection - -* Following is an example how this part of a file could be set up -* ... -* parts with various formatinformation - see §1,§2,§3,§4 -* ... -* <cellXfs count="26"> -* <xf numFmtId="0" borderId="0" fillId="0" fontId="0" xfId="0"/> -* <xf numFmtId="0" borderId="0" fillId="2" fontId="0" xfId="0" applyFill="1"/> -* <xf numFmtId="0" borderId="1" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> -* <xf numFmtId="0" borderId="2" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> -* <xf numFmtId="0" borderId="3" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> -* <xf numFmtId="0" borderId="4" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> -* <xf numFmtId="0" borderId="0" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> -* ... -* </cellXfs> -*--------------------------------------------------------------------* - - lo_styles_xml = me->get_ixml_from_zip_archive( ip_path ). - -*--------------------------------------------------------------------* -* The styles are build up from -* §1 number formats -* §2 fill styles -* §3 border styles -* §4 fonts -* These need to be read before we can try to build up a complete -* style that describes the look of a cell -*--------------------------------------------------------------------* - lt_num_formats = load_style_num_formats( lo_styles_xml ). " §1 - lt_fills = load_style_fills( lo_styles_xml ). " §2 - lt_borders = load_style_borders( lo_styles_xml ). " §3 - lt_fonts = load_style_fonts( lo_styles_xml ). " §4 - -*--------------------------------------------------------------------* -* Now everything is prepared to build a "full" style -*--------------------------------------------------------------------* - lo_node_cellxfs = lo_styles_xml->find_from_name( name = 'cellXfs' ). - IF lo_node_cellxfs IS BOUND. - lo_nodes_xf = lo_node_cellxfs->get_elements_by_tag_name( name = 'xf' ). - lo_iterator_cellxfs = lo_nodes_xf->create_iterator( ). - lo_node_cellxfs_xf ?= lo_iterator_cellxfs->get_next( ). - WHILE lo_node_cellxfs_xf IS BOUND. - - lo_style = ip_excel->add_new_style( ). - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_cellxfs_xf - CHANGING - cp_structure = ls_xf ). -*--------------------------------------------------------------------* -* §2 fill style -*--------------------------------------------------------------------* - IF ls_xf-applyfill = '1' AND ls_xf-fillid IS NOT INITIAL. - lv_index = ls_xf-fillid + 1. - READ TABLE lt_fills INTO ls_fill INDEX lv_index. - IF sy-subrc = 0. - lo_style->fill = ls_fill. - ENDIF. - ENDIF. - -*--------------------------------------------------------------------* -* §1 number format -*--------------------------------------------------------------------* - IF ls_xf-numfmtid IS NOT INITIAL. - READ TABLE lt_num_formats INTO ls_num_format WITH TABLE KEY id = ls_xf-numfmtid. - IF sy-subrc = 0. - lo_style->number_format = ls_num_format-format. - ENDIF. - ENDIF. - -*--------------------------------------------------------------------* -* §3 border style -*--------------------------------------------------------------------* - IF ls_xf-applyborder = '1' AND ls_xf-borderid IS NOT INITIAL. - lv_index = ls_xf-borderid + 1. - READ TABLE lt_borders INTO ls_cell_border INDEX lv_index. - IF sy-subrc = 0. - lo_style->borders = ls_cell_border. - ENDIF. - ENDIF. - -*--------------------------------------------------------------------* -* §4 font -*--------------------------------------------------------------------* - IF ls_xf-applyfont = '1' AND ls_xf-fontid IS NOT INITIAL. - lv_index = ls_xf-fontid + 1. - READ TABLE lt_fonts INTO ls_font INDEX lv_index. - IF sy-subrc = 0. - lo_style->font = ls_font. - ENDIF. - ENDIF. - -*--------------------------------------------------------------------* -* §5 - Alignment -*--------------------------------------------------------------------* - lo_node_cellxfs_xf_alignment ?= lo_node_cellxfs_xf->find_from_name( 'alignment' ). - IF lo_node_cellxfs_xf_alignment IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_cellxfs_xf_alignment - CHANGING - cp_structure = ls_alignment ). - IF ls_alignment-horizontal IS NOT INITIAL. - lo_style->alignment->horizontal = ls_alignment-horizontal. - ENDIF. - - IF ls_alignment-vertical IS NOT INITIAL. - lo_style->alignment->vertical = ls_alignment-vertical. - ENDIF. - - IF ls_alignment-textrotation IS NOT INITIAL. - lo_style->alignment->textrotation = ls_alignment-textrotation. - ENDIF. - - IF ls_alignment-wraptext = '1' OR ls_alignment-wraptext = 'true'. - lo_style->alignment->wraptext = abap_true. - ENDIF. - - IF ls_alignment-shrinktofit = '1' OR ls_alignment-shrinktofit = 'true'. - lo_style->alignment->shrinktofit = abap_true. - ENDIF. - - IF ls_alignment-indent IS NOT INITIAL. - lo_style->alignment->indent = ls_alignment-indent. - ENDIF. - ENDIF. - -*--------------------------------------------------------------------* -* §6 - Protection -*--------------------------------------------------------------------* - lo_node_cellxfs_xf_protection ?= lo_node_cellxfs_xf->find_from_name( 'protection' ). - IF lo_node_cellxfs_xf_protection IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_cellxfs_xf_protection - CHANGING - cp_structure = ls_protection ). - IF ls_protection-locked = '1' OR ls_protection-locked = 'true'. - lo_style->protection->locked = zcl_excel_style_protection=>c_protection_locked. - ELSE. - lo_style->protection->locked = zcl_excel_style_protection=>c_protection_unlocked. - ENDIF. - - IF ls_protection-hidden = '1' OR ls_protection-hidden = 'true'. - lo_style->protection->hidden = zcl_excel_style_protection=>c_protection_hidden. - ELSE. - lo_style->protection->hidden = zcl_excel_style_protection=>c_protection_unhidden. - ENDIF. - - ENDIF. - - INSERT lo_style INTO TABLE me->styles. - - lo_node_cellxfs_xf ?= lo_iterator_cellxfs->get_next( ). - - ENDWHILE. - ENDIF. - -ENDMETHOD. - - - - - method LOAD_STYLE_BORDERS. - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-25 -* - ... -* changes: renaming variables and types to naming conventions -* aligning code -* renaming variables to indicate what they are used for -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* - DATA: lo_node_border TYPE REF TO if_ixml_element, - lo_node_bordertype TYPE REF TO if_ixml_element, - lo_node_bordercolor TYPE REF TO if_ixml_element, - lo_cell_border TYPE REF TO zcl_excel_style_borders, - lo_border TYPE REF TO zcl_excel_style_border, - ls_color TYPE t_color. - -*--------------------------------------------------------------------* -* We need a table of used borderformats to build up our styles -* §1 A cell has 4 outer borders and 2 diagonal "borders" -* These borders can be formatted separately but the diagonal borders -* are always being formatted the same -* We'll parse through the <border>-tag for each of the bordertypes -* §2 and read the corresponding formatting information - -* Following is an example how this part of a file could be set up -* <border diagonalDown="1"> -* <left style="mediumDashDotDot"> -* <color rgb="FFFF0000"/> -* </left> -* <right/> -* <top style="thick"> -* <color rgb="FFFF0000"/> -* </top> -* <bottom style="thick"> -* <color rgb="FFFF0000"/> -* </bottom> -* <diagonal style="thick"> -* <color rgb="FFFF0000"/> -* </diagonal> -* </border> -*--------------------------------------------------------------------* - lo_node_border ?= ip_xml->find_from_name( 'border' ). - WHILE lo_node_border IS BOUND. - - CREATE OBJECT lo_cell_border. - -*--------------------------------------------------------------------* -* Diagonal borderlines are formatted the equally. Determine what kind of diagonal borders are present if any -*--------------------------------------------------------------------* -* DiagonalNone = 0 -* DiagonalUp = 1 -* DiagonalDown = 2 -* DiagonalBoth = 3 -*--------------------------------------------------------------------* - IF lo_node_border->get_attribute( 'diagonalDown' ) IS NOT INITIAL. - add zcl_excel_style_borders=>c_diagonal_down to lo_cell_border->diagonal_mode. - ENDIF. - - IF lo_node_border->get_attribute( 'diagonalUp' ) IS NOT INITIAL. - add zcl_excel_style_borders=>c_diagonal_up to lo_cell_border->diagonal_mode. - ENDIF. - - lo_node_bordertype ?= lo_node_border->get_first_child( ). - WHILE lo_node_bordertype IS BOUND. -*--------------------------------------------------------------------* -* §1 Determine what kind of border we are talking about -*--------------------------------------------------------------------* -* Up, down, left, right, diagonal -*--------------------------------------------------------------------* - CREATE OBJECT lo_border. - - CASE lo_node_bordertype->get_name( ). - - WHEN 'left'. - lo_cell_border->left = lo_border. - - WHEN 'right'. - lo_cell_border->right = lo_border. - - WHEN 'top'. - lo_cell_border->top = lo_border. - - WHEN 'bottom'. - lo_cell_border->down = lo_border. - - WHEN 'diagonal'. - lo_cell_border->diagonal = lo_border. - - ENDCASE. - -*--------------------------------------------------------------------* -* §2 Read the border-formatting -*--------------------------------------------------------------------* - lo_border->border_style = lo_node_bordertype->get_attribute( 'style' ). - lo_node_bordercolor ?= lo_node_bordertype->find_from_name( 'color' ). - IF lo_node_bordercolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_bordercolor - CHANGING - cp_structure = ls_color ). - - lo_border->border_color-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_border->border_color-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_border->border_color-theme = ls_color-theme. - ENDIF. - lo_border->border_color-tint = ls_color-tint. - ENDIF. - - lo_node_bordertype ?= lo_node_bordertype->get_next( ). - - ENDWHILE. - - INSERT lo_cell_border INTO TABLE ep_borders. - - lo_node_border ?= lo_node_border->get_next( ). - - ENDWHILE. - - - endmethod. - - - - - method LOAD_STYLE_FILLS. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Support gradientFill -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-25 -* - ... -* changes: renaming variables and types to naming conventions -* aligning code -* commenting on problems/future enhancements/todos we already know of or should decide upon -* adding comments to explain what we are trying to achieve -* renaming variables to indicate what they are used for -*--------------------------------------------------------------------* - DATA: lv_value TYPE string, - lo_node_fill TYPE REF TO if_ixml_element, - lo_node_fill_child TYPE REF TO if_ixml_element, - lo_node_bgcolor TYPE REF TO if_ixml_element, - lo_node_fgcolor TYPE REF TO if_ixml_element, - lo_node_stop TYPE REF TO if_ixml_element, - lo_fill TYPE REF TO zcl_excel_style_fill, - ls_color TYPE t_color. - -*--------------------------------------------------------------------* -* We need a table of used fillformats to build up our styles - -* Following is an example how this part of a file could be set up -* <fill> -* <patternFill patternType="gray125"/> -* </fill> -* <fill> -* <patternFill patternType="solid"> -* <fgColor rgb="FFFFFF00"/> -* <bgColor indexed="64"/> -* </patternFill> -* </fill> -*--------------------------------------------------------------------* - - lo_node_fill ?= ip_xml->find_from_name( 'fill' ). - WHILE lo_node_fill IS BOUND. - - CREATE OBJECT lo_fill. - lo_node_fill_child ?= lo_node_fill->get_first_child( ). - lv_value = lo_node_fill_child->get_name( ). - CASE lv_value. - -*--------------------------------------------------------------------* -* Patternfill -*--------------------------------------------------------------------* - WHEN 'patternFill'. - lo_fill->filltype = lo_node_fill_child->get_attribute( 'patternType' ). -*--------------------------------------------------------------------* -* Patternfill - background color -*--------------------------------------------------------------------* - lo_node_bgcolor = lo_node_fill_child->find_from_name( 'bgColor' ). - IF lo_node_bgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_bgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->bgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->bgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->bgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->bgcolor-tint = ls_color-tint. - ENDIF. - -*--------------------------------------------------------------------* -* Patternfill - foreground color -*--------------------------------------------------------------------* - lo_node_fgcolor = lo_node_fill->find_from_name( 'fgColor' ). - IF lo_node_fgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_fgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->fgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->fgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->fgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->fgcolor-tint = ls_color-tint. - ENDIF. - - -*--------------------------------------------------------------------* -* gradientFill -*--------------------------------------------------------------------* - WHEN 'gradientFill'. - lo_fill->gradtype-type = lo_node_fill_child->get_attribute( 'type' ). - lo_fill->gradtype-top = lo_node_fill_child->get_attribute( 'top' ). - lo_fill->gradtype-left = lo_node_fill_child->get_attribute( 'left' ). - lo_fill->gradtype-right = lo_node_fill_child->get_attribute( 'right' ). - lo_fill->gradtype-bottom = lo_node_fill_child->get_attribute( 'bottom' ). - lo_fill->gradtype-degree = lo_node_fill_child->get_attribute( 'degree' ). - free lo_node_stop. - lo_node_stop ?= lo_node_fill_child->find_from_name( 'stop' ). - while lo_node_stop is bound. - if lo_fill->gradtype-position1 is initial. - lo_fill->gradtype-position1 = lo_node_stop->get_attribute( 'position' ). - lo_node_bgcolor = lo_node_stop->find_from_name( 'color' ). - IF lo_node_bgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_bgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->bgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->bgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->bgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->bgcolor-tint = ls_color-tint. - ENDIF. - elseif lo_fill->gradtype-position2 is initial. - lo_fill->gradtype-position2 = lo_node_stop->get_attribute( 'position' ). - lo_node_fgcolor = lo_node_stop->find_from_name( 'color' ). - IF lo_node_fgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_fgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->fgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->fgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->fgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->fgcolor-tint = ls_color-tint. - ENDIF. - elseif lo_fill->gradtype-position3 is initial. - lo_fill->gradtype-position3 = lo_node_stop->get_attribute( 'position' ). - "BGColor is filled already with position 1 no need to check again - endif. - - lo_node_stop ?= lo_node_stop->get_next( ). - ENDWHILE. - - WHEN OTHERS. - - ENDCASE. - - - INSERT lo_fill INTO TABLE ep_fills. - - lo_node_fill ?= lo_node_fill->get_next( ). - - ENDWHILE. - - - endmethod. - - - - - METHOD load_style_fonts. - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-25 -* - ... -* changes: renaming variables and types to naming conventions -* aligning code -* removing unused variables -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* - DATA: lo_node_font TYPE REF TO if_ixml_element, - lo_node2 TYPE REF TO if_ixml_element, - lo_font TYPE REF TO zcl_excel_style_font, - ls_color TYPE t_color. - -*--------------------------------------------------------------------* -* We need a table of used fonts to build up our styles - -* Following is an example how this part of a file could be set up -* <font> -* <sz val="11"/> -* <color theme="1"/> -* <name val="Calibri"/> -* <family val="2"/> -* <scheme val="minor"/> -* </font> -*--------------------------------------------------------------------* - lo_node_font ?= ip_xml->find_from_name( 'font' ). - WHILE lo_node_font IS BOUND. - - CREATE OBJECT lo_font. -*--------------------------------------------------------------------* -* Bold -*--------------------------------------------------------------------* - IF lo_node_font->find_from_name( 'b' ) IS BOUND. - lo_font->bold = abap_true. - ENDIF. - -*--------------------------------------------------------------------* -* Italic -*--------------------------------------------------------------------* - IF lo_node_font->find_from_name( 'i' ) IS BOUND. - lo_font->italic = abap_true. - ENDIF. - -*--------------------------------------------------------------------* -* Underline -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'u' ). - IF lo_node2 IS BOUND. - lo_font->underline = abap_true. - lo_font->underline_mode = lo_node2->get_attribute( 'val' ). - ENDIF. - -*--------------------------------------------------------------------* -* StrikeThrough -*--------------------------------------------------------------------* - IF lo_node_font->find_from_name( 'strike' ) IS BOUND. - lo_font->strikethrough = abap_true. - ENDIF. - -*--------------------------------------------------------------------* -* Fontsize -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'sz' ). - IF lo_node2 IS BOUND. - lo_font->size = lo_node2->get_attribute( 'val' ). - ENDIF. - -*--------------------------------------------------------------------* -* Fontname -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'name' ). - IF lo_node2 IS BOUND. - lo_font->name = lo_node2->get_attribute( 'val' ). - ENDIF. - -*--------------------------------------------------------------------* -* Fontfamily -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'family' ). - IF lo_node2 IS BOUND. - lo_font->family = lo_node2->get_attribute( 'val' ). - ENDIF. - -*--------------------------------------------------------------------* -* Fontscheme -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'scheme' ). - IF lo_node2 IS BOUND. - lo_font->scheme = lo_node2->get_attribute( 'val' ). - ELSE. - CLEAR lo_font->scheme. - ENDIF. - -*--------------------------------------------------------------------* -* Fontcolor -*--------------------------------------------------------------------* - lo_node2 = lo_node_font->find_from_name( 'color' ). - IF lo_node2 IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node2 - CHANGING - cp_structure = ls_color ). - lo_font->color-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_font->color-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_font->color-theme = ls_color-theme. - ENDIF. - lo_font->color-tint = ls_color-tint. - ENDIF. - - INSERT lo_font INTO TABLE ep_fonts. - - lo_node_font ?= lo_node_font->get_next( ). - - ENDWHILE. - - -ENDMETHOD. - - - - - METHOD load_style_num_formats. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Explain gaps in predefined formats -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-25 -* - ... -* changes: renaming variables and types to naming conventions -* adding comments to explain what we are trying to achieve -* aligning code -*--------------------------------------------------------------------* - DATA: lo_node_numfmt TYPE REF TO if_ixml_element, - ls_num_format TYPE ZCL_EXCEL_STYLE_NUMBER_FORMAT=>T_NUM_FORMAT . - -*--------------------------------------------------------------------* -* We need a table of used numberformats to build up our styles -* there are two kinds of numberformats -* §1 built-in numberformats -* §2 and those that have been explicitly added by the createor of the excel-file -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* §1 built-in numberformats -*--------------------------------------------------------------------* - ep_num_formats = ZCL_EXCEL_STYLE_NUMBER_FORMAT=>mt_built_in_num_formats. - -*--------------------------------------------------------------------* -* §2 Get non-internal numberformats that are found in the file explicitly - -* Following is an example how this part of a file could be set up -* <numFmts count="1"> -* <numFmt formatCode="#,###,###,###,##0.00" numFmtId="164"/> -* </numFmts> -*--------------------------------------------------------------------* - lo_node_numfmt ?= ip_xml->find_from_name( 'numFmt' ). - WHILE lo_node_numfmt IS BOUND. - - CLEAR ls_num_format. - - CREATE OBJECT ls_num_format-format. - ls_num_format-format->format_code = lo_node_numfmt->get_attribute( 'formatCode' ). - ls_num_format-id = lo_node_numfmt->get_attribute( 'numFmtId' ). - INSERT ls_num_format INTO TABLE ep_num_formats. - - lo_node_numfmt ?= lo_node_numfmt->get_next( ). - - ENDWHILE. - - -ENDMETHOD. - - - - - method load_theme. - data theme type ref to zcl_excel_theme. - data: lo_theme_xml type ref to if_ixml_document. - create object theme. - lo_theme_xml = me->get_ixml_from_zip_archive( iv_path ). - theme->read_theme( io_theme_xml = lo_theme_xml ). - ip_excel->set_theme( io_theme = theme ). -endmethod. - - - - - - method LOAD_WORKBOOK. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Move macro-reading from zcl_excel_reader_xlsm to this class -* autodetect existance of macro/vba content -* Allow inputparameter to explicitly tell reader to ignore vba-content -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-10 -* - ... -* changes: renaming variables to naming conventions -* aligning code -* removing unused variables -* adding me-> where possible -* renaming variables to indicate what they are used for -* adding comments to explain what we are trying to achieve -* renaming i/o parameters: previous input-parameter ip_path holds a (full) filename and not a path --> rename to iv_workbook_full_filename -* ip_excel renamed while being at it --> rename to io_excel -*--------------------------------------------------------------------* -* issue #232 - Read worksheetstate hidden/veryHidden -* - Stefan Schmoecker, 2012-11-11 -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns -* - Stefan Schmoecker, 2012-12-02 -* changes: correction in named ranges to correctly attach -* sheetlocal names/ranges to the correct sheet -*--------------------------------------------------------------------* -* issue#284 - Copied formulae ignored when reading excelfile -* - Stefan Schmoecker, 2013-08-02 -* changes: initialize area to hold referenced formulaedata -* after all worksheets have been read resolve formuae -*--------------------------------------------------------------------* - - CONSTANTS: lcv_shared_strings TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', - lcv_worksheet TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', - lcv_styles TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', - lcv_vba_project TYPE string VALUE 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', "#EC NEEDED for future incorporation of XLSM-reader - lcv_theme TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', -*--------------------------------------------------------------------* -* #232: Read worksheetstate hidden/veryHidden - begin data declarations -*--------------------------------------------------------------------* - lcv_worksheet_state_hidden TYPE string VALUE 'hidden', - lcv_worksheet_state_veryhidden TYPE string VALUE 'veryHidden'. -*--------------------------------------------------------------------* -* #232: Read worksheetstate hidden/veryHidden - end data declarations -*--------------------------------------------------------------------* - - DATA: - lv_path TYPE string, - lv_filename TYPE chkfile, - lv_full_filename TYPE string, - - lo_rels_workbook TYPE REF TO if_ixml_document, - lt_worksheets TYPE STANDARD TABLE OF t_relationship WITH NON-UNIQUE DEFAULT KEY, - lo_workbook TYPE REF TO if_ixml_document, - lv_workbook_index TYPE i, - lv_worksheet_path TYPE string, - ls_sheet TYPE t_sheet, - - lo_node TYPE REF TO if_ixml_element, - ls_relationship TYPE t_relationship, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_range TYPE REF TO zcl_excel_range, - lv_worksheet_title TYPE zexcel_sheet_title, - lv_tabix TYPE sytabix, " #235 - repeat rows/cols. Needed to link defined name to correct worksheet - - ls_range TYPE t_range, - lv_range_value TYPE zexcel_range_value, -*--------------------------------------------------------------------* -* #229: Set active worksheet - begin data declarations -*--------------------------------------------------------------------* - lv_active_sheet_string TYPE string, - lv_zexcel_active_worksheet TYPE zexcel_active_worksheet, -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns - added autofilter support while changing this section - lo_autofilter TYPE REF TO zcl_excel_autofilter, - ls_area TYPE zexcel_s_autofilter_area, - lv_col_start_alpha TYPE zexcel_cell_column_alpha, - lv_col_end_alpha TYPE zexcel_cell_column_alpha, - lv_row_start TYPE zexcel_cell_row, - lv_row_end TYPE zexcel_cell_row , - lv_regex TYPE string, - lv_range_value_1 TYPE zexcel_range_value, - lv_range_value_2 TYPE zexcel_range_value. -*--------------------------------------------------------------------* -* #229: Set active worksheet - end data declarations -*--------------------------------------------------------------------* - FIELD-SYMBOLS: <worksheet> TYPE t_relationship. - - -*--------------------------------------------------------------------* - -* §1 Get the position of files related to this workbook -* Usually this will be <root>/xl/workbook.xml -* Thus the workbookroot will be <root>/xl/ -* The position of all related files will be given in file -* <workbookroot>/_rels/<workbookfilename>.rels and their positions -* be be given relative to the workbookroot - -* Following is an example how this file could be set up - -* <?xml version="1.0" encoding="UTF-8" standalone="true"?> -* <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> -* <Relationship Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId6"/> -* <Relationship Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Id="rId5"/> -* <Relationship Target="worksheets/sheet1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId1"/> -* <Relationship Target="worksheets/sheet2.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId2"/> -* <Relationship Target="worksheets/sheet3.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId3"/> -* <Relationship Target="worksheets/sheet4.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId4"/> -* <Relationship Target="sharedStrings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Id="rId7"/> -* </Relationships> -* -* §2 Load data that is relevant to the complete workbook -* Currently supported is: -* §2.1 Shared strings - This holds all strings that are used in all worksheets -* §2.2 Styles - This holds all styles that are used in all worksheets -* §2.3 Worksheets - For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet -* §2.4 [Themes] - not supported -* §2.5 [VBA (Macro)] - supported in class zcl_excel_reader_xlsm but should be moved here and autodetect -* ... -* -* §3 Some information is held in the workbookfile as well -* §3.1 Names and order of of worksheets -* §3.2 Active worksheet -* §3.3 Defined names -* ... -* Following is an example how this file could be set up - -* <?xml version="1.0" encoding="UTF-8" standalone="true"?> -* <workbook xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> -* <fileVersion rupBuild="4506" lowestEdited="4" lastEdited="4" appName="xl"/> -* <workbookPr defaultThemeVersion="124226"/> -* <bookViews> -* <workbookView activeTab="1" windowHeight="8445" windowWidth="19035" yWindow="120" xWindow="120"/> -* </bookViews> -* <sheets> -* <sheet r:id="rId1" sheetId="1" name="Sheet1"/> -* <sheet r:id="rId2" sheetId="2" name="Sheet2"/> -* <sheet r:id="rId3" sheetId="3" name="Sheet3" state="hidden"/> -* <sheet r:id="rId4" sheetId="4" name="Sheet4"/> -* </sheets> -* <definedNames/> -* <calcPr calcId="125725"/> -* </workbook> -*--------------------------------------------------------------------* - - CLEAR me->mt_ref_formulae. " ins issue#284 - -*--------------------------------------------------------------------* -* §1 Get the position of files related to this workbook -* Entry into this method is with the filename of the workbook -*--------------------------------------------------------------------* - CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' - EXPORTING - full_name = iv_workbook_full_filename - IMPORTING - stripped_name = lv_filename - file_path = lv_path. - - CONCATENATE lv_path '_rels/' lv_filename '.rels' - INTO lv_full_filename. - lo_rels_workbook = me->get_ixml_from_zip_archive( lv_full_filename ). - - lo_node ?= lo_rels_workbook->find_from_name( 'Relationship' ). "#EC NOTEXT - WHILE lo_node IS BOUND. - - me->fill_struct_from_attributes( EXPORTING ip_element = lo_node CHANGING cp_structure = ls_relationship ). - - CASE ls_relationship-type. - -*--------------------------------------------------------------------* -* §2.1 Shared strings - This holds all strings that are used in all worksheets -*--------------------------------------------------------------------* - WHEN lcv_shared_strings. - CONCATENATE lv_path ls_relationship-target - INTO lv_full_filename. - me->load_shared_strings( lv_full_filename ). - -*--------------------------------------------------------------------* -* §2.3 Worksheets -* For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet -* Shared strings and styles have to be present before we can start with creating the worksheets -* thus we only store this information for use when parsing the workbookfile for sheetinformations -*--------------------------------------------------------------------* - WHEN lcv_worksheet. - APPEND ls_relationship TO lt_worksheets. - -*--------------------------------------------------------------------* -* §2.2 Styles - This holds the styles that are used in all worksheets -*--------------------------------------------------------------------* - WHEN lcv_styles. - CONCATENATE lv_path ls_relationship-target - INTO lv_full_filename. - me->load_styles( ip_path = lv_full_filename - ip_excel = io_excel ). - me->load_dxf_styles( iv_path = lv_full_filename - io_excel = io_excel ). - when lcv_theme. - CONCATENATE lv_path ls_relationship-target - INTO lv_full_filename. - me->load_theme( - exporting - iv_path = lv_full_filename - ip_excel = io_excel " Excel creator - ). - WHEN OTHERS. - - ENDCASE. - - lo_node ?= lo_node->get_next( ). - - ENDWHILE. - -*--------------------------------------------------------------------* -* §3 Some information held in the workbookfile -*--------------------------------------------------------------------* - lo_workbook = me->get_ixml_from_zip_archive( iv_workbook_full_filename ). - -*--------------------------------------------------------------------* -* §3.1 Names and order of of worksheets -*--------------------------------------------------------------------* - lo_node ?= lo_workbook->find_from_name( 'sheet' ). - lv_workbook_index = 1. - WHILE lo_node IS BOUND. - - me->fill_struct_from_attributes( EXPORTING - ip_element = lo_node - CHANGING - cp_structure = ls_sheet ). -*--------------------------------------------------------------------* -* Create new worksheet in workbook with correct name -*--------------------------------------------------------------------* - lv_worksheet_title = ls_sheet-name. - IF lv_workbook_index = 1. " First sheet has been added automatically by creating io_excel - lo_worksheet = io_excel->get_active_worksheet( ). - lo_worksheet->set_title( lv_worksheet_title ). - ELSE. - lo_worksheet = io_excel->add_new_worksheet( lv_worksheet_title ). - ENDIF. -*--------------------------------------------------------------------* -* #232 - Read worksheetstate hidden/veryHidden - begin of coding -* Set status hidden if necessary -*--------------------------------------------------------------------* - CASE ls_sheet-state. - - WHEN lcv_worksheet_state_hidden. - lo_worksheet->zif_excel_sheet_properties~hidden = zif_excel_sheet_properties=>c_hidden. - - WHEN lcv_worksheet_state_veryhidden. - lo_worksheet->zif_excel_sheet_properties~hidden = zif_excel_sheet_properties=>c_veryhidden. - - ENDCASE. -*--------------------------------------------------------------------* -* #232 - Read worksheetstate hidden/veryHidden - end of coding -*--------------------------------------------------------------------* -*--------------------------------------------------------------------* -* Load worksheetdata -*--------------------------------------------------------------------* - READ TABLE lt_worksheets ASSIGNING <worksheet> WITH KEY id = ls_sheet-id. - IF sy-subrc = 0. - <worksheet>-sheetid = ls_sheet-sheetid. "ins #235 - repeat rows/cols - needed to identify correct sheet - CONCATENATE lv_path <worksheet>-target - INTO lv_worksheet_path. - me->load_worksheet( ip_path = lv_worksheet_path - io_worksheet = lo_worksheet ). - <worksheet>-worksheet = lo_worksheet. - ENDIF. - - lo_node ?= lo_node->get_next( ). - ADD 1 TO lv_workbook_index. - - ENDWHILE. - SORT lt_worksheets BY sheetid. " needed for localSheetid -referencing - -*--------------------------------------------------------------------* -* #284: Set active worksheet - Resolve referenced formulae to -* explicit formulae those cells -*--------------------------------------------------------------------* - me->resolve_referenced_formulae( ). - " ins issue#284 -*--------------------------------------------------------------------* -* #229: Set active worksheet - begin coding -* §3.2 Active worksheet -*--------------------------------------------------------------------* - lv_zexcel_active_worksheet = 1. " First sheet = active sheet if nothing else specified. - lo_node ?= lo_workbook->find_from_name( 'workbookView' ). - IF lo_node IS BOUND. - lv_active_sheet_string = lo_node->get_attribute( 'activeTab' ). - TRY. - lv_zexcel_active_worksheet = lv_active_sheet_string + 1. " EXCEL numbers the sheets from 0 onwards --> index into worksheettable is increased by one - CATCH cx_sy_conversion_error. "#EC NO_HANDLER - error here --> just use the default 1st sheet - ENDTRY. - ENDIF. - io_excel->set_active_sheet_index( lv_zexcel_active_worksheet ). -*--------------------------------------------------------------------* -* #229: Set active worksheet - end coding -*--------------------------------------------------------------------* - - -*--------------------------------------------------------------------* -* §3.3 Defined names -* So far I have encountered these -* - named ranges - sheetlocal -* - named ranges - workbookglobal -* - autofilters - sheetlocal ( special range ) -* - repeat rows/cols - sheetlocal ( special range ) -* -*--------------------------------------------------------------------* - lo_node ?= lo_workbook->find_from_name( 'definedName' ). - WHILE lo_node IS BOUND. - - CLEAR lo_range. "ins issue #235 - repeat rows/cols - me->fill_struct_from_attributes( EXPORTING - ip_element = lo_node - CHANGING - cp_structure = ls_range ). - lv_range_value = lo_node->get_value( ). - - IF ls_range-localsheetid IS NOT INITIAL. " issue #163+ -* READ TABLE lt_worksheets ASSIGNING <worksheet> WITH KEY id = ls_range-localsheetid. "del issue #235 - repeat rows/cols " issue #163+ -* lo_range = <worksheet>-worksheet->add_new_range( ). "del issue #235 - repeat rows/cols " issue #163+ -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns - begin -*--------------------------------------------------------------------* - lv_tabix = ls_range-localsheetid + 1. - READ TABLE lt_worksheets ASSIGNING <worksheet> INDEX lv_tabix. - IF sy-subrc = 0. - CASE ls_range-name. - -*--------------------------------------------------------------------* -* insert autofilters -*--------------------------------------------------------------------* - WHEN zcl_excel_autofilters=>c_autofilter. - lo_autofilter = io_excel->add_new_autofilter( io_sheet = <worksheet>-worksheet ) . - zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value - IMPORTING e_column_start = lv_col_start_alpha - e_column_end = lv_col_end_alpha - e_row_start = ls_area-row_start - e_row_end = ls_area-row_end ). - ls_area-col_start = zcl_excel_common=>convert_column2int( lv_col_start_alpha ). - ls_area-col_end = zcl_excel_common=>convert_column2int( lv_col_end_alpha ). - lo_autofilter->set_filter_area( is_area = ls_area ). - -*--------------------------------------------------------------------* -* repeat print rows/columns -*--------------------------------------------------------------------* - WHEN zif_excel_sheet_printsettings=>gcv_print_title_name. - lo_range = <worksheet>-worksheet->add_new_range( ). -*--------------------------------------------------------------------* -* This might be a temporary solution. Maybe ranges get be reworked -* to support areas consisting of multiple rectangles -* But for now just split the range into row and columnpart -*--------------------------------------------------------------------* - CLEAR:lv_range_value_1, - lv_range_value_2. - IF lv_range_value IS INITIAL. -* Empty --> nothing to do - ELSE. - IF lv_range_value(1) = `'`. " Escaped - lv_regex = `^('[^']*')+![^,]*,`. - ELSE. - lv_regex = `^[^!]*![^,]*,`. - ENDIF. -* Split into two ranges if necessary - FIND REGEX lv_regex IN lv_range_value MATCH LENGTH sy-fdpos. - IF sy-subrc = 0 AND sy-fdpos > 0. - lv_range_value_2 = lv_range_value+sy-fdpos. - SUBTRACT 1 FROM sy-fdpos. - lv_range_value_1 = lv_range_value(sy-fdpos). - ELSE. - lv_range_value_1 = lv_range_value. - ENDIF. - ENDIF. -* 1st range - zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value_1 - IMPORTING e_column_start = lv_col_start_alpha - e_column_end = lv_col_end_alpha - e_row_start = lv_row_start - e_row_end = lv_row_end ). - IF lv_col_start_alpha IS NOT INITIAL. - <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_columns( iv_columns_from = lv_col_start_alpha - iv_columns_to = lv_col_end_alpha ). - ENDIF. - IF lv_row_start IS NOT INITIAL. - <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_rows( iv_rows_from = lv_row_start - iv_rows_to = lv_row_end ). - ENDIF. - -* 2nd range - zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value_2 - IMPORTING e_column_start = lv_col_start_alpha - e_column_end = lv_col_end_alpha - e_row_start = lv_row_start - e_row_end = lv_row_end ). - IF lv_col_start_alpha IS NOT INITIAL. - <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_columns( iv_columns_from = lv_col_start_alpha - iv_columns_to = lv_col_end_alpha ). - ENDIF. - IF lv_row_start IS NOT INITIAL. - <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_rows( iv_rows_from = lv_row_start - iv_rows_to = lv_row_end ). - ENDIF. - - WHEN OTHERS. - - ENDCASE. - ENDIF. -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns - end -*--------------------------------------------------------------------* - ELSE. " issue #163+ - lo_range = io_excel->add_new_range( ). " issue #163+ - ENDIF. " issue #163+ -* lo_range = ip_excel->add_new_range( ). " issue #163- - IF lo_range IS BOUND. "ins issue #235 - repeat rows/cols - lo_range->name = ls_range-name. - lo_range->set_range_value( lv_range_value ). - ENDIF. "ins issue #235 - repeat rows/cols - lo_node ?= lo_node->get_next( ). - - ENDWHILE. - - endmethod. - - - - - - METHOD load_worksheet. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Header/footer -* -* Please don't just delete these ToDos if they are not -* needed but leave a comment that states this -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, -* - ... -* changes: renaming variables to naming conventions -* aligning code (started) -* add a list of open ToDos here -* adding comments to explain what we are trying to achieve (started) -*--------------------------------------------------------------------* -* issue #345 - Dump on small pagemargins -* Took the chance to modularize this very long method -* by extracting the code that needed correction into -* own method ( load_worksheet_pagemargins ) -*--------------------------------------------------------------------* - TYPES: BEGIN OF lty_cell, - r TYPE string, - t TYPE string, - s TYPE string, - END OF lty_cell. - - TYPES: BEGIN OF lty_column, - min TYPE string, - max TYPE string, - width TYPE float, - customwidth TYPE string, - style TYPE string, - bestfit TYPE string, - collapsed TYPE string, - hidden TYPE string, - outlinelevel TYPE string, - END OF lty_column. - - TYPES: BEGIN OF lty_sheetview, - showgridlines TYPE zexcel_show_gridlines, - tabselected TYPE string, - zoomscalenormal TYPE string, - workbookviewid TYPE string, - showrowcolheaders TYPE string, - END OF lty_sheetview. - - TYPES: BEGIN OF lty_mergecell, - ref TYPE string, - END OF lty_mergecell. - - TYPES: BEGIN OF lty_row, - r TYPE string, - customheight TYPE string, - ht TYPE float, - spans TYPE string, - thickbot TYPE string, - customformat TYPE string, - thicktop TYPE string, - collapsed TYPE string, - hidden TYPE string, - outlinelevel TYPE string, - END OF lty_row. - - TYPES: BEGIN OF lty_page_setup, - id TYPE string, - orientation TYPE string, - scale TYPE string, - fittoheight TYPE string, - fittowidth TYPE string, - END OF lty_page_setup. - - TYPES: BEGIN OF lty_sheetformatpr, - customheight TYPE string, - defaultrowheight TYPE string, - customwidth TYPE string, - defaultcolwidth TYPE string, - END OF lty_sheetformatpr. - - TYPES: BEGIN OF lty_headerfooter, - alignwithmargins TYPE string, - differentoddeven TYPE string, - END OF lty_headerfooter. - - TYPES: BEGIN OF lty_tabcolor, - rgb TYPE string, - theme TYPE string, - END OF lty_tabcolor. - - TYPES: BEGIN OF lty_datavalidation, - type TYPE zexcel_data_val_type, - allowblank TYPE flag, - showinputmessage TYPE flag, - showerrormessage TYPE flag, - showdropdown TYPE flag, - operator TYPE zexcel_data_val_operator, - formula1 TYPE zexcel_validation_formula1, - formula2 TYPE zexcel_validation_formula1, - sqref TYPE string, - cell_column TYPE zexcel_cell_column_alpha, - cell_column_to TYPE zexcel_cell_column_alpha, - cell_row TYPE zexcel_cell_row, - cell_row_to TYPE zexcel_cell_row, - error TYPE string, - errortitle TYPE string, - prompt TYPE string, - prompttitle TYPE string, - errorstyle TYPE zexcel_data_val_error_style, - END OF lty_datavalidation. - - - - CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', - lc_xml_attr_true_int TYPE string VALUE '1', - lc_rel_drawing TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', - lc_rel_hyperlink TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', - lc_rel_printer TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings'. - - DATA: lo_ixml_worksheet TYPE REF TO if_ixml_document, - lo_ixml_cells TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml_iterator2 TYPE REF TO if_ixml_node_iterator, - lo_ixml_row_elem TYPE REF TO if_ixml_element, - lo_ixml_cell_elem TYPE REF TO if_ixml_element, - ls_cell TYPE lty_cell, - lv_index TYPE i, - lo_ixml_value_elem TYPE REF TO if_ixml_element, - lo_ixml_formula_elem TYPE REF TO if_ixml_element, - lv_cell_value TYPE zexcel_cell_value, - lv_cell_formula TYPE zexcel_cell_formula, - lv_cell_column TYPE zexcel_cell_column_alpha, - lv_cell_row TYPE zexcel_cell_row, - lo_excel_style TYPE REF TO zcl_excel_style, - lv_style_guid TYPE zexcel_cell_style, - - lo_ixml_imension_elem TYPE REF TO if_ixml_element, "#+234 - lv_dimension_range TYPE string, "#+234 - - lo_ixml_sheetview_elem TYPE REF TO if_ixml_element, - ls_sheetview TYPE lty_sheetview, - lo_ixml_pane_elem TYPE REF TO if_ixml_element, - ls_excel_pane TYPE zexcel_pane, - lv_pane_cell_row TYPE zexcel_cell_row, - lv_pane_cell_col_a TYPE zexcel_cell_column_alpha, - lv_pane_cell_col TYPE zexcel_cell_column, - - lo_ixml_mergecells TYPE REF TO if_ixml_node_collection, - lo_ixml_mergecell_elem TYPE REF TO if_ixml_element, - ls_mergecell TYPE lty_mergecell, - lv_merge_column_start TYPE zexcel_cell_column_alpha, - lv_merge_column_end TYPE zexcel_cell_column_alpha, - lv_merge_row_start TYPE zexcel_cell_row, - lv_merge_row_end TYPE zexcel_cell_row, - - lo_ixml_sheetformatpr_elem TYPE REF TO if_ixml_element, - ls_sheetformatpr TYPE lty_sheetformatpr, - lv_height TYPE float, - - lo_ixml_headerfooter_elem TYPE REF TO if_ixml_element, - ls_headerfooter TYPE lty_headerfooter, - ls_odd_header TYPE zexcel_s_worksheet_head_foot, - ls_odd_footer TYPE zexcel_s_worksheet_head_foot, - ls_even_header TYPE zexcel_s_worksheet_head_foot, - ls_even_footer TYPE zexcel_s_worksheet_head_foot, - lo_ixml_hf_value_elem TYPE REF TO if_ixml_element, - - lo_ixml_pagesetup_elem TYPE REF TO if_ixml_element, - lo_ixml_sheetpr TYPE REF TO if_ixml_element, - lv_fit_to_page TYPE string, - ls_pagesetup TYPE lty_page_setup, - - lo_ixml_columns TYPE REF TO if_ixml_node_collection, - lo_ixml_column_elem TYPE REF TO if_ixml_element, - ls_column TYPE lty_column, - lv_column_alpha TYPE zexcel_cell_column_alpha, - lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, - lv_outline_level TYPE int4, - - lo_ixml_tabcolor TYPE REF TO if_ixml_element, - ls_tabcolor TYPE lty_tabcolor, - ls_excel_s_tabcolor TYPE zexcel_s_tabcolor, - - lo_ixml_rows TYPE REF TO if_ixml_node_collection, - ls_row TYPE lty_row, - lv_max_col TYPE i, "for use with SPANS element -* lv_min_col TYPE i, "for use with SPANS element " not in use currently - lv_max_col_s TYPE char10, "for use with SPANS element - lv_min_col_s TYPE char10, "for use with SPANS element - lo_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, -*--- End of current code aligning ------------------------------------------------------------------- - - lv_path TYPE string, - lo_ixml_node TYPE REF TO if_ixml_element, - ls_relationship TYPE t_relationship, - lo_ixml_rels_worksheet TYPE REF TO if_ixml_document, - lv_rels_worksheet_path TYPE string, - lv_stripped_name TYPE chkfile, - lv_dirname TYPE string, - - lt_external_hyperlinks TYPE gtt_external_hyperlinks, - ls_external_hyperlink LIKE LINE OF lt_external_hyperlinks, - - lo_ixml_datavalidations TYPE REF TO if_ixml_node_collection, - lo_ixml_datavalidation_elem TYPE REF TO if_ixml_element, - ls_datavalidation TYPE lty_datavalidation, - lo_data_validation TYPE REF TO zcl_excel_data_validation, - lv_datavalidation_range TYPE string, - lt_datavalidation_range TYPE TABLE OF string. - -*--------------------------------------------------------------------* -* §2 We need to read the the file "\\_rels\.rels" because it tells -* us where in this folder structure the data for the workbook -* is located in the xlsx zip-archive -* -* The xlsx Zip-archive has generally the following folder structure: -* <root> | -* |--> _rels -* |--> doc_Props -* |--> xl | -* |--> _rels -* |--> theme -* |--> worksheets -*--------------------------------------------------------------------* - - " Read Workbook Relationships - CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' - EXPORTING - full_name = ip_path - IMPORTING - stripped_name = lv_stripped_name - file_path = lv_dirname. - CONCATENATE lv_dirname '_rels/' lv_stripped_name '.rels' - INTO lv_rels_worksheet_path. - TRY. " +#222 _rels/xxx.rels might not be present. If not found there can be no drawings --> just ignore this section - lo_ixml_rels_worksheet = me->get_ixml_from_zip_archive( lv_rels_worksheet_path ). - lo_ixml_node ?= lo_ixml_rels_worksheet->find_from_name( 'Relationship' ). - CATCH zcx_excel. "#EC NO_HANDLER +#222 - " +#222 No errorhandling necessary - node will be unbound if error occurs - ENDTRY. " +#222 - WHILE lo_ixml_node IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_node - CHANGING - cp_structure = ls_relationship ). - CONCATENATE lv_dirname ls_relationship-target INTO lv_path. - lv_path = resolve_path( lv_path ). - - CASE ls_relationship-type. - WHEN lc_rel_drawing. - " Read Drawings -* Issue # 339 Not all drawings are in the path mentioned below. -* Some Excel elements like textfields (which we don't support ) have a drawing-part in the relationsships -* but no "xl/drawings/_rels/drawing____.xml.rels" part. -* Since we don't support these there is no need to read them. Catching exceptions thrown -* in the "load_worksheet_drawing" shouldn't lead to an abortion of the reading - TRY. - me->load_worksheet_drawing( ip_path = lv_path - io_worksheet = io_worksheet ). - CATCH zcx_excel. "--> then ignore it - ENDTRY. - - WHEN lc_rel_printer. - " Read Printer settings - - WHEN lc_rel_hyperlink. - MOVE-CORRESPONDING ls_relationship TO ls_external_hyperlink. - INSERT ls_external_hyperlink INTO TABLE lt_external_hyperlinks. - - WHEN OTHERS. - ENDCASE. - - lo_ixml_node ?= lo_ixml_node->get_next( ). - ENDWHILE. - - - lo_ixml_worksheet = me->get_ixml_from_zip_archive( ip_path ). - - - lo_ixml_tabcolor ?= lo_ixml_worksheet->find_from_name( 'tabColor' ). - IF lo_ixml_tabcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_tabcolor - CHANGING - cp_structure = ls_tabcolor ). -* Theme not supported yet - IF ls_tabcolor-rgb IS NOT INITIAL. - ls_excel_s_tabcolor-rgb = ls_tabcolor-rgb. - io_worksheet->set_tabcolor( ls_excel_s_tabcolor ). - ENDIF. - ENDIF. - - lo_ixml_rows = lo_ixml_worksheet->get_elements_by_tag_name( name = 'row' ). - lo_ixml_iterator = lo_ixml_rows->create_iterator( ). - lo_ixml_row_elem ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_row_elem IS BOUND. - - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_row_elem - CHANGING - cp_structure = ls_row ). - SPLIT ls_row-spans AT ':' INTO lv_min_col_s lv_max_col_s. - lv_index = lv_max_col_s. - IF lv_index > lv_max_col. - lv_max_col = lv_index. - ENDIF. - lv_cell_row = ls_row-r. - IF ls_row-customheight = '1' - OR ls_row-collapsed = lc_xml_attr_true - OR ls_row-collapsed = lc_xml_attr_true_int - OR ls_row-hidden = lc_xml_attr_true - OR ls_row-hidden = lc_xml_attr_true_int - OR ls_row-outlinelevel > '0'. - lo_row_dimension = io_worksheet->get_row_dimension( lv_cell_row ). - IF ls_row-customheight = '1'. - lo_row_dimension->set_row_height( ls_row-ht ). - ENDIF. - - IF ls_row-collapsed = lc_xml_attr_true - OR ls_row-collapsed = lc_xml_attr_true_int. - lo_row_dimension->set_collapsed( abap_true ). - ENDIF. - - IF ls_row-hidden = lc_xml_attr_true - OR ls_row-hidden = lc_xml_attr_true_int. - lo_row_dimension->set_visible( abap_false ). - ENDIF. - - IF ls_row-outlinelevel > ''. -* outline_level = condense( row-outlineLevel ). "For basis 7.02 and higher - CONDENSE ls_row-outlinelevel. - lv_outline_level = ls_row-outlinelevel. - IF lv_outline_level > 0. - lo_row_dimension->set_outline_level( lv_outline_level ). - ENDIF. - ENDIF. - ENDIF. - - lo_ixml_cells = lo_ixml_row_elem->get_elements_by_tag_name( name = 'c' ). - lo_ixml_iterator2 = lo_ixml_cells->create_iterator( ). - lo_ixml_cell_elem ?= lo_ixml_iterator2->get_next( ). - WHILE lo_ixml_cell_elem IS BOUND. - CLEAR: lv_cell_value, - lv_cell_formula, - lv_style_guid. - - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_cell_elem CHANGING cp_structure = ls_cell ). - - lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name( name = 'v' ). - - CASE ls_cell-t. - WHEN 's'. " String values are stored as index in shared string table - lv_index = lo_ixml_value_elem->get_value( ) + 1. - READ TABLE shared_strings INTO lv_cell_value INDEX lv_index. - WHEN 'inlineStr'. " inlineStr values are kept in special node - lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name( name = 'is' ). - IF lo_ixml_value_elem IS BOUND. - lv_cell_value = lo_ixml_value_elem->get_value( ). - ENDIF. - WHEN OTHERS. "other types are stored directly - IF lo_ixml_value_elem IS BOUND. - lv_cell_value = lo_ixml_value_elem->get_value( ). - ENDIF. - ENDCASE. - - CLEAR lv_style_guid. - "read style based on index - IF ls_cell-s IS NOT INITIAL. - lv_index = ls_cell-s + 1. - READ TABLE styles INTO lo_excel_style INDEX lv_index. - IF sy-subrc = 0. - lv_style_guid = lo_excel_style->get_guid( ). - ENDIF. - ENDIF. - - lo_ixml_formula_elem = lo_ixml_cell_elem->find_from_name( name = 'f' ). - IF lo_ixml_formula_elem IS BOUND. - lv_cell_formula = lo_ixml_formula_elem->get_value( ). -*--------------------------------------------------------------------* -* Begin of insertion issue#284 - Copied formulae not -*--------------------------------------------------------------------* - DATA: BEGIN OF ls_formula_attributes, - ref TYPE string, - si TYPE i, - t TYPE string, - END OF ls_formula_attributes, - ls_ref_formula TYPE ty_ref_formulae. - - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_formula_elem CHANGING cp_structure = ls_formula_attributes ). - IF ls_formula_attributes-t = 'shared'. - zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING - i_columnrow = ls_cell-r - IMPORTING - e_column = lv_cell_column - e_row = lv_cell_row ). - - TRY. - CLEAR ls_ref_formula. - ls_ref_formula-sheet = io_worksheet. - ls_ref_formula-row = lv_cell_row. - ls_ref_formula-column = zcl_excel_common=>convert_column2int( lv_cell_column ). - ls_ref_formula-si = ls_formula_attributes-si. - ls_ref_formula-ref = ls_formula_attributes-ref. - ls_ref_formula-formula = lv_cell_formula. - INSERT ls_ref_formula INTO TABLE me->mt_ref_formulae. - CATCH cx_root. - BREAK-POINT. - ENDTRY. - ENDIF. -*--------------------------------------------------------------------* -* End of insertion issue#284 - Copied formulae not -*--------------------------------------------------------------------* - ENDIF. - - IF lv_cell_value IS NOT INITIAL - OR lv_cell_formula IS NOT INITIAL - OR lv_style_guid IS NOT INITIAL. - zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING - i_columnrow = ls_cell-r - IMPORTING - e_column = lv_cell_column - e_row = lv_cell_row ). - io_worksheet->set_cell( ip_column = lv_cell_column " cell_elem Column - ip_row = lv_cell_row " cell_elem row_elem - ip_value = lv_cell_value " cell_elem Value - ip_formula = lv_cell_formula - ip_data_type = ls_cell-t - ip_style = lv_style_guid ). - ENDIF. - lo_ixml_cell_elem ?= lo_ixml_iterator2->get_next( ). - ENDWHILE. - lo_ixml_row_elem ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - -*--------------------------------------------------------------------* -*#234 - column width not read correctly - begin of coding -* reason - libre office doesn't use SPAN in row - definitions -*--------------------------------------------------------------------* - IF lv_max_col = 0. - lo_ixml_imension_elem = lo_ixml_worksheet->find_from_name( name = 'dimension' ). - IF lo_ixml_imension_elem IS BOUND. - lv_dimension_range = lo_ixml_imension_elem->get_attribute( 'ref' ). - IF lv_dimension_range CS ':'. - REPLACE REGEX '\D+\d+:(\D+)\d+' IN lv_dimension_range WITH '$1'. " Get max column - ELSE. - REPLACE REGEX '(\D+)\d+' IN lv_dimension_range WITH '$1'. " Get max column - ENDIF. - lv_max_col = zcl_excel_common=>convert_column2int( lv_dimension_range ). - ENDIF. - ENDIF. -*--------------------------------------------------------------------* -*#234 - column width not read correctly - end of coding -*--------------------------------------------------------------------* - - "Get the customized column width - lo_ixml_columns = lo_ixml_worksheet->get_elements_by_tag_name( name = 'col' ). - lo_ixml_iterator = lo_ixml_columns->create_iterator( ). - lo_ixml_column_elem ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_column_elem IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_column_elem - CHANGING - cp_structure = ls_column ). - lo_ixml_column_elem ?= lo_ixml_iterator->get_next( ). - IF ls_column-customwidth = lc_xml_attr_true - OR ls_column-customwidth = lc_xml_attr_true_int - OR ls_column-bestfit = lc_xml_attr_true - OR ls_column-bestfit = lc_xml_attr_true_int - OR ls_column-collapsed = lc_xml_attr_true - OR ls_column-collapsed = lc_xml_attr_true_int - OR ls_column-hidden = lc_xml_attr_true - OR ls_column-hidden = lc_xml_attr_true_int - OR ls_column-outlinelevel > '' - OR ls_column-style > ''. - lv_index = ls_column-min. - WHILE lv_index <= ls_column-max AND lv_index <= lv_max_col. - - lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_index ). - lo_column_dimension = io_worksheet->get_column_dimension( lv_column_alpha ). - - IF ls_column-customwidth = lc_xml_attr_true - OR ls_column-customwidth = lc_xml_attr_true_int - OR ls_column-width IS NOT INITIAL. "+#234 - lo_column_dimension->set_width( ls_column-width ). - ENDIF. - - IF ls_column-bestfit = lc_xml_attr_true - OR ls_column-bestfit = lc_xml_attr_true_int. - lo_column_dimension->set_auto_size( abap_true ). - ENDIF. - - IF ls_column-collapsed = lc_xml_attr_true - OR ls_column-collapsed = lc_xml_attr_true_int. - lo_column_dimension->set_collapsed( abap_true ). - ENDIF. - - IF ls_column-hidden = lc_xml_attr_true - OR ls_column-hidden = lc_xml_attr_true_int. - lo_column_dimension->set_visible( abap_false ). - ENDIF. - - IF ls_column-outlinelevel > ''. -* outline_level = condense( column-outlineLevel ). - CONDENSE ls_column-outlinelevel. - lv_outline_level = ls_column-outlinelevel. - IF lv_outline_level > 0. - lo_column_dimension->set_outline_level( lv_outline_level ). - ENDIF. - ENDIF. - - IF ls_column-style > ''. - sy-index = ls_column-style + 1. - READ TABLE styles INTO lo_excel_style INDEX sy-index. - DATA: dummy_zexcel_cell_style TYPE zexcel_cell_style. - dummy_zexcel_cell_style = lo_excel_style->get_guid( ). - lo_column_dimension->set_column_style_by_guid( dummy_zexcel_cell_style ). - ENDIF. - - ADD 1 TO lv_index. - ENDWHILE. - ENDIF. - -* issue #367 - hide columns from - IF ls_column-max = zcl_excel_common=>c_excel_sheet_max_col. " Max = very right column - IF ls_column-hidden = 1 " all hidden - AND ls_column-min > 0. - io_worksheet->zif_excel_sheet_properties~hide_columns_from = zcl_excel_common=>convert_column2alpha( ls_column-min ). - ELSEIF ls_column-style > ''. - sy-index = ls_column-style + 1. - READ TABLE styles INTO lo_excel_style INDEX sy-index. - dummy_zexcel_cell_style = lo_excel_style->get_guid( ). -* Set style for remaining columns - io_worksheet->zif_excel_sheet_properties~set_style( dummy_zexcel_cell_style ). - ENDIF. - ENDIF. - - - ENDWHILE. - - "Now we need to get information from the sheetView node - lo_ixml_sheetview_elem = lo_ixml_worksheet->find_from_name( name = 'sheetView' ). - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_sheetview_elem CHANGING cp_structure = ls_sheetview ). - IF ls_sheetview-showgridlines IS INITIAL OR - ls_sheetview-showgridlines = lc_xml_attr_true OR - ls_sheetview-showgridlines = lc_xml_attr_true_int. - "If the attribute is not specified or set to true, we will show grid lines - ls_sheetview-showgridlines = abap_true. - ELSE. - ls_sheetview-showgridlines = abap_false. - ENDIF. - io_worksheet->set_show_gridlines( ls_sheetview-showgridlines ). - - - "Add merge cell information - lo_ixml_mergecells = lo_ixml_worksheet->get_elements_by_tag_name( name = 'mergeCell' ). - lo_ixml_iterator = lo_ixml_mergecells->create_iterator( ). - lo_ixml_mergecell_elem ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_mergecell_elem IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_mergecell_elem - CHANGING - cp_structure = ls_mergecell ). - zcl_excel_common=>convert_range2column_a_row( EXPORTING - i_range = ls_mergecell-ref - IMPORTING - e_column_start = lv_merge_column_start - e_column_end = lv_merge_column_end - e_row_start = lv_merge_row_start - e_row_end = lv_merge_row_end ). - lo_ixml_mergecell_elem ?= lo_ixml_iterator->get_next( ). - io_worksheet->set_merge( EXPORTING - ip_column_start = lv_merge_column_start - ip_column_end = lv_merge_column_end - ip_row = lv_merge_row_start - ip_row_to = lv_merge_row_end ). - ENDWHILE. - - " read sheet format properties - lo_ixml_sheetformatpr_elem = lo_ixml_worksheet->find_from_name( 'sheetFormatPr' ). - IF lo_ixml_sheetformatpr_elem IS NOT INITIAL. - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_sheetformatpr_elem CHANGING cp_structure = ls_sheetformatpr ). - IF ls_sheetformatpr-customheight = '1'. - lv_height = ls_sheetformatpr-defaultrowheight. - lo_row_dimension = io_worksheet->get_default_row_dimension( ). - lo_row_dimension->set_row_height( lv_height ). - ENDIF. - - " TODO... column - ENDIF. - - " Read in page margins - me->load_worksheet_pagemargins( EXPORTING - io_ixml_worksheet = lo_ixml_worksheet - io_worksheet = io_worksheet ). - -* FitToPage - lo_ixml_sheetpr ?= lo_ixml_worksheet->find_from_name( 'pageSetUpPr' ). - IF lo_ixml_sheetpr IS BOUND. - - lv_fit_to_page = lo_ixml_sheetpr->get_attribute_ns( 'fitToPage' ). - IF lv_fit_to_page IS NOT INITIAL. - io_worksheet->sheet_setup->fit_to_page = 'X'. - ENDIF. - ENDIF. - " Read in page setup - lo_ixml_pagesetup_elem = lo_ixml_worksheet->find_from_name( 'pageSetup' ). - IF lo_ixml_pagesetup_elem IS NOT INITIAL. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_pagesetup_elem - CHANGING - cp_structure = ls_pagesetup ). - io_worksheet->sheet_setup->orientation = ls_pagesetup-orientation. - io_worksheet->sheet_setup->scale = ls_pagesetup-scale. - IF io_worksheet->sheet_setup->fit_to_page = 'X'. - IF ls_pagesetup-fittowidth IS NOT INITIAL. - io_worksheet->sheet_setup->fit_to_width = ls_pagesetup-fittowidth. - ELSE. - io_worksheet->sheet_setup->fit_to_width = 1. " Default if not given - Excel doesn't write this to xml - ENDIF. - IF ls_pagesetup-fittoheight IS NOT INITIAL. - io_worksheet->sheet_setup->fit_to_height = ls_pagesetup-fittoheight. - ELSE. - io_worksheet->sheet_setup->fit_to_height = 1. " Default if not given - Excel doesn't write this to xml - ENDIF. - ENDIF. - ENDIF. - - - - " Read header footer - lo_ixml_headerfooter_elem = lo_ixml_worksheet->find_from_name( 'headerFooter' ). - IF lo_ixml_headerfooter_elem IS NOT INITIAL. - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_headerfooter_elem CHANGING cp_structure = ls_headerfooter ). - io_worksheet->sheet_setup->diff_oddeven_headerfooter = ls_headerfooter-differentoddeven. - - lo_ixml_hf_value_elem = lo_ixml_headerfooter_elem->find_from_name( 'oddFooter' ). - IF lo_ixml_hf_value_elem IS NOT INITIAL. - ls_odd_footer-left_value = lo_ixml_hf_value_elem->get_value( ). - ENDIF. - -* 2do§1 Header/footer - " TODO.. get the rest. - - io_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_odd_header - ip_odd_footer = ls_odd_footer - ip_even_header = ls_even_header - ip_even_footer = ls_even_footer ). - - ENDIF. - - " Start fix 194 Read attributes HIDDEN, OUTLINELEVEL, COLLAPSED in ZCL_EXCEL_READER_2007 - " Read pane - lo_ixml_pane_elem = lo_ixml_sheetview_elem->find_from_name( name = 'pane' ). - IF lo_ixml_pane_elem IS BOUND. - fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_pane_elem CHANGING cp_structure = ls_excel_pane ). - " Issue #194 - " Replace REGEX with method from the common class - zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING - i_columnrow = ls_excel_pane-topleftcell - IMPORTING - e_column = lv_pane_cell_col_a " Cell Column - e_row = lv_pane_cell_row ). " Natural number - lv_pane_cell_col = zcl_excel_common=>convert_column2int( lv_pane_cell_col_a ). - SUBTRACT 1 FROM: lv_pane_cell_col, - lv_pane_cell_row. - IF lv_pane_cell_col > 0 - AND lv_pane_cell_row > 0. - io_worksheet->freeze_panes( ip_num_rows = lv_pane_cell_row - ip_num_columns = lv_pane_cell_col ). - ELSEIF lv_pane_cell_row > 0. - io_worksheet->freeze_panes( ip_num_rows = lv_pane_cell_row ). - ELSE. - io_worksheet->freeze_panes( ip_num_columns = lv_pane_cell_col ). - ENDIF. - ENDIF. - " End fix 194 Read attributes HIDDEN, OUTLINELEVEL, COLLAPSED in ZCL_EXCEL_READER_2007 - - " Start fix 276 Read data validations - lo_ixml_datavalidations = lo_ixml_worksheet->get_elements_by_tag_name( name = 'dataValidation' ). - lo_ixml_iterator = lo_ixml_datavalidations->create_iterator( ). - lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_datavalidation_elem IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_datavalidation_elem - CHANGING - cp_structure = ls_datavalidation ). - CLEAR lo_ixml_formula_elem. - lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula1' ). - IF lo_ixml_formula_elem IS BOUND. - ls_datavalidation-formula1 = lo_ixml_formula_elem->get_value( ). - ENDIF. - CLEAR lo_ixml_formula_elem. - lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula2' ). - IF lo_ixml_formula_elem IS BOUND. - ls_datavalidation-formula2 = lo_ixml_formula_elem->get_value( ). - ENDIF. - SPLIT ls_datavalidation-sqref AT space INTO TABLE lt_datavalidation_range. - LOOP AT lt_datavalidation_range INTO lv_datavalidation_range. - zcl_excel_common=>convert_range2column_a_row( EXPORTING - i_range = lv_datavalidation_range - IMPORTING - e_column_start = ls_datavalidation-cell_column - e_column_end = ls_datavalidation-cell_column_to - e_row_start = ls_datavalidation-cell_row - e_row_end = ls_datavalidation-cell_row_to ). - lo_data_validation = io_worksheet->add_new_data_validation( ). - lo_data_validation->type = ls_datavalidation-type. - lo_data_validation->allowblank = ls_datavalidation-allowblank. - IF ls_datavalidation-showinputmessage IS INITIAL. - lo_data_validation->showinputmessage = abap_false. - ELSE. - lo_data_validation->showinputmessage = abap_true. - ENDIF. - IF ls_datavalidation-showerrormessage IS INITIAL. - lo_data_validation->showerrormessage = abap_false. - ELSE. - lo_data_validation->showerrormessage = abap_true. - ENDIF. - IF ls_datavalidation-showdropdown IS INITIAL. - lo_data_validation->showdropdown = abap_false. - ELSE. - lo_data_validation->showdropdown = abap_true. - ENDIF. - lo_data_validation->operator = ls_datavalidation-operator. - lo_data_validation->formula1 = ls_datavalidation-formula1. - lo_data_validation->formula2 = ls_datavalidation-formula2. - lo_data_validation->prompttitle = ls_datavalidation-prompttitle. - lo_data_validation->prompt = ls_datavalidation-prompt. - lo_data_validation->errortitle = ls_datavalidation-errortitle. - lo_data_validation->error = ls_datavalidation-error. - lo_data_validation->errorstyle = ls_datavalidation-errorstyle. - lo_data_validation->cell_row = ls_datavalidation-cell_row. - lo_data_validation->cell_row_to = ls_datavalidation-cell_row_to. - lo_data_validation->cell_column = ls_datavalidation-cell_column. - lo_data_validation->cell_column_to = ls_datavalidation-cell_column_to. - ENDLOOP. - lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - " End fix 276 Read data validations - - " Read hyperlinks - TRY. - me->load_worksheet_hyperlinks( io_ixml_worksheet = lo_ixml_worksheet - io_worksheet = io_worksheet - it_external_hyperlinks = lt_external_hyperlinks ). - CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify - ENDTRY. - - TRY. - me->fill_row_outlines( io_worksheet = io_worksheet ). - CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify - ENDTRY. - - " Issue #366 - conditional formatting - TRY. - me->load_worksheet_cond_format( io_ixml_worksheet = lo_ixml_worksheet - io_worksheet = io_worksheet ). - CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify - ENDTRY. - - " Issue #377 - pagebreaks - TRY. - me->load_worksheet_pagebreaks( io_ixml_worksheet = lo_ixml_worksheet - io_worksheet = io_worksheet ). - CATCH zcx_excel. " Ignore pagebreak reading errors - pass everything we were able to identify - ENDTRY. - - -ENDMETHOD. - - - - - - METHOD load_worksheet_cond_format. - - DATA: lo_ixml_cond_formats TYPE REF TO if_ixml_node_collection, - lo_ixml_cond_format TYPE REF TO if_ixml_element, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml_rules TYPE REF TO if_ixml_node_collection, - lo_ixml_rule TYPE REF TO if_ixml_element, - lo_ixml_iterator2 TYPE REF TO if_ixml_node_iterator, - lo_style_conditional TYPE REF TO zcl_excel_style_conditional, - lo_style_conditional2 TYPE REF TO zcl_excel_style_conditional. - - - DATA: lv_area TYPE string, - lt_areas TYPE STANDARD TABLE OF string WITH NON-UNIQUE DEFAULT KEY, - lv_area_start_row TYPE zexcel_cell_row, - lv_area_end_row TYPE zexcel_cell_row, - lv_area_start_col TYPE zexcel_cell_column_alpha, - lv_area_end_col TYPE zexcel_cell_column_alpha, - lv_rule TYPE zexcel_condition_rule. - - -* FIELD-SYMBOLS: <ls_external_hyperlink> LIKE LINE OF it_external_hyperlinks. - - lo_ixml_cond_formats = io_ixml_worksheet->get_elements_by_tag_name( name = 'conditionalFormatting' ). - lo_ixml_iterator = lo_ixml_cond_formats->create_iterator( ). - lo_ixml_cond_format ?= lo_ixml_iterator->get_next( ). - - WHILE lo_ixml_cond_format IS BOUND. - - CLEAR: lv_area, - lo_ixml_rule, - lo_style_conditional. - - -*--------------------------------------------------------------------* -* Get type of rule -*--------------------------------------------------------------------* - lo_ixml_rules = io_ixml_worksheet->get_elements_by_tag_name( name = 'cfRule' ). - lo_ixml_iterator2 = lo_ixml_rules->create_iterator( ). - lo_ixml_rule ?= lo_ixml_iterator2->get_next( ). -* IF lo_ixml_rule IS BOUND. - WHILE lo_ixml_rule IS BOUND. - lv_rule = lo_ixml_rule->get_attribute_ns( 'type' ). - CLEAR lo_style_conditional. - -*--------------------------------------------------------------------* -* Depending on ruletype get additional information -*--------------------------------------------------------------------* - CASE lv_rule. - - WHEN zcl_excel_style_conditional=>c_rule_cellis. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_ci( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - -* WHEN zcl_excel_style_conditional=>c_rule_containstext. -* - WHEN zcl_excel_style_conditional=>c_rule_databar. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_db( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - - WHEN zcl_excel_style_conditional=>c_rule_expression. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_ex( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - - WHEN zcl_excel_style_conditional=>c_rule_iconset. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_is( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - - WHEN zcl_excel_style_conditional=>c_rule_colorscale. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_cs( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - - WHEN zcl_excel_style_conditional=>c_rule_top10. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_t10( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - - WHEN zcl_excel_style_conditional=>c_rule_above_average. - lo_style_conditional = io_worksheet->add_new_conditional_style( ). - load_worksheet_cond_format_aa( io_ixml_rule = lo_ixml_rule - io_style_conditional = lo_style_conditional ). - -* WHEN zcl_excel_style_conditional=>c_rule_none. -* - - WHEN OTHERS. - ENDCASE. -* ENDIF. - - IF lo_style_conditional IS BOUND. - lo_style_conditional->rule = lv_rule. - lo_style_conditional->priority = lo_ixml_rule->get_attribute_ns( 'priority' ). -*--------------------------------------------------------------------* -* Set area to which conditional formatting belongs -*--------------------------------------------------------------------* - lv_area = lo_ixml_cond_format->get_attribute_ns( 'sqref' ). - SPLIT lv_area AT space INTO TABLE lt_areas. - DELETE lt_areas WHERE table_line IS INITIAL. - LOOP AT lt_areas INTO lv_area. -* IF sy-tabix = 1. " Add futher style for next area -* lo_style_conditional2 = lo_style_conditional. -* ELSE. -* lo_style_conditional2 = io_worksheet->add_new_conditional_style( ). -* lo_style_conditional2->mode_cellis = lo_style_conditional->mode_cellis . -* lo_style_conditional2->mode_colorscale = lo_style_conditional->mode_colorscale . -* lo_style_conditional2->mode_databar = lo_style_conditional->mode_databar . -* lo_style_conditional2->mode_expression = lo_style_conditional->mode_expression . -* lo_style_conditional2->mode_iconset = lo_style_conditional->mode_iconset . -* lo_style_conditional2->mode_top10 = lo_style_conditional->mode_top10 . -* lo_style_conditional2->mode_above_average = lo_style_conditional->mode_above_average. -* lo_style_conditional2->priority = lo_style_conditional->priority . -* lo_style_conditional2->rule = lo_style_conditional->rule . -* ENDIF. - - zcl_excel_common=>convert_range2column_a_row( EXPORTING - i_range = lv_area - IMPORTING - e_column_start = lv_area_start_col - e_column_end = lv_area_end_col - e_row_start = lv_area_start_row - e_row_end = lv_area_end_row ). -* lo_style_conditional2->set_range( ip_start_column = lv_area_start_col -* ip_stop_column = lv_area_end_col -* ip_start_row = lv_area_start_row -* ip_stop_row = lv_area_end_row ). - lo_style_conditional->add_range( ip_start_column = lv_area_start_col - ip_stop_column = lv_area_end_col - ip_start_row = lv_area_start_row - ip_stop_row = lv_area_end_row ). - ENDLOOP. - - ENDIF. - lo_ixml_rule ?= lo_ixml_iterator2->get_next( ). - ENDWHILE. - - - lo_ixml_cond_format ?= lo_ixml_iterator->get_next( ). - - ENDWHILE. - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_aa. - DATA: lv_dxf_style_index TYPE i, - val TYPE string. - - FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. - -*--------------------------------------------------------------------* -* above or below average -*--------------------------------------------------------------------* - val = io_ixml_rule->get_attribute_ns( 'aboveAverage' ). - IF val = '0'. " 0 = below average - io_style_conditional->mode_above_average-above_average = space. - ELSE. - io_style_conditional->mode_above_average-above_average = 'X'. " Not present or <> 0 --> we use above average - ENDIF. - -*--------------------------------------------------------------------* -* Equal average also? -*--------------------------------------------------------------------* - CLEAR val. - val = io_ixml_rule->get_attribute_ns( 'equalAverage' ). - IF val = '1'. " 0 = below average - io_style_conditional->mode_above_average-equal_average = 'X'. - ELSE. - io_style_conditional->mode_above_average-equal_average = ' '. " Not present or <> 1 --> we use not equal average - ENDIF. - -*--------------------------------------------------------------------* -* Standard deviation instead of value ( 2nd stddev, 3rd stdev ) -*--------------------------------------------------------------------* - CLEAR val. - val = io_ixml_rule->get_attribute_ns( 'stdDev' ). - CASE val. - WHEN 1 - OR 2 - OR 3. " These seem to be supported by excel - don't try anything more - io_style_conditional->mode_above_average-standard_deviation = val. - ENDCASE. - -*--------------------------------------------------------------------* -* Cell formatting for top10 -*--------------------------------------------------------------------* - lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). - READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. - IF sy-subrc = 0. - io_style_conditional->mode_above_average-cell_style = <ls_dxf_style>-guid. - ENDIF. - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_ci. - DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml TYPE REF TO if_ixml_element, - lv_dxf_style_index TYPE i, - lo_excel_style LIKE LINE OF me->styles. - - FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. - - io_style_conditional->mode_cellis-operator = io_ixml_rule->get_attribute_ns( 'operator' ). - lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). - READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. - IF sy-subrc = 0. - io_style_conditional->mode_cellis-cell_style = <ls_dxf_style>-guid. - ENDIF. - - lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'formula' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_cellis-formula = lo_ixml->get_value( ). - - WHEN 2. - io_style_conditional->mode_cellis-formula2 = lo_ixml->get_value( ). - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_cs. - DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml TYPE REF TO if_ixml_element. - - - lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'cfvo' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_colorscale-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_colorscale-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 2. - io_style_conditional->mode_colorscale-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_colorscale-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 3. - io_style_conditional->mode_colorscale-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_colorscale-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - - lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'color' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_colorscale-colorrgb1 = lo_ixml->get_attribute_ns( 'rgb' ). - - WHEN 2. - io_style_conditional->mode_colorscale-colorrgb2 = lo_ixml->get_attribute_ns( 'rgb' ). - - WHEN 3. - io_style_conditional->mode_colorscale-colorrgb3 = lo_ixml->get_attribute_ns( 'rgb' ). - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_db. - DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml TYPE REF TO if_ixml_element. - - lo_ixml ?= io_ixml_rule->find_from_name( 'color' ). - IF lo_ixml IS BOUND. - io_style_conditional->mode_databar-colorrgb = lo_ixml->get_attribute_ns( 'rgb' ). - ENDIF. - - lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'cfvo' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_databar-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_databar-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 2. - io_style_conditional->mode_databar-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_databar-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_ex. - DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml TYPE REF TO if_ixml_element, - lv_dxf_style_index TYPE i, - lo_excel_style LIKE LINE OF me->styles. - - FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. - - lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). - READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. - IF sy-subrc = 0. - io_style_conditional->mode_expression-cell_style = <ls_dxf_style>-guid. - ENDIF. - - lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'formula' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_expression-formula = lo_ixml->get_value( ). - - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_is. - DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml TYPE REF TO if_ixml_element, - lo_ixml_rule_iconset TYPE REF TO if_ixml_element. - - lo_ixml_rule_iconset ?= io_ixml_rule->get_first_child( ). - io_style_conditional->mode_iconset-iconset = lo_ixml_rule_iconset->get_attribute_ns( 'iconSet' ). - io_style_conditional->mode_iconset-showvalue = lo_ixml_rule_iconset->get_attribute_ns( 'showValue' ). - lo_ixml_nodes ?= lo_ixml_rule_iconset->get_elements_by_tag_name( 'cfvo' ). - lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). - lo_ixml ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml IS BOUND. - - CASE sy-index. - WHEN 1. - io_style_conditional->mode_iconset-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_iconset-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 2. - io_style_conditional->mode_iconset-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_iconset-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 3. - io_style_conditional->mode_iconset-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_iconset-cfvo3_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 4. - io_style_conditional->mode_iconset-cfvo4_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_iconset-cfvo4_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN 5. - io_style_conditional->mode_iconset-cfvo5_type = lo_ixml->get_attribute_ns( 'type' ). - io_style_conditional->mode_iconset-cfvo5_value = lo_ixml->get_attribute_ns( 'val' ). - - WHEN OTHERS. - EXIT. - ENDCASE. - - lo_ixml ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - -ENDMETHOD. - - - - - METHOD load_worksheet_cond_format_t10. - DATA: lv_dxf_style_index TYPE i. - - FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. - - io_style_conditional->mode_top10-topxx_count = io_ixml_rule->get_attribute_ns( 'rank' ). " Top10, Top20, Top 50... - - io_style_conditional->mode_top10-percent = io_ixml_rule->get_attribute_ns( 'percent' ). " Top10 percent instead of Top10 values - if io_style_conditional->mode_top10-percent = '1'. - io_style_conditional->mode_top10-percent = 'X'. - else. - io_style_conditional->mode_top10-percent = ' '. - endif. - - io_style_conditional->mode_top10-bottom = io_ixml_rule->get_attribute_ns( 'bottom' ). " Bottom10 instead of Top10 - if io_style_conditional->mode_top10-bottom = '1'. - io_style_conditional->mode_top10-bottom = 'X'. - else. - io_style_conditional->mode_top10-bottom = ' '. - endif. -*--------------------------------------------------------------------* -* Cell formatting for top10 -*--------------------------------------------------------------------* - lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). - READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. - IF sy-subrc = 0. - io_style_conditional->mode_top10-cell_style = <ls_dxf_style>-guid. - ENDIF. - -ENDMETHOD. - - - - - - method LOAD_WORKSHEET_DRAWING. - - TYPES: BEGIN OF t_c_nv_pr, - name TYPE string, - id TYPE string, - END OF t_c_nv_pr. - - TYPES: BEGIN OF t_blip, - cstate TYPE string, - embed TYPE string, - END OF t_blip. - - TYPES: BEGIN OF t_chart, - id TYPE string, - END OF t_chart. - - CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', - lc_xml_attr_true_int TYPE string VALUE '1'. - CONSTANTS: lc_rel_chart TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', - lc_rel_image TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'. - - DATA: drawing TYPE REF TO if_ixml_document, - anchors TYPE REF TO if_ixml_node_collection, - node TYPE REF TO if_ixml_element, - coll_length TYPE i, - iterator TYPE REF TO if_ixml_node_iterator, - anchor_elem TYPE REF TO if_ixml_element, - - relationship TYPE t_relationship, - rel_drawings TYPE t_rel_drawings, - rel_drawing TYPE t_rel_drawing, - rels_drawing TYPE REF TO if_ixml_document, - rels_drawing_path TYPE string, - stripped_name TYPE chkfile, - dirname TYPE string, - - path TYPE string, - path2 TYPE text255, - file_ext2 TYPE char10. - - " Read Workbook Relationships - CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' - EXPORTING - full_name = ip_path - IMPORTING - stripped_name = stripped_name - file_path = dirname. - CONCATENATE dirname '_rels/' stripped_name '.rels' - INTO rels_drawing_path. - rels_drawing_path = resolve_path( rels_drawing_path ). - rels_drawing = me->get_ixml_from_zip_archive( rels_drawing_path ). - node ?= rels_drawing->find_from_name( 'Relationship' ). - WHILE node IS BOUND. - fill_struct_from_attributes( EXPORTING ip_element = node CHANGING cp_structure = relationship ). - - rel_drawing-id = relationship-id. - - CONCATENATE dirname relationship-target INTO path. - path = resolve_path( path ). - rel_drawing-content = me->get_from_zip_archive( path ). "------------> This is for template usage - - path2 = path. - zcl_excel_common=>split_file( EXPORTING ip_file = path2 - IMPORTING ep_extension = file_ext2 ). - rel_drawing-file_ext = file_ext2. - - "-------------Added by Alessandro Iannacci - Should load graph xml - CASE relationship-type. - WHEN lc_rel_chart. - "Read chart xml - rel_drawing-content_xml = me->get_ixml_from_zip_archive( path ). - WHEN OTHERS. - ENDCASE. - "---------------------------- - - - APPEND rel_drawing TO rel_drawings. - - node ?= node->get_next( ). - ENDWHILE. - - drawing = me->get_ixml_from_zip_archive( ip_path ). - -* one-cell anchor ************** - anchors = drawing->get_elements_by_tag_name( name = 'oneCellAnchor' namespace = 'xdr' ). - coll_length = anchors->get_length( ). - iterator = anchors->create_iterator( ). - DO coll_length TIMES. - anchor_elem ?= iterator->get_next( ). - - CALL METHOD me->load_drawing_anchor - EXPORTING - io_anchor_element = anchor_elem - io_worksheet = io_worksheet - it_related_drawings = rel_drawings. - - ENDDO. - -* two-cell anchor ****************** - anchors = drawing->get_elements_by_tag_name( name = 'twoCellAnchor' namespace = 'xdr' ). - coll_length = anchors->get_length( ). - iterator = anchors->create_iterator( ). - DO coll_length TIMES. - anchor_elem ?= iterator->get_next( ). - - CALL METHOD me->load_drawing_anchor - EXPORTING - io_anchor_element = anchor_elem - io_worksheet = io_worksheet - it_related_drawings = rel_drawings. - - ENDDO. - - endmethod. - - - - - - - METHOD load_worksheet_hyperlinks. - - DATA: lo_ixml_hyperlinks TYPE REF TO if_ixml_node_collection, - lo_ixml_hyperlink TYPE REF TO if_ixml_element, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lv_row TYPE zexcel_cell_row, - lv_column TYPE zexcel_cell_column_alpha, - lo_hyperlink TYPE REF TO zcl_excel_hyperlink, - lv_value TYPE zexcel_cell_value. - - DATA: BEGIN OF ls_hyperlink, - ref TYPE string, - display TYPE string, - location TYPE string, - tooltip TYPE string, - r_id TYPE string, - END OF ls_hyperlink. - - FIELD-SYMBOLS: <ls_external_hyperlink> LIKE LINE OF it_external_hyperlinks. - - lo_ixml_hyperlinks = io_ixml_worksheet->get_elements_by_tag_name( name = 'hyperlink' ). - lo_ixml_iterator = lo_ixml_hyperlinks->create_iterator( ). - lo_ixml_hyperlink ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_hyperlink IS BOUND. - - CLEAR ls_hyperlink. - CLEAR lo_hyperlink. - - ls_hyperlink-ref = lo_ixml_hyperlink->get_attribute_ns( 'ref' ). - ls_hyperlink-display = lo_ixml_hyperlink->get_attribute_ns( 'display' ). - ls_hyperlink-location = lo_ixml_hyperlink->get_attribute_ns( 'location' ). - ls_hyperlink-tooltip = lo_ixml_hyperlink->get_attribute_ns( 'tooltip' ). - ls_hyperlink-r_id = lo_ixml_hyperlink->get_attribute( name = 'id' - namespace = 'r' ). - IF ls_hyperlink-r_id IS INITIAL. " Internal link - lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = ls_hyperlink-location ). - ELSE. " External link - READ TABLE it_external_hyperlinks ASSIGNING <ls_external_hyperlink> WITH TABLE KEY id = ls_hyperlink-r_id. - IF sy-subrc = 0. - lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = <ls_external_hyperlink>-target ). - ENDIF. - ENDIF. - IF lo_hyperlink IS BOUND. " because of unsupported external links - - zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING - i_columnrow = ls_hyperlink-ref - IMPORTING - e_row = lv_row - e_column = lv_column ). -* Currently it is not allowed to pass a hyperlink w/o text, but text has already been read. -* So just reread it and be done with it - io_worksheet->get_cell( EXPORTING - ip_column = lv_column - ip_row = lv_row - IMPORTING - ep_value = lv_value ). - io_worksheet->set_cell( ip_column = lv_column - ip_row = lv_row - ip_value = lv_value - ip_hyperlink = lo_hyperlink ). - ENDIF. - - lo_ixml_hyperlink ?= lo_ixml_iterator->get_next( ). - - ENDWHILE. - - -ENDMETHOD. - - - - - - METHOD load_worksheet_pagebreaks. - - DATA: lo_node TYPE REF TO if_ixml_element, - lo_ixml_rowbreaks TYPE REF TO if_ixml_node_collection, - lo_ixml_colbreaks TYPE REF TO if_ixml_node_collection, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - lo_ixml_rowbreak TYPE REF TO if_ixml_element, - lo_ixml_colbreak TYPE REF TO if_ixml_element, - lo_style_conditional TYPE REF TO zcl_excel_style_conditional, - lv_count TYPE i. - - - DATA: lt_pagebreaks TYPE STANDARD TABLE OF zcl_excel_worksheet_pagebreaks=>ts_pagebreak_at, - lo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks. - - FIELD-SYMBOLS: <ls_pagebreak_row> LIKE LINE OF lt_pagebreaks. - FIELD-SYMBOLS: <ls_pagebreak_col> LIKE LINE OF lt_pagebreaks. - -*--------------------------------------------------------------------* -* Get minimal number of cells where to add pagebreaks -* Since rows and columns are handled in separate nodes -* Build table to identify these cells -*--------------------------------------------------------------------* - lo_node ?= io_ixml_worksheet->find_from_name( 'rowBreaks' ). - check lo_node is bound. - lo_ixml_rowbreaks = lo_node->get_elements_by_tag_name( name = 'brk' ). - lo_ixml_iterator = lo_ixml_rowbreaks->create_iterator( ). - lo_ixml_rowbreak ?= lo_ixml_iterator->get_next( ). - WHILE lo_ixml_rowbreak IS BOUND. - APPEND INITIAL LINE TO lt_pagebreaks ASSIGNING <ls_pagebreak_row>. - <ls_pagebreak_row>-cell_row = lo_ixml_rowbreak->get_attribute_ns( 'id' ). - - lo_ixml_rowbreak ?= lo_ixml_iterator->get_next( ). - ENDWHILE. - CHECK <ls_pagebreak_row> IS ASSIGNED. - - lo_node ?= io_ixml_worksheet->find_from_name( 'colBreaks' ). - check lo_node is bound. - lo_ixml_colbreaks = lo_node->get_elements_by_tag_name( name = 'brk' ). - lo_ixml_iterator = lo_ixml_colbreaks->create_iterator( ). - lo_ixml_colbreak ?= lo_ixml_iterator->get_next( ). - CLEAR lv_count. - WHILE lo_ixml_colbreak IS BOUND. - ADD 1 TO lv_count. - READ TABLE lt_pagebreaks INDEX lv_count ASSIGNING <ls_pagebreak_col>. - IF sy-subrc <> 0. - APPEND INITIAL LINE TO lt_pagebreaks ASSIGNING <ls_pagebreak_col>. - <ls_pagebreak_col>-cell_row = <ls_pagebreak_row>-cell_row. - ENDIF. - <ls_pagebreak_col>-cell_column = lo_ixml_colbreak->get_attribute_ns( 'id' ). - - lo_ixml_colbreak ?= lo_ixml_iterator->get_next( ). - ENDWHILE. -*--------------------------------------------------------------------* -* Finally add each pagebreak -*--------------------------------------------------------------------* - lo_pagebreaks = io_worksheet->get_pagebreaks( ). - LOOP AT lt_pagebreaks ASSIGNING <ls_pagebreak_row>. - lo_pagebreaks->add_pagebreak( ip_column = <ls_pagebreak_row>-cell_column - ip_row = <ls_pagebreak_row>-cell_row ). - ENDLOOP. - - -ENDMETHOD. - - - - - - METHOD load_worksheet_pagemargins. - - TYPES: BEGIN OF lty_page_margins, - footer TYPE string, - header TYPE string, - bottom TYPE string, - top TYPE string, - right TYPE string, - left TYPE string, - END OF lty_page_margins. - - DATA:lo_ixml_pagemargins_elem TYPE REF TO if_ixml_element, - ls_pagemargins TYPE lty_page_margins. - - - lo_ixml_pagemargins_elem = io_ixml_worksheet->find_from_name( 'pageMargins' ). - IF lo_ixml_pagemargins_elem IS NOT INITIAL. - fill_struct_from_attributes( EXPORTING - ip_element = lo_ixml_pagemargins_elem - CHANGING - cp_structure = ls_pagemargins ). - io_worksheet->sheet_setup->margin_bottom = zcl_excel_common=>excel_string_to_number( ls_pagemargins-bottom ). - io_worksheet->sheet_setup->margin_footer = zcl_excel_common=>excel_string_to_number( ls_pagemargins-footer ). - io_worksheet->sheet_setup->margin_header = zcl_excel_common=>excel_string_to_number( ls_pagemargins-header ). - io_worksheet->sheet_setup->margin_left = zcl_excel_common=>excel_string_to_number( ls_pagemargins-left ). - io_worksheet->sheet_setup->margin_right = zcl_excel_common=>excel_string_to_number( ls_pagemargins-right ). - io_worksheet->sheet_setup->margin_top = zcl_excel_common=>excel_string_to_number( ls_pagemargins-top ). - ENDIF. - -ENDMETHOD. - - - - - METHOD read_from_applserver. - - DATA: lv_filelength TYPE i, - lt_binary_data TYPE STANDARD TABLE OF x255 WITH NON-UNIQUE DEFAULT KEY, - ls_binary_data LIKE LINE OF lt_binary_data, - lv_filename TYPE string, - lv_max_length_line TYPE i, - lv_actual_length_line TYPE i, - lv_errormessage TYPE string. - - MOVE i_filename TO lv_filename. - - DESCRIBE FIELD ls_binary_data LENGTH lv_max_length_line IN BYTE MODE. - OPEN DATASET lv_filename FOR INPUT IN BINARY MODE. - IF sy-subrc <> 0. - lv_errormessage = 'A problem occured when reading the file'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - WHILE sy-subrc = 0. - - READ DATASET lv_filename INTO ls_binary_data MAXIMUM LENGTH lv_max_length_line ACTUAL LENGTH lv_actual_length_line. - APPEND ls_binary_data TO lt_binary_data. - lv_filelength = lv_filelength + lv_actual_length_line. - - ENDWHILE. - CLOSE DATASET lv_filename. - -*--------------------------------------------------------------------* -* Binary data needs to be provided as XSTRING for further processing -*--------------------------------------------------------------------* - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filelength - IMPORTING - buffer = r_excel_data - TABLES - binary_tab = lt_binary_data. - ENDMETHOD. - - - - - - METHOD read_from_local_file. - DATA: lv_filelength TYPE i, - lt_binary_data TYPE STANDARD TABLE OF x255 WITH NON-UNIQUE DEFAULT KEY, - ls_binary_data LIKE LINE OF lt_binary_data, - lv_filename TYPE string, - lv_errormessage TYPE string. - - MOVE i_filename TO lv_filename. - - cl_gui_frontend_services=>gui_upload( EXPORTING - filename = lv_filename - filetype = 'BIN' " We are basically working with zipped directories --> force binary read - IMPORTING - filelength = lv_filelength - CHANGING - data_tab = lt_binary_data - 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. - lv_errormessage = 'A problem occured when reading the file'(001). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* Binary data needs to be provided as XSTRING for further processing -*--------------------------------------------------------------------* - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filelength - IMPORTING - buffer = r_excel_data - TABLES - binary_tab = lt_binary_data. - - ENDMETHOD. - - - - - method RESOLVE_PATH. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 Determine whether the replacement should be done -* iterative to allow /../../.. or something alike -* 2do§2 Determine whether /./ has to be supported as well -* 2do§3 Create unit-test for this method -* -* Please don't just delete these ToDos if they are not -* needed but leave a comment that states this -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-11 -* - ... -* changes: replaced previous coding by regular expression -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* §1 This routine will receive a path, that may have a relative pathname (/../) included somewhere -* The output should be a resolved path without relative references -* Example: Input xl/worksheets/../drawings/drawing1.xml -* Output xl/drawings/drawing1.xml -*--------------------------------------------------------------------* - - rp_result = ip_path. -*--------------------------------------------------------------------* -* §1 Remove relative pathnames -*--------------------------------------------------------------------* -* Regular expression [^/]*/\.\./ -* [^/]* --> any number of characters other than / -* followed by /\.\./ --> the sequence /../ -* ==> worksheets/../ will be found in the example -*--------------------------------------------------------------------* - REPLACE REGEX '[^/]*/\.\./' IN rp_result WITH ``. - - - endmethod. - - - method RESOLVE_REFERENCED_FORMULAE. - TYPES: BEGIN OF ty_referenced_cells, - sheet TYPE REF TO zcl_excel_worksheet, - si TYPE i, - row_from TYPE i, - row_to TYPE i, - col_from TYPE i, - col_to TYPE i, - formula TYPE string, - ref_cell TYPE char10, - END OF ty_referenced_cells. - - DATA: ls_ref_formula LIKE LINE OF me->mt_ref_formulae, - lts_referenced_cells TYPE SORTED TABLE OF ty_referenced_cells WITH NON-UNIQUE KEY sheet si row_from row_to col_from col_to, - ls_referenced_cell LIKE LINE OF lts_referenced_cells, - lv_col_from TYPE zexcel_cell_column_alpha, - lv_col_to TYPE zexcel_cell_column_alpha, - lv_resulting_formula TYPE string, - lv_current_cell TYPE char10. - - - me->mt_ref_formulae = me->mt_ref_formulae. - -*--------------------------------------------------------------------* -* Get referenced Cells, Build ranges for easy lookup -*--------------------------------------------------------------------* - LOOP AT me->mt_ref_formulae INTO ls_ref_formula WHERE ref <> space. - - CLEAR ls_referenced_cell. - ls_referenced_cell-sheet = ls_ref_formula-sheet. - ls_referenced_cell-si = ls_ref_formula-si. - ls_referenced_cell-formula = ls_ref_formula-formula. - - TRY. - zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = ls_ref_formula-ref - IMPORTING e_column_start = lv_col_from - e_column_end = lv_col_to - e_row_start = ls_referenced_cell-row_from - e_row_end = ls_referenced_cell-row_to ). - ls_referenced_cell-col_from = zcl_excel_common=>convert_column2int( lv_col_from ). - ls_referenced_cell-col_to = zcl_excel_common=>convert_column2int( lv_col_to ). - - - CLEAR ls_referenced_cell-ref_cell. - TRY. - ls_referenced_cell-ref_cell(3) = zcl_excel_common=>convert_column2alpha( ls_ref_formula-column ). - ls_referenced_cell-ref_cell+3 = ls_ref_formula-row. - CONDENSE ls_referenced_cell-ref_cell NO-GAPS. - CATCH zcx_excel. - ENDTRY. - - INSERT ls_referenced_cell INTO TABLE lts_referenced_cells. - CATCH zcx_excel. - ENDTRY. - - ENDLOOP. - -* break x0009004. -*--------------------------------------------------------------------* -* For each referencing cell determine the referenced cell -* and resolve the formula -*--------------------------------------------------------------------* - LOOP AT me->mt_ref_formulae INTO ls_ref_formula WHERE ref = space. - - - CLEAR lv_current_cell. - TRY. - lv_current_cell(3) = zcl_excel_common=>convert_column2alpha( ls_ref_formula-column ). - lv_current_cell+3 = ls_ref_formula-row. - CONDENSE lv_current_cell NO-GAPS. - CATCH zcx_excel. - ENDTRY. - - LOOP AT lts_referenced_cells INTO ls_referenced_cell WHERE sheet = ls_ref_formula-sheet - AND si = ls_ref_formula-si - AND row_from <= ls_ref_formula-row - AND row_to >= ls_ref_formula-row - AND col_from <= ls_ref_formula-column - AND col_to >= ls_ref_formula-column. - - TRY. - - lv_resulting_formula = zcl_excel_common=>determine_resulting_formula( iv_reference_cell = ls_referenced_cell-ref_cell - iv_reference_formula = ls_referenced_cell-formula - iv_current_cell = lv_current_cell ). - - ls_referenced_cell-sheet->set_cell_formula( ip_column = ls_ref_formula-column - ip_row = ls_ref_formula-row - ip_formula = lv_resulting_formula ). - CATCH zcx_excel. - ENDTRY. - EXIT. - - ENDLOOP. - - ENDLOOP. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_HUGE_FILE.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_HUGE_FILE.slnk deleted file mode 100644 index 3386300..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_HUGE_FILE.slnk +++ /dev/null @@ -1,635 +0,0 @@ - - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - -* Signal "not found" -class lcx_not_found implementation. - method constructor. - super->constructor( textid = textid previous = previous ). - me->error = error. - endmethod. "constructor - method if_message~get_text. - result = error. - endmethod. "if_message~get_text -endclass. "lcx_not_found IMPLEMENTATION - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - -* Signal for "Not found" -class lcx_not_found definition inheriting from cx_static_check. - public section. - data error type string. - methods constructor - importing error type string - textid type sotr_conc optional - previous type ref to cx_root optional. - methods if_message~get_text redefinition. -endclass. - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes -class lcl_test definition deferred. -class zcl_excel_reader_huge_file definition local friends lcl_test. - -* -class lcl_test definition for testing " #AU Risk_Level Harmless - inheriting from cl_aunit_assert. " #AU Duration Short - - private section. - data: - out type ref to zcl_excel_reader_huge_file, " object under test - excel type ref to zcl_excel, - worksheet type ref to zcl_excel_worksheet. - methods: - setup, - test_number for testing, - test_shared_string for testing, - test_shared_string_missing for testing, - test_inline_string for testing, - test_empty_cells for testing, - test_boolean for testing, - test_style for testing, - test_style_missing for testing, - test_formula for testing, - test_read_shared_strings for testing, - test_shared_string_some_empty for testing, - test_skip_to_inexistent for testing, - get_reader importing iv_xml type string returning value(eo_reader) type ref to if_sxml_reader, - assert_value_equals importing iv_row type i default 1 iv_col type i default 1 iv_value type string, - assert_formula_equals importing iv_row type i default 1 iv_col type i default 1 iv_formula type string, - assert_style_equals importing iv_row type i default 1 iv_col type i default 1 iv_style type ZEXCEL_CELL_STYLE, - assert_datatype_equals importing iv_row type i default 1 iv_col type i default 1 iv_datatype type string. - -endclass. "lcl_test DEFINITION - -* -class lcl_test implementation. - -* - method test_number. - data lo_reader type ref to if_sxml_reader. - lo_reader = get_reader( - `<c r="A1" t="n"><v>17</v></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - assert_value_equals( `17` ). - assert_datatype_equals( `n` ). - endmethod. "test_shared_string - -* - method test_shared_string. - data lo_reader type ref to if_sxml_reader. - append `Test1` to out->shared_strings. - append `Test2` to out->shared_strings. - lo_reader = get_reader( - `<c r="A1" t="s"><v>1</v></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - assert_value_equals( `Test2` ). - assert_datatype_equals( `s` ). - endmethod. "test_shared_string -* - method test_shared_string_missing. - - data: lo_reader type ref to if_sxml_reader, - lo_ex type ref to lcx_not_found, - lv_text type string. - append `Test` to out->shared_strings. - lo_reader = get_reader( - `<c r="A1" t="s"><v>1</v></c>` - ). - - try. - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - fail(`Index to non-existent shared string should give an error`). - catch lcx_not_found into lo_ex. - lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger - endtry. - - endmethod. -* - method test_inline_string. - data lo_reader type ref to if_sxml_reader. - lo_reader = get_reader( - `<c r="A1" t="inlineStr"><is><t>Alpha</t></is></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - assert_value_equals( `Alpha` ). - assert_datatype_equals( `inlineStr` ). - endmethod. "test_inline_string - -* - method test_boolean. - data lo_reader type ref to if_sxml_reader. - lo_reader = get_reader( - `<c r="A1" t="b"><v>1</v></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - assert_value_equals( `1` ). - assert_datatype_equals( `b` ). - endmethod. "test_boolean - -* - method test_formula. - data lo_reader type ref to if_sxml_reader. - lo_reader = get_reader( - `<c r="A1" t="n"><f>A2*A2</f></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - assert_formula_equals( `A2*A2` ). - assert_datatype_equals( `n` ). - endmethod. "test_formula - -* - method test_empty_cells. - -* There is no need to store an empty cell in the ABAP worksheet structure - - data: lo_reader type ref to if_sxml_reader, - lo_ex type ref to lcx_not_found, - lv_text type string. - append `` to out->shared_strings. - append `t` to out->shared_strings. - lo_reader = get_reader( - `<c r="A1" t="s"><v>0</v></c>` & - `<c r="A2" t="inlineStr"><is><t></t></is></c>` & - `<c r="A3" t="s"><v>1</v></c>` - ). - - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - - assert_value_equals( iv_row = 1 iv_col = 1 iv_value = `` ). - assert_value_equals( iv_row = 2 iv_col = 1 iv_value = `` ). - assert_value_equals( iv_row = 3 iv_col = 1 iv_value = `t` ). - - endmethod. - -* - method test_style. - data: - lo_reader type ref to if_sxml_reader, - lo_style type ref to zcl_excel_style, - lv_guid type ZEXCEL_CELL_STYLE. - create object lo_style. - append lo_style to out->styles. - lv_guid = lo_style->get_guid( ). - - lo_reader = get_reader( - `<c r="A1" s="0"><v>18</v></c>` - ). - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - - assert_style_equals( lv_guid ). - - endmethod. "test_style - -* - method test_style_missing. - - data: - lo_reader type ref to if_sxml_reader, - lo_ex type ref to lcx_not_found, - lv_text type string. - - lo_reader = get_reader( - `<c r="A1" s="0"><v>18</v></c>` - ). - - try. - out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - fail(`Reference to non-existent style should throw an lcx_not_found exception`). - catch lcx_not_found into lo_ex. - lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger - endtry. - - endmethod. "test_style - -* - method test_read_shared_strings. - data: lo_c2x type ref to cl_abap_conv_out_ce, - lv_xstring type xstring, - lo_reader type ref to if_sxml_reader, - lt_act type stringtab, - lt_exp type stringtab. - - lo_c2x = cl_abap_conv_out_ce=>create( ). - lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>` - importing buffer = lv_xstring ). - lo_reader = cl_sxml_string_reader=>create( lv_xstring ). - append : - `` to lt_exp, - `Alpha` to lt_exp, - `Bravo` to lt_exp. - - lt_act = out->read_shared_strings( lo_reader ). - - assert_equals( act = lt_act - exp = lt_exp ). - - endmethod. - -* - method test_shared_string_some_empty. - data: lo_reader type ref to if_sxml_reader, - lt_act type stringtab, - lt_exp type stringtab. - lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to( - `<sst><si><t/></si>` & - `<si><t>Alpha</t></si>` & - `<si><t/></si>` & - `<si><t>Bravo</t></si></sst>` - ) ). - append : - `` to lt_exp, - `Alpha` to lt_exp, - `` to lt_exp, - `Bravo` to lt_exp. - - lt_act = out->read_shared_strings( lo_reader ). - - assert_equals( act = lt_act - exp = lt_exp ). - - endmethod. - - -* - method test_skip_to_inexistent. - data: lo_c2x type ref to cl_abap_conv_out_ce, - lv_xstring type xstring, - lo_reader type ref to if_sxml_reader, - lo_ex type ref to lcx_not_found, - lv_text type string. - - lo_c2x = cl_abap_conv_out_ce=>create( ). - lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>` - importing buffer = lv_xstring ). - lo_reader = cl_sxml_string_reader=>create( lv_xstring ). - try. - out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ). - fail(`Skipping to non-existing element must raise lcx_not_found exception`). - catch lcx_not_found into lo_ex. - lv_text = lo_ex->get_text( ). " May inspect exception text in debugger - endtry. - endmethod. - -* - method get_reader. - data: lv_full type string, - lo_c2x type ref to cl_abap_conv_out_ce, - lv_xstring type xstring. - concatenate `<root><sheetData><row>` iv_xml `</row></sheetData></root>` into lv_full. - lo_c2x = cl_abap_conv_out_ce=>create( ). - lo_c2x->convert( exporting data = lv_full - importing buffer = lv_xstring ). - eo_reader = cl_sxml_string_reader=>create( lv_xstring ). - endmethod. "get_reader -* - method assert_value_equals. - - constants: lc_empty_string type string value is initial. - - field-symbols: <ls_cell_data> type zexcel_s_cell_data, - <lv_value> type string. - - read table worksheet->sheet_content assigning <ls_cell_data> - with table key cell_row = iv_row cell_column = iv_col. - if sy-subrc eq 0. - assign <ls_cell_data>-cell_value to <lv_value>. - else. - assign lc_empty_string to <lv_value>. - endif. - - assert_equals( act = <lv_value> - exp = iv_value ). - - endmethod. "assert_value_equals -** - method assert_formula_equals. - - field-symbols: <ls_cell_data> type zexcel_s_cell_data. - - read table worksheet->sheet_content assigning <ls_cell_data> - with table key cell_row = iv_row cell_column = iv_col. - assert_subrc( sy-subrc ). - - assert_equals( act = <ls_cell_data>-cell_formula - exp = iv_formula ). - - endmethod. "assert_formula_equals -* - method assert_style_equals. - - field-symbols: <ls_cell_data> type zexcel_s_cell_data. - - read table worksheet->sheet_content assigning <ls_cell_data> - with table key cell_row = iv_row cell_column = iv_col. - assert_subrc( sy-subrc ). - - assert_equals( act = <ls_cell_data>-cell_style - exp = iv_style ). - - endmethod. -* - method assert_datatype_equals. - - field-symbols: <ls_cell_data> type zexcel_s_cell_data. - - read table worksheet->sheet_content assigning <ls_cell_data> - with table key cell_row = iv_row cell_column = iv_col. - assert_subrc( sy-subrc ). - - assert_equals( act = <ls_cell_data>-data_type - exp = iv_datatype ). - - endmethod. "assert_datatype_equals - method setup. - create object out. - create object excel. - create object worksheet - exporting - ip_excel = excel. - endmethod. "setup -endclass. "lcl_test IMPLEMENTATION - - - - - - - - - - - - - - - - method FILL_CELL_FROM_ATTRIBUTES. - - while io_reader->node_type ne c_end_of_stream. - io_reader->next_attribute( ). - if io_reader->node_type ne c_attribute. - exit. - endif. - case io_reader->name. - when `t`. - es_cell-datatype = io_reader->value. - when `s`. - if io_reader->value is not initial. - es_cell-style = get_style( io_reader->value ). - endif. - when `r`. - es_cell-coord = get_cell_coord( io_reader->value ). - endcase. - endwhile. - -endmethod. - - - - - method GET_CELL_COORD. - - zcl_excel_common=>convert_columnrow2column_a_row( - exporting - i_columnrow = iv_coord - importing - e_column = es_coord-column - e_row = es_coord-row - ). - -endmethod. - - - - - - method GET_SHARED_STRING. - data: lv_tabix type i, - lv_error type string. - lv_tabix = iv_index + 1. - read table shared_strings into ev_value index lv_tabix. - if sy-subrc ne 0. - concatenate 'Entry ' iv_index ' not found in Shared String Table' into lv_error. - raise exception type lcx_not_found - exporting - error = lv_error. - endif. -endmethod. - - - - - - method GET_STYLE. - - data: lv_tabix type i, - lo_style type ref to zcl_excel_style, - lv_error type string. - - if gs_buffer_style-index ne iv_index. - lv_tabix = iv_index + 1. - read table styles into lo_style index lv_tabix. - if sy-subrc ne 0. - concatenate 'Entry ' iv_index ' not found in Style Table' into lv_error. - raise exception type lcx_not_found - exporting - error = lv_error. - else. - gs_buffer_style-index = iv_index. - gs_buffer_style-guid = lo_style->get_guid( ). - endif. - endif. - - ev_style_guid = gs_buffer_style-guid. - -endmethod. - - - - - - method GET_SXML_READER. - - data: lv_xml type xstring. - - lv_xml = get_from_zip_archive( iv_path ). - eo_reader = cl_sxml_string_reader=>create( lv_xml ). - -endmethod. - - - method LOAD_SHARED_STRINGS. - - data: lo_reader type ref to if_sxml_reader. - - lo_reader = get_sxml_reader( ip_path ). - - shared_strings = read_shared_strings( lo_reader ). - -endmethod. - - - method LOAD_WORKSHEET. - - data: lo_reader type ref to if_sxml_reader. - - lo_reader = get_sxml_reader( ip_path ). - - read_worksheet_data( io_reader = lo_reader - io_worksheet = io_worksheet ). - -endmethod. - - - - - method PUT_CELL_TO_WORKSHEET. - check is_cell-value is not initial - or is_cell-formula is not initial - or is_cell-style is not initial. - call method io_worksheet->set_cell - exporting - ip_column = is_cell-column - ip_row = is_cell-row - ip_value = is_cell-value - ip_formula = is_cell-formula - ip_data_type = is_cell-datatype - ip_style = is_cell-style. -endmethod. - - - - - method read_shared_strings. - - data lv_value type string. - - while io_reader->node_type ne c_end_of_stream. - io_reader->next_node( ). - if io_reader->name eq `t`. - case io_reader->node_type . - when c_element_open . - clear lv_value . - when c_node_value . - lv_value = lv_value && io_reader->value . - when c_element_close . - append lv_value to et_shared_strings. - endcase . - endif. - endwhile. - -endmethod. - - - - - - method READ_WORKSHEET_DATA. - - data: ls_cell type t_cell. - -* Skip to <sheetData> element - skip_to( iv_element_name = `sheetData` io_reader = io_reader ). - -* Main loop: Evaluate the <c> elements and its children - while io_reader->node_type ne c_end_of_stream. - io_reader->next_node( ). - case io_reader->node_type. - when c_element_open. - if io_reader->name eq `c`. - ls_cell = fill_cell_from_attributes( io_reader ). - endif. - when c_node_value. - case io_reader->name. - when `f`. - ls_cell-formula = io_reader->value. - when `v`. - if ls_cell-datatype eq `s`. - ls_cell-value = get_shared_string( io_reader->value ). - else. - ls_cell-value = io_reader->value. - endif. - when `t` or `is`. - ls_cell-value = io_reader->value. - endcase. - when c_element_close. - case io_reader->name. - when `c`. - put_cell_to_worksheet( is_cell = ls_cell io_worksheet = io_worksheet ). - when `sheetData`. - exit. - endcase. - endcase. - endwhile. - -endmethod. - - - - - - method SKIP_TO. - - data: lv_error type string. - -* Skip forward to given element - while io_reader->name ne iv_element_name or - io_reader->node_type ne c_element_open. - io_reader->next_node( ). - if io_reader->node_type = c_end_of_stream. - concatenate 'XML error: Didn''t find element <' iv_element_name '>' into lv_error. - raise exception type lcx_not_found - exporting - error = lv_error. - endif. - endwhile. - - -endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_XLSM.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_XLSM.slnk deleted file mode 100644 index 51bd77d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_XLSM.slnk +++ /dev/null @@ -1,125 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - METHOD load_vbaproject. - - DATA lv_content TYPE xstring. - - lv_content = me->get_from_zip_archive( ip_path ). - - ip_excel->zif_excel_book_vba_project~set_vbaproject( lv_content ). - - ENDMETHOD. - - - method LOAD_WORKBOOK. - super->load_workbook( EXPORTING iv_workbook_full_filename = iv_workbook_full_filename - io_excel = io_excel ). - - CONSTANTS: lc_vba_project TYPE string VALUE 'http://schemas.microsoft.com/office/2006/relationships/vbaProject'. - - DATA: rels_workbook_path TYPE string, - rels_workbook TYPE REF TO if_ixml_document, - path TYPE string, - node TYPE REF TO if_ixml_element, - workbook TYPE REF TO if_ixml_document, - stripped_name TYPE chkfile, - dirname TYPE string, - relationship TYPE t_relationship, - fileversion TYPE t_fileversion, - workbookpr TYPE t_workbookpr. - - FIELD-SYMBOLS: <worksheet> TYPE t_relationship. - - CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' - EXPORTING - full_name = iv_workbook_full_filename - IMPORTING - stripped_name = stripped_name - file_path = dirname. - - " Read Workbook Relationships - CONCATENATE dirname '_rels/' stripped_name '.rels' - INTO rels_workbook_path. - - rels_workbook = me->get_ixml_from_zip_archive( rels_workbook_path ). - - node ?= rels_workbook->find_from_name( 'Relationship' ). - WHILE node IS BOUND. - me->fill_struct_from_attributes( EXPORTING ip_element = node CHANGING cp_structure = relationship ). - - CASE relationship-type. - WHEN lc_vba_project. - " Read VBA binary - CONCATENATE dirname relationship-target INTO path. - me->load_vbaproject( ip_path = path - ip_excel = io_excel ). - WHEN OTHERS. - ENDCASE. - - node ?= node->get_next( ). - ENDWHILE. - - " Read Workbook codeName - workbook = me->get_ixml_from_zip_archive( iv_workbook_full_filename ). - node ?= workbook->find_from_name( 'fileVersion' ). - IF node IS BOUND. - - fill_struct_from_attributes( EXPORTING ip_element = node - CHANGING cp_structure = fileversion ). - - io_excel->zif_excel_book_vba_project~set_codename( fileversion-codename ). - ENDIF. - - " Read Workbook codeName - workbook = me->get_ixml_from_zip_archive( iv_workbook_full_filename ). - node ?= workbook->find_from_name( 'workbookPr' ). - IF node IS BOUND. - - fill_struct_from_attributes( EXPORTING ip_element = node - CHANGING cp_structure = workbookpr ). - - io_excel->zif_excel_book_vba_project~set_codename_pr( workbookpr-codename ). - ENDIF. - - endmethod. - - - METHOD load_worksheet. - - super->load_worksheet( EXPORTING ip_path = ip_path - io_worksheet = io_worksheet ). - - DATA: path TYPE string, - node TYPE REF TO if_ixml_element, - worksheet TYPE REF TO if_ixml_document, - sheetpr TYPE t_sheetpr. - - " Read Workbook codeName - worksheet = me->get_ixml_from_zip_archive( ip_path ). - node ?= worksheet->find_from_name( 'sheetPr' ). - IF node IS BOUND. - - fill_struct_from_attributes( EXPORTING ip_element = node - CHANGING cp_structure = sheetpr ). - IF sheetpr-codename IS NOT INITIAL. - io_worksheet->zif_excel_sheet_vba_project~set_codename_pr( sheetpr-codename ). - ENDIF. - ENDIF. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_SECURITY.slnk b/ZA2X/CLAS/ZCL_EXCEL_SECURITY.slnk deleted file mode 100644 index 26f71bf..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_SECURITY.slnk +++ /dev/null @@ -1,26 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - METHOD is_security_enabled. - IF lockrevision EQ abap_true OR lockstructure EQ abap_true OR lockwindows EQ abap_true. - ep_security_enabled = abap_true. - ENDIF. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_SHEET_SETUP.slnk b/ZA2X/CLAS/ZCL_EXCEL_SHEET_SETUP.slnk deleted file mode 100644 index e1ed664..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_SHEET_SETUP.slnk +++ /dev/null @@ -1,368 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - orientation = me->c_orientation_default. - -* default margins - margin_bottom = '0.75'. - margin_footer = '0.3'. - margin_header = '0.3'. - margin_left = '0.7'. - margin_right = '0.7'. - margin_top = '0.75'. - -* clear page settings - CLEAR: black_and_white, - cell_comments, - copies, - draft, - errors, - first_page_number, - fit_to_page, - fit_to_height, - fit_to_width, - horizontal_dpi, - orientation, - page_order, - paper_height, - paper_size, - paper_width, - scale, - use_first_page_num, - use_printer_defaults, - vertical_dpi. - endmethod. - - - - - - - method GET_HEADER_FOOTER_STRING. -* ---------------------------------------------------------------------- - DATA: lc_marker_left(2) TYPE c VALUE '&L' - , lc_marker_right(2) TYPE c VALUE '&R' - , lc_marker_center(2) TYPE c VALUE '&C' - , lv_value TYPE string - . -* ---------------------------------------------------------------------- - IF ep_odd_header IS SUPPLIED. - - IF me->odd_header-left_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'LEFT' ). - CONCATENATE lc_marker_left lv_value INTO ep_odd_header. - ENDIF. - - IF me->odd_header-center_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'CENTER' ). - CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_odd_header. - ENDIF. - - IF me->odd_header-right_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'RIGHT' ). - CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_odd_header. - ENDIF. - - ENDIF. -* ---------------------------------------------------------------------- - IF ep_odd_footer IS SUPPLIED. - - IF me->odd_footer-left_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'LEFT' ). - CONCATENATE lc_marker_left lv_value INTO ep_odd_footer. - ENDIF. - - IF me->odd_footer-center_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'CENTER' ). - CONCATENATE ep_odd_footer lc_marker_center lv_value INTO ep_odd_footer. - ENDIF. - - IF me->odd_footer-right_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'RIGHT' ). - CONCATENATE ep_odd_footer lc_marker_right lv_value INTO ep_odd_footer. - ENDIF. - - ENDIF. -* ---------------------------------------------------------------------- - IF ep_even_header IS SUPPLIED. - - IF me->even_header-left_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'LEFT' ). - CONCATENATE lc_marker_left lv_value INTO ep_even_header. - ENDIF. - - IF me->even_header-center_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'CENTER' ). - CONCATENATE ep_even_header lc_marker_center lv_value INTO ep_even_header. - ENDIF. - - IF me->even_header-right_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'RIGHT' ). - CONCATENATE ep_even_header lc_marker_right lv_value INTO ep_even_header. - ENDIF. - - ENDIF. -* ---------------------------------------------------------------------- - IF ep_even_footer IS SUPPLIED. - - IF me->even_footer-left_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'LEFT' ). - CONCATENATE lc_marker_left lv_value INTO ep_even_footer. - ENDIF. - - IF me->even_footer-center_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'CENTER' ). - CONCATENATE ep_even_footer lc_marker_center lv_value INTO ep_even_footer. - ENDIF. - - IF me->even_footer-right_value IS NOT INITIAL. - lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'RIGHT' ). - CONCATENATE ep_even_footer lc_marker_right lv_value INTO ep_even_footer. - ENDIF. - - ENDIF. -* ---------------------------------------------------------------------- - endmethod. - - - - - - method PROCESS_HEADER_FOOTER. - -* ---------------------------------------------------------------------- -* Only Basic font/text formatting possible: -* Bold (yes / no), Font Type, Font Size - - DATA: lv_fname(12) TYPE c - , lv_string TYPE string - . - - FIELD-SYMBOLS: <lv_value> TYPE string - , <ls_font> TYPE zexcel_s_style_font - . - -* ---------------------------------------------------------------------- - CONCATENATE ip_side '_VALUE' INTO lv_fname. - ASSIGN COMPONENT lv_fname OF STRUCTURE ip_header TO <lv_value>. - - CONCATENATE ip_side '_FONT' INTO lv_fname. - ASSIGN COMPONENT lv_fname OF STRUCTURE ip_header TO <ls_font>. - - IF <ls_font> IS ASSIGNED AND <lv_value> IS ASSIGNED. - - IF <ls_font>-name IS NOT INITIAL. - CONCATENATE '&"' <ls_font>-name ',' INTO rv_processed_string. - ELSE. - rv_processed_string = '&"-,'. - ENDIF. - - IF <ls_font>-bold = abap_true. - CONCATENATE rv_processed_string 'Bold"' INTO rv_processed_string. - ELSE. - CONCATENATE rv_processed_string 'Standard"' INTO rv_processed_string. - ENDIF. - - IF <ls_font>-size IS NOT INITIAL. - lv_string = <ls_font>-size. - CONCATENATE rv_processed_string '&' lv_string INTO rv_processed_string. - ENDIF. - - CONCATENATE rv_processed_string <lv_value> INTO rv_processed_string. - - ENDIF. -* ---------------------------------------------------------------------- - - endmethod. - - - - - - - method SET_HEADER_FOOTER. - -* Only Basic font/text formatting possible: -* Bold (yes / no), Font Type, Font Size -* -* usefull placeholders, which can be used in header/footer value strings -* '&P' - page number -* '&N' - total number of pages -* '&D' - Date -* '&T' - Time -* '&F' - File Name -* '&Z' - Path -* '&A' - Sheet name -* new line via class constant CL_ABAP_CHAR_UTILITIES=>newline -* -* Example Value String 'page &P of &N' -* -* DO NOT USE &L , &C or &R which automatically created as position markers - - me->odd_header = ip_odd_header. - me->odd_footer = ip_odd_footer. - me->even_header = ip_even_header. - me->even_footer = ip_even_footer. - - IF me->even_header IS NOT INITIAL OR me->even_footer IS NOT INITIAL. - me->diff_oddeven_headerfooter = abap_true. - ENDIF. - - - endmethod. - - - - - - - - - - method SET_PAGE_MARGINS. - DATA: lv_coef TYPE f, - lv_unit TYPE string. - - lv_unit = ip_unit. - TRANSLATE lv_unit TO UPPER CASE. - - CASE lv_unit. - WHEN 'IN'. lv_coef = 1. - WHEN 'CM'. lv_coef = '0.393700787'. - WHEN 'MM'. lv_coef = '0.0393700787'. - ENDCASE. - - IF ip_bottom IS SUPPLIED. margin_bottom = lv_coef * ip_bottom. ENDIF. - IF ip_footer IS SUPPLIED. margin_footer = lv_coef * ip_footer. ENDIF. - IF ip_header IS SUPPLIED. margin_header = lv_coef * ip_header. ENDIF. - IF ip_left IS SUPPLIED. margin_left = lv_coef * ip_left. ENDIF. - IF ip_right IS SUPPLIED. margin_right = lv_coef * ip_right. ENDIF. - IF ip_top IS SUPPLIED. margin_top = lv_coef * ip_top. ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk deleted file mode 100644 index b57481e..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk +++ /dev/null @@ -1,53 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - METHOD constructor. - - - CREATE OBJECT font. - CREATE OBJECT fill. - CREATE OBJECT borders. - CREATE OBJECT alignment. - CREATE OBJECT number_format. - CREATE OBJECT protection. - -* Start of insertion # issue 139 - Dateretention of cellstyles - IF ip_guid IS NOT INITIAL. - me->guid = ip_guid. - ELSE. -* End of insertion # issue 139 - Dateretention of cellstyles -* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases -* IMPORTING -* ev_guid_16 = me->guid. - me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call -* Start of insertion # issue 139 - Dateretention of cellstyles - ENDIF. -* End of insertion # issue 139 - Dateretention of cellstyles - -ENDMETHOD. - - - - method GET_GUID. - - - ep_guid = me->guid. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLES.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLES.slnk deleted file mode 100644 index 5ab275c..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLES.slnk +++ /dev/null @@ -1,85 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - method ADD. - - - styles->add( ip_style ). - endmethod. - - - method CLEAR. - - - styles->clear( ). - endmethod. - - - method CONSTRUCTOR. - - - CREATE OBJECT styles. - endmethod. - - - - - method GET. - - - eo_style ?= styles->if_object_collection~get( ip_index ). - endmethod. - - - - method GET_ITERATOR. - - - eo_iterator ?= styles->if_object_collection~get_iterator( ). - endmethod. - - - - method IS_EMPTY. - - - is_empty = styles->if_object_collection~is_empty( ). - endmethod. - - - - - method REGISTER_NEW_STYLE. - - - me->add( io_style ). - ep_style_code = me->size( ) - 1. "style count starts from 0 - endmethod. - - - - method REMOVE. - - - styles->remove( ip_style ). - endmethod. - - - - method SIZE. - - - ep_size = styles->if_object_collection~size( ). - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLES_CONDITIONAL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLES_CONDITIONAL.slnk deleted file mode 100644 index 40810e0..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLES_CONDITIONAL.slnk +++ /dev/null @@ -1,63 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - method ADD. - styles_conditional->add( ip_style_conditional ). - endmethod. - - - method CLEAR. - styles_conditional->clear( ). - endmethod. - - - method CONSTRUCTOR. - - CREATE OBJECT styles_conditional. - - endmethod. - - - - - method GET. - DATA lv_index TYPE i. - lv_index = ip_index. - eo_style_conditional ?= styles_conditional->if_object_collection~get( lv_index ). - endmethod. - - - - method GET_ITERATOR. - eo_iterator ?= styles_conditional->if_object_collection~get_iterator( ). - endmethod. - - - - method IS_EMPTY. - is_empty = styles_conditional->if_object_collection~is_empty( ). - endmethod. - - - - method REMOVE. - styles_conditional->remove( ip_style_conditional ). - endmethod. - - - - method SIZE. - ep_size = styles_conditional->if_object_collection~size( ). - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_ALIGNMENT.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_ALIGNMENT.slnk deleted file mode 100644 index b047f31..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_ALIGNMENT.slnk +++ /dev/null @@ -1,50 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - horizontal = me->c_horizontal_general. - vertical = me->c_vertical_bottom. - wrapText = abap_false. - shrinkToFit = abap_false. - endmethod. - - - - method GET_STRUCTURE. - - es_alignment-horizontal = me->horizontal. - es_alignment-vertical = me->vertical. - es_alignment-textrotation = me->textrotation. - es_alignment-wraptext = me->wraptext. - es_alignment-shrinktofit = me->shrinktofit. - es_alignment-indent = me->indent. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDER.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDER.slnk deleted file mode 100644 index 8cbfca2..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDER.slnk +++ /dev/null @@ -1,34 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - method CONSTRUCTOR. - border_style = zcl_excel_style_border=>c_border_none. - border_color-theme = zcl_excel_style_color=>c_theme_not_set. - border_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDERS.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDERS.slnk deleted file mode 100644 index bc6e557..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_BORDERS.slnk +++ /dev/null @@ -1,88 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - method GET_STRUCTURE. -*initialize colors to 'not set' - es_fill-left_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - es_fill-left_color-theme = zcl_excel_style_color=>c_theme_not_set. - es_fill-right_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - es_fill-right_color-theme = zcl_excel_style_color=>c_theme_not_set. - es_fill-top_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - es_fill-top_color-theme = zcl_excel_style_color=>c_theme_not_set. - es_fill-bottom_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - es_fill-bottom_color-theme = zcl_excel_style_color=>c_theme_not_set. - es_fill-diagonal_color-indexed = zcl_excel_style_color=>c_indexed_not_set. - es_fill-diagonal_color-theme = zcl_excel_style_color=>c_theme_not_set. - -* Check if all borders is set otherwise check single border - IF me->allborders IS BOUND. - es_fill-left_color = me->allborders->border_color. - es_fill-left_style = me->allborders->border_style. - es_fill-right_color = me->allborders->border_color. - es_fill-right_style = me->allborders->border_style. - es_fill-top_color = me->allborders->border_color. - es_fill-top_style = me->allborders->border_style. - es_fill-bottom_color = me->allborders->border_color. - es_fill-bottom_style = me->allborders->border_style. - ELSE. - IF me->left IS BOUND. - es_fill-left_color = me->left->border_color. - es_fill-left_style = me->left->border_style. - ENDIF. - IF me->right IS BOUND. - es_fill-right_color = me->right->border_color. - es_fill-right_style = me->right->border_style. - ENDIF. - IF me->top IS BOUND. - es_fill-top_color = me->top->border_color. - es_fill-top_style = me->top->border_style. - ENDIF. - IF me->down IS BOUND. - es_fill-bottom_color = me->down->border_color. - es_fill-bottom_style = me->down->border_style. - ENDIF. - ENDIF. - -* Check if diagonal is set - IF me->diagonal IS BOUND. - es_fill-diagonal_color = me->diagonal->border_color. - es_fill-diagonal_style = me->diagonal->border_style. - CASE me->diagonal_mode. - WHEN 1. - es_fill-diagonalup = 1. - es_fill-diagonaldown = 0. - WHEN 2. - es_fill-diagonalup = 0. - es_fill-diagonaldown = 1. - WHEN 3. - es_fill-diagonalup = 1. - es_fill-diagonaldown = 1. - WHEN OTHERS. - es_fill-diagonalup = 0. - es_fill-diagonaldown = 0. - ENDCASE. - ENDIF. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_COLOR.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_COLOR.slnk deleted file mode 100644 index cccd030..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_COLOR.slnk +++ /dev/null @@ -1,82 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - METHOD create_new_arbg_int. - DATA: lv_red TYPE int1, - lv_green TYPE int1, - lv_blue TYPE int1, - lv_hex TYPE x, - lv_char_red TYPE zexcel_style_color_component, - lv_char_green TYPE zexcel_style_color_component, - lv_char_blue TYPE zexcel_style_color_component. - - lv_red = iv_red MOD 256. - lv_green = iv_green MOD 256. - lv_blue = iv_blue MOD 256. - - lv_hex = lv_red. - lv_char_red = lv_hex. - - lv_hex = lv_green. - lv_char_green = lv_hex. - - lv_hex = lv_blue. - lv_char_blue = lv_hex. - - - concatenate zcl_excel_style_color=>c_alpha lv_char_red lv_char_green lv_char_blue into rv_color_argb. - - -ENDMETHOD. - - - - - - - METHOD create_new_argb. - - CONCATENATE zcl_excel_style_color=>c_alpha ip_red ip_green ip_blu INTO ep_color_argb. - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_CONDITIONAL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_CONDITIONAL.slnk deleted file mode 100644 index 394abc8..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_CONDITIONAL.slnk +++ /dev/null @@ -1,223 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - METHOD add_range. - DATA: lv_column TYPE zexcel_cell_column, - lv_row_alpha TYPE string, - lv_col_alpha TYPE string, - lv_coords1 TYPE string, - lv_coords2 TYPE string. - - - lv_column = zcl_excel_common=>convert_column2int( ip_start_column ). -* me->mv_cell_data-cell_row = 1. -* me->mv_cell_data-cell_column = lv_column. -* - lv_col_alpha = ip_start_column. - lv_row_alpha = ip_start_row. - SHIFT lv_row_alpha RIGHT DELETING TRAILING space. - SHIFT lv_row_alpha LEFT DELETING LEADING space. - CONCATENATE lv_col_alpha lv_row_alpha INTO lv_coords1. - - IF ip_stop_column IS NOT INITIAL. - lv_column = zcl_excel_common=>convert_column2int( ip_stop_column ). - ELSE. - lv_column = zcl_excel_common=>convert_column2int( ip_start_column ). - ENDIF. - - IF ip_stop_row IS NOT INITIAL. " If we don't get explicitly a stop column use start column - lv_row_alpha = ip_stop_row. - ELSE. - lv_row_alpha = ip_start_row. - ENDIF. - IF ip_stop_column IS NOT INITIAL. " If we don't get explicitly a stop column use start column - lv_col_alpha = ip_stop_column. - ELSE. - lv_col_alpha = ip_start_column. - ENDIF. - SHIFT lv_row_alpha RIGHT DELETING TRAILING space. - SHIFT lv_row_alpha LEFT DELETING LEADING space. - CONCATENATE lv_col_alpha lv_row_alpha INTO lv_coords2. - IF lv_coords2 IS NOT INITIAL AND lv_coords2 <> lv_coords1. - CONCATENATE me->mv_rule_range ` ` lv_coords1 ':' lv_coords2 INTO me->mv_rule_range. - ELSE. - CONCATENATE me->mv_rule_range ` ` lv_coords1 INTO me->mv_rule_range. - ENDIF. - SHIFT me->mv_rule_range LEFT DELETING LEADING space. - -ENDMETHOD. - - - METHOD constructor. - - DATA: ls_iconset TYPE zexcel_conditional_iconset. - ls_iconset-iconset = zcl_excel_style_conditional=>c_iconset_3trafficlights. - 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'. - - - me->rule = zcl_excel_style_conditional=>c_rule_none. -* me->iconset->operator = zcl_excel_style_conditional=>c_operator_none. - me->mode_iconset = ls_iconset. - me->priority = 1. - -* inizialize dimension range - me->MV_RULE_RANGE = 'A1'. -ENDMETHOD. - - - - - - - - - - - - - - - - - METHOD factory_cond_style_iconset. - -*--------------------------------------------------------------------* -* Work in progress -* Missing: LE or LT may be specified --> extend structure ZEXCEL_CONDITIONAL_ICONSET to hold this information as well -*--------------------------------------------------------------------* - -* DATA: lv_needed_values TYPE i. -* CASE icon_type. -* -* WHEN 'C_ICONSET_3ARROWS' -* OR 'C_ICONSET_3ARROWSGRAY' -* OR 'C_ICONSET_3FLAGS' -* OR 'C_ICONSET_3SIGNS' -* OR 'C_ICONSET_3SYMBOLS' -* OR 'C_ICONSET_3SYMBOLS2' -* OR 'C_ICONSET_3TRAFFICLIGHTS' -* OR 'C_ICONSET_3TRAFFICLIGHTS2'. -* lv_needed_values = 3. -* -* WHEN 'C_ICONSET_4ARROWS' -* OR 'C_ICONSET_4ARROWSGRAY' -* OR 'C_ICONSET_4RATING' -* OR 'C_ICONSET_4REDTOBLACK' -* OR 'C_ICONSET_4TRAFFICLIGHTS'. -* lv_needed_values = 4. -* -* WHEN 'C_ICONSET_5ARROWS' -* OR 'C_ICONSET_5ARROWSGRAY' -* OR 'C_ICONSET_5QUARTERS' -* OR 'C_ICONSET_5RATING'. -* lv_needed_values = 5. -* -* WHEN OTHERS. -* RETURN. -* ENDCASE. - -ENDMETHOD. - - - - METHOD get_dimension_range. - - ep_dimension_range = me->mv_rule_range. - -ENDMETHOD. - - - - - - - METHOD set_range. - - CLEAR: me->mv_rule_range. - - me->add_range( ip_start_row = ip_start_row - ip_start_column = ip_start_column - ip_stop_row = ip_stop_row - ip_stop_column = ip_stop_column ). - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk deleted file mode 100644 index 5b65e3d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk +++ /dev/null @@ -1,170 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method build_gradient. - check check_filltype_is_gradient( ) eq abap_true. - clear gradtype. - case filltype. - when c_fill_gradient_horizontal90. - gradtype-degree = '90'. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_horizontal270. - gradtype-degree = '270'. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_horizontalb. - gradtype-degree = '90'. - gradtype-position1 = '0'. - gradtype-position2 = '0.5'. - gradtype-position3 = '1'. - when c_fill_gradient_vertical. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_fromcenter. - gradtype-type = c_fill_gradient_path. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - gradtype-bottom = '0.5'. - gradtype-top = '0.5'. - gradtype-left = '0.5'. - gradtype-right = '0.5'. - when c_fill_gradient_diagonal45. - gradtype-degree = '45'. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_diagonal45b. - gradtype-degree = '45'. - gradtype-position1 = '0'. - gradtype-position2 = '0.5'. - gradtype-position3 = '1'. - when c_fill_gradient_diagonal135. - gradtype-degree = '135'. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_diagonal135b. - gradtype-degree = '135'. - gradtype-position1 = '0'. - gradtype-position2 = '0.5'. - gradtype-position3 = '1'. - when c_fill_gradient_cornerlt. - gradtype-type = c_fill_gradient_path. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - when c_fill_gradient_cornerlb. - gradtype-type = c_fill_gradient_path. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - gradtype-bottom = '1'. - gradtype-top = '1'. - when c_fill_gradient_cornerrt. - gradtype-type = c_fill_gradient_path. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - gradtype-left = '1'. - gradtype-right = '1'. - when c_fill_gradient_cornerrb. - gradtype-type = c_fill_gradient_path. - gradtype-position1 = '0'. - gradtype-position2 = '1'. - gradtype-bottom = '0.5'. - gradtype-top = '0.5'. - gradtype-left = '0.5'. - gradtype-right = '0.5'. - endcase. - - endmethod. "build_gradient - - - - method check_filltype_is_gradient. - case filltype. - when c_fill_gradient_horizontal90 or - c_fill_gradient_horizontal270 or - c_fill_gradient_horizontalb or - c_fill_gradient_vertical or - c_fill_gradient_fromcenter or - c_fill_gradient_diagonal45 or - c_fill_gradient_diagonal45b or - c_fill_gradient_diagonal135 or - c_fill_gradient_diagonal135b or - c_fill_gradient_cornerlt or - c_fill_gradient_cornerlb or - c_fill_gradient_cornerrt or - c_fill_gradient_cornerrb. - rv_is_gradient = abap_true. - endcase. - endmethod. "check_filltype_is_gradient - - - method constructor. - filltype = zcl_excel_style_fill=>c_fill_none. - fgcolor-theme = zcl_excel_style_color=>c_theme_not_set. - fgcolor-indexed = zcl_excel_style_color=>c_indexed_not_set. - bgcolor-theme = zcl_excel_style_color=>c_theme_not_set. - bgcolor-indexed = zcl_excel_style_color=>c_indexed_sys_foreground. - rotation = 0. - - endmethod. "CONSTRUCTOR - - - - method get_structure. - es_fill-rotation = me->rotation. - es_fill-filltype = me->filltype. - es_fill-fgcolor = me->fgcolor. - es_fill-bgcolor = me->bgcolor. - me->build_gradient( ). - es_fill-gradtype = me->gradtype. - endmethod. "GET_STRUCTURE - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk deleted file mode 100644 index 127499f..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FONT.slnk +++ /dev/null @@ -1,78 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method CALCULATE_TEXT_WIDTH. - " Addition to solve issue #120, contribution by Stefan Schmoecker - r_width = strlen( i_text ). - " use scale factor based on default 11 - " ( don't know where defaultsetting is stored currently ) - r_width = r_width * me->size / 11. - endmethod. - - - method CONSTRUCTOR. - me->color-rgb = zcl_excel_style_color=>c_black. - me->color-theme = zcl_excel_style_color=>c_theme_not_set. - me->color-indexed = zcl_excel_style_color=>c_indexed_not_set. - me->scheme = zcl_excel_style_font=>c_scheme_minor. - me->underline_mode = zcl_excel_style_font=>c_underline_single. - endmethod. - - - - method GET_STRUCTURE. - - es_font-bold = me->bold. - es_font-italic = me->italic. - es_font-underline = me->underline. - es_font-underline_mode = me->underline_mode. - es_font-strikethrough = me->strikethrough. - es_font-size = me->size. - es_font-color = me->color. - es_font-name = me->name. - es_font-family = me->family. - es_font-scheme = me->scheme. - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk deleted file mode 100644 index db0ffa4..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_NUMBER_FORMAT.slnk +++ /dev/null @@ -1,146 +0,0 @@ - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - METHOD class_constructor. - - DATA: ls_num_format LIKE LINE OF mt_built_in_num_formats. - - DEFINE predefined_format. - ls_num_format-id = &1. - create object ls_num_format-format. - ls_num_format-format->format_code = &2. - insert ls_num_format into table mt_built_in_num_formats. - END-OF-DEFINITION. - - CLEAR mt_built_in_num_formats. - - predefined_format '1' zcl_excel_style_number_format=>c_format_number. " '0'. - predefined_format '2' zcl_excel_style_number_format=>c_format_number_00. " '0.00'. - predefined_format '3' zcl_excel_style_number_format=>c_format_number_comma_sep0. " '#,##0'. - predefined_format '4' zcl_excel_style_number_format=>c_format_number_comma_sep1. " '#,##0.00'. - predefined_format '5' zcl_excel_style_number_format=>c_format_currency_simple. " '$#,##0_);($#,##0)'. - predefined_format '6' zcl_excel_style_number_format=>c_format_currency_simple_red. " '$#,##0_);[Red]($#,##0)'. - predefined_format '7' zcl_excel_style_number_format=>c_format_currency_simple2. " '$#,##0.00_);($#,##0.00)'. - predefined_format '8' zcl_excel_style_number_format=>c_format_currency_simple_red2. " '$#,##0.00_);[Red]($#,##0.00)'. - predefined_format '9' zcl_excel_style_number_format=>c_format_percentage. " '0%'. - predefined_format '10' zcl_excel_style_number_format=>c_format_percentage_00. " '0.00%'. - predefined_format '11' zcl_excel_style_number_format=>c_format_scientific. " '0.00E+00'. - predefined_format '12' zcl_excel_style_number_format=>c_format_fraction_1. " '# ?/?'. - predefined_format '13' zcl_excel_style_number_format=>c_format_fraction_2. " '# ??/??'. - predefined_format '14' zcl_excel_style_number_format=>c_format_date_xlsx14. "'m/d/yyyy'. <-- should have been 'mm-dd-yy' like constant in zcl_excel_style_number_format - predefined_format '15' zcl_excel_style_number_format=>c_format_date_xlsx15. "'d-mmm-yy'. - predefined_format '16' zcl_excel_style_number_format=>c_format_date_xlsx16. "'d-mmm'. - predefined_format '17' zcl_excel_style_number_format=>c_format_date_xlsx17. "'mmm-yy'. - predefined_format '18' zcl_excel_style_number_format=>c_format_date_time1. " 'h:mm AM/PM'. - predefined_format '19' zcl_excel_style_number_format=>c_format_date_time2. " 'h:mm:ss AM/PM'. - predefined_format '20' zcl_excel_style_number_format=>c_format_date_time3. " 'h:mm'. - predefined_format '21' zcl_excel_style_number_format=>c_format_date_time4. " 'h:mm:ss'. - predefined_format '22' zcl_excel_style_number_format=>c_format_date_xlsx22. " 'm/d/yyyy h:mm'. - - - predefined_format '37' zcl_excel_style_number_format=>c_format_xlsx37. " '#,##0_);(#,##0)'. - predefined_format '38' zcl_excel_style_number_format=>c_format_xlsx38. " '#,##0_);[Red](#,##0)'. - predefined_format '39' zcl_excel_style_number_format=>c_format_xlsx39. " '#,##0.00_);(#,##0.00)'. - predefined_format '40' zcl_excel_style_number_format=>c_format_xlsx40. " '#,##0.00_);[Red](#,##0.00)'. - predefined_format '41' zcl_excel_style_number_format=>c_format_xlsx41. " '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'. - predefined_format '42' zcl_excel_style_number_format=>c_format_xlsx42. " '_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)'. - predefined_format '43' zcl_excel_style_number_format=>c_format_xlsx43. " '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'. - predefined_format '44' zcl_excel_style_number_format=>c_format_xlsx44. " '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'. - predefined_format '45' zcl_excel_style_number_format=>c_format_date_xlsx45. " 'mm:ss'. - predefined_format '46' zcl_excel_style_number_format=>c_format_date_xlsx46. " '[h]:mm:ss'. - predefined_format '47' zcl_excel_style_number_format=>c_format_date_xlsx47. " 'mm:ss.0'. - predefined_format '48' zcl_excel_style_number_format=>c_format_special_01. " '##0.0E+0'. - predefined_format '49' zcl_excel_style_number_format=>c_format_text. " '@'. - -ENDMETHOD. - - - method CONSTRUCTOR. - format_code = me->c_format_general. - endmethod. - - - - method GET_STRUCTURE. - ep_number_format-numfmt = me->format_code. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_PROTECTION.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_PROTECTION.slnk deleted file mode 100644 index d212b17..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_PROTECTION.slnk +++ /dev/null @@ -1,30 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - method CONSTRUCTOR. - locked = me->c_protection_locked. - hidden = me->c_protection_unhidden. - endmethod. - - - - method GET_STRUCTURE. - ep_protection-locked = me->locked. - ep_protection-hidden = me->hidden. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk deleted file mode 100644 index 2a65d6d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_TABLE.slnk +++ /dev/null @@ -1,271 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method GET_BOTTOM_ROW_INTEGER. - DATA: lv_table_lines TYPE i. - FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE. - - IF settings-bottom_right_row IS NOT INITIAL. -* ev_row = zcl_excel_common=>convert_column2int( settings-bottom_right_row ). " del issue #246 - ev_row = settings-bottom_right_row . " ins issue #246 - EXIT. - ENDIF. - - ASSIGN table_data->* TO <fs_table>. - DESCRIBE TABLE <fs_table> LINES lv_table_lines. - IF lv_table_lines = 0. - lv_table_lines = 1. "table needs at least 1 data row - ENDIF. - - ev_row = settings-top_left_row + lv_table_lines. - - IF me->has_totals( ) = abap_true." ???? AND ip_include_totals_row = abap_true. - ADD 1 TO ev_row. - ENDIF. - endmethod. - - - - method GET_ID. - ov_id = id. - endmethod. - - - - method GET_NAME. - - IF me->name IS INITIAL. - me->name = zcl_excel_common=>number_to_excel_string( ip_value = me->id ). - CONCATENATE 'table' me->name INTO me->name. - ENDIF. - - ov_name = me->name. - endmethod. - - - - - method GET_REFERENCE. - DATA: lv_column TYPE zexcel_cell_column, - lv_table_lines TYPE i, - lv_right_column TYPE zexcel_cell_column_alpha, - ls_field_catalog TYPE zexcel_s_fieldcatalog, - lv_bottom_row TYPE zexcel_cell_row, - lv_top_row_string(10) TYPE c, - lv_bottom_row_string(10) TYPE c. - - FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE. - -*column - lv_column = zcl_excel_common=>convert_column2int( settings-top_left_column ). - lv_table_lines = 0. - LOOP AT fieldcat INTO ls_field_catalog WHERE dynpfld EQ abap_true. - ADD 1 TO lv_table_lines. - ENDLOOP. - lv_column = lv_column + lv_table_lines - 1. - lv_right_column = zcl_excel_common=>convert_column2alpha( lv_column ). - -*row - ASSIGN table_data->* TO <fs_table>. - DESCRIBE TABLE <fs_table> LINES lv_table_lines. - IF lv_table_lines = 0. - lv_table_lines = 1. "table needs at least 1 data row - ENDIF. - lv_bottom_row = settings-top_left_row + lv_table_lines . - - IF me->has_totals( ) = abap_true AND ip_include_totals_row = abap_true. - ADD 1 TO lv_bottom_row. - ENDIF. - - lv_top_row_string = zcl_excel_common=>number_to_excel_string( settings-top_left_row ). - lv_bottom_row_string = zcl_excel_common=>number_to_excel_string( lv_bottom_row ). - - CONCATENATE settings-top_left_column lv_top_row_string - ':' - lv_right_column lv_bottom_row_string INTO ov_reference. - - endmethod. - - - - - method GET_RIGHT_COLUMN_INTEGER. - DATA: lv_column TYPE zexcel_cell_column, - lv_table_lines TYPE i, - ls_field_catalog TYPE zexcel_s_fieldcatalog. - - IF settings-bottom_right_column IS NOT INITIAL. - ev_column = zcl_excel_common=>convert_column2int( settings-bottom_right_column ). - EXIT. - ENDIF. - - ev_column = zcl_excel_common=>convert_column2int( settings-top_left_column ). - LOOP AT fieldcat INTO ls_field_catalog WHERE dynpfld EQ abap_true. - ADD 1 TO ev_column. - ENDLOOP. - - endmethod. - - - - - - method GET_TOTALS_FORMULA. - CONSTANTS: lc_function_id_sum TYPE string VALUE '109', - lc_function_id_min TYPE string VALUE '105', - lc_function_id_max TYPE string VALUE '104', - lc_function_id_count TYPE string VALUE '103', - lc_function_id_average TYPE string VALUE '101'. - - DATA: lv_function_id TYPE string. - - CASE ip_function. - WHEN zcl_excel_table=>totals_function_sum. - lv_function_id = lc_function_id_sum. - - WHEN zcl_excel_table=>totals_function_min. - lv_function_id = lc_function_id_min. - - WHEN zcl_excel_table=>totals_function_max. - lv_function_id = lc_function_id_max. - - WHEN zcl_excel_table=>totals_function_count. - lv_function_id = lc_function_id_count. - - WHEN zcl_excel_table=>totals_function_average. - lv_function_id = lc_function_id_average. - - WHEN zcl_excel_table=>totals_function_custom. " issue #292 - RETURN. - - WHEN OTHERS. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Invalid totals formula. See ZCL_ for possible values'. - ENDCASE. - - CONCATENATE 'SUBTOTAL(' lv_function_id ',[' ip_column '])' INTO ep_formula. - endmethod. - - - - method HAS_TOTALS. - DATA: ls_field_catalog TYPE zexcel_s_fieldcatalog. - - ep_result = abap_false. - - LOOP AT fieldcat INTO ls_field_catalog. - IF ls_field_catalog-totals_function IS NOT INITIAL. - ep_result = abap_true. - EXIT. - ENDIF. - ENDLOOP. - - endmethod. - - - - METHOD set_data. - - DATA lr_temp TYPE REF TO data. - - FIELD-SYMBOLS: <lt_table_temp> TYPE ANY TABLE, - <lt_table> TYPE ANY TABLE. - - GET REFERENCE OF ir_data INTO lr_temp. - ASSIGN lr_temp->* TO <lt_table_temp>. - CREATE DATA table_data LIKE <lt_table_temp>. - ASSIGN me->table_data->* TO <lt_table>. - <lt_table> = <lt_table_temp>. - -ENDMETHOD. - - - - method SET_ID. - id = iv_id. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME.slnk deleted file mode 100644 index 403c476..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME.slnk +++ /dev/null @@ -1,206 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - method constructor. - create object elements. - create object objectdefaults. - create object extclrschemelst. - create object extlst. - endmethod. "class_constructor - - - - method read_theme. - data: lo_node_theme type ref to if_ixml_element. - data: lo_theme_children type ref to if_ixml_node_list. - data: lo_theme_iterator type ref to if_ixml_node_iterator. - data: lo_theme_element type ref to if_ixml_element. - check io_theme_xml is not initial. - - lo_node_theme = io_theme_xml->get_root_element( )." find_from_name( name = c_theme ). - if lo_node_theme is bound. - name = lo_node_theme->get_attribute( name = c_theme_name ). - xmls_a = lo_node_theme->get_attribute( name = c_theme_xmlns ). - lo_theme_children = lo_node_theme->get_children( ). - lo_theme_iterator = lo_theme_children->create_iterator( ). - lo_theme_element ?= lo_theme_iterator->get_next( ). - while lo_theme_element is bound. - case lo_theme_element->get_name( ). - when c_theme_elements. - elements->load( io_elements = lo_theme_element ). - when c_theme_object_def. - objectdefaults->load( io_object_def = lo_theme_element ). - when c_theme_extra_color. - extclrschemelst->load( io_extra_color = lo_theme_element ). - when c_theme_extlst. - extlst->load( io_extlst = lo_theme_element ). - endcase. - lo_theme_element ?= lo_theme_iterator->get_next( ). - endwhile. - endif. - endmethod. "read_theme - - - - - - - method set_color. - elements->color_scheme->set_color( - exporting - iv_type = iv_type - iv_srgb = iv_srgb - iv_syscolorname = iv_syscolorname - iv_syscolorlast = iv_syscolorlast - ). - endmethod. "set_color - - - - method set_color_scheme_name. - elements->color_scheme->set_name( iv_name = iv_name ). - endmethod. "set_color_scheme_name - - - - - - - - method set_cs_font. - elements->font_scheme->modify_cs_font( - exporting - iv_type = iv_type - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "set_cs_font - - - - - - - - method set_ea_font. - elements->font_scheme->modify_ea_font( - exporting - iv_type = iv_type - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "set_ea_font - - - - - - method set_font. - elements->font_scheme->modify_font( - exporting - iv_type = iv_type - iv_script = iv_script - iv_typeface = iv_typeface - ). - endmethod. "set_font - - - - method set_font_scheme_name. - elements->font_scheme->set_name( iv_name = iv_name ). - endmethod. "set_font_scheme_name - - - - - - - - method set_latin_font. - elements->font_scheme->modify_latin_font( - exporting - iv_type = iv_type - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "set_latin_font - - - - method set_theme_name. - name = iv_name. - endmethod. - - - - method write_theme. - data: lo_ixml type ref to if_ixml, - lo_element_root type ref to if_ixml_element, - lo_encoding type ref to if_ixml_encoding. - data: lo_streamfactory TYPE REF TO if_ixml_stream_factory. - data: lo_ostream TYPE REF TO if_ixml_ostream. - data: lo_renderer TYPE REF TO if_ixml_renderer. - data: lo_document type ref to if_ixml_document. - lo_ixml = cl_ixml=>create( ). - - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'UTF-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - lo_document->set_namespace_prefix( prefix = 'a' ). - - lo_element_root = lo_document->create_simple_element_ns( prefix = c_theme_prefix - name = c_theme - parent = lo_document - ). - lo_element_root->set_attribute_ns( name = c_theme_xmlns - value = c_theme_xmlns_val ). - lo_element_root->set_attribute_ns( name = c_theme_name - value = name ). - - elements->build_xml( io_document = lo_document ). - objectdefaults->build_xml( io_document = lo_document ). - extclrschemelst->build_xml( io_document = lo_document ). - extlst->build_xml( io_document = lo_document ). - - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = rv_xstring ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. "write_theme - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_COLOR_SCHEME.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_COLOR_SCHEME.slnk deleted file mode 100644 index bda9a95..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_COLOR_SCHEME.slnk +++ /dev/null @@ -1,427 +0,0 @@ - - - - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method build_xml. - data: lo_scheme_element type ref to if_ixml_element. - data: lo_color type ref to if_ixml_element. - data: lo_syscolor type ref to if_ixml_element. - data: lo_srgb type ref to if_ixml_element. - data: lo_elements type ref to if_ixml_element. - - check io_document is bound. - lo_elements ?= io_document->find_from_name_ns( name = zcl_excel_theme=>c_theme_elements ). - if lo_elements is bound. - lo_scheme_element ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = zcl_excel_theme_elements=>c_color_scheme - parent = lo_elements ). - lo_scheme_element->set_attribute( name = c_name value = name ). - - "! Adding colors to scheme - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = c_dark1 - parent = lo_scheme_element ). - if lo_color is bound. - if dark1-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = dark1-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = dark1-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = dark1-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_light1 - parent = lo_scheme_element ). - if lo_color is bound. - if light1-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = light1-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = light1-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = light1-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_dark2 - parent = lo_scheme_element ). - if lo_color is bound. - if dark2-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = dark2-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = dark2-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = dark2-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_light2 - parent = lo_scheme_element ). - if lo_color is bound. - if light2-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = light2-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = light2-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = light2-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent1 - parent = lo_scheme_element ). - if lo_color is bound. - if accent1-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent1-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent1-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent1-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent2 - parent = lo_scheme_element ). - if lo_color is bound. - if accent2-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent2-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent2-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent2-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent3 - parent = lo_scheme_element ). - if lo_color is bound. - if accent3-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent3-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent3-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent3-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent4 - parent = lo_scheme_element ). - if lo_color is bound. - if accent4-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent4-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent4-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent4-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent5 - parent = lo_scheme_element ). - if lo_color is bound. - if accent5-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent5-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent5-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent5-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_accent6 - parent = lo_scheme_element ). - if lo_color is bound. - if accent6-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = accent6-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = accent6-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = accent6-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_hlink - parent = lo_scheme_element ). - if lo_color is bound. - if hlink-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = hlink-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = hlink-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = hlink-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - lo_color ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_folhlink - parent = lo_scheme_element ). - if lo_color is bound. - if folhlink-srgb is not initial. - lo_srgb ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_srgbcolor - parent = lo_color ). - lo_srgb->set_attribute( name = c_val value = folhlink-srgb ). - else. - lo_syscolor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_syscolor - parent = lo_color ). - lo_syscolor->set_attribute( name = c_val value = folhlink-syscolor-val ). - lo_syscolor->set_attribute( name = c_lastclr value = folhlink-syscolor-lastclr ). - endif. - clear: lo_color, lo_srgb, lo_syscolor. - endif. - - - endif. - endmethod. "build_xml - - - method constructor. - set_defaults( ). - endmethod. "constructor - - - - - method get_color. - data: lo_color_children type ref to if_ixml_node_list. - data: lo_color_iterator type ref to if_ixml_node_iterator. - data: lo_color_element type ref to if_ixml_element. - check io_object is not initial. - - lo_color_children = io_object->get_children( ). - lo_color_iterator = lo_color_children->create_iterator( ). - lo_color_element ?= lo_color_iterator->get_next( ). - if lo_color_element is bound. - case lo_color_element->get_name( ). - when c_srgbcolor. - rv_color-srgb = lo_color_element->get_attribute( name = c_val ). - when c_syscolor. - rv_color-syscolor-val = lo_color_element->get_attribute( name = c_val ). - rv_color-syscolor-lastclr = lo_color_element->get_attribute( name = c_lastclr ). - endcase. - endif. - endmethod. "get_color - - - - method load. - data: lo_scheme_children type ref to if_ixml_node_list. - data: lo_scheme_iterator type ref to if_ixml_node_iterator. - data: lo_scheme_element type ref to if_ixml_element. - check io_color_scheme is not initial. - - name = io_color_scheme->get_attribute( name = c_name ). - lo_scheme_children = io_color_scheme->get_children( ). - lo_scheme_iterator = lo_scheme_children->create_iterator( ). - lo_scheme_element ?= lo_scheme_iterator->get_next( ). - while lo_scheme_element is bound. - case lo_scheme_element->get_name( ). - when c_dark1. - dark1 = me->get_color( lo_scheme_element ). - when c_dark2. - dark2 = me->get_color( lo_scheme_element ). - when c_light1. - light1 = me->get_color( lo_scheme_element ). - when c_light2. - light2 = me->get_color( lo_scheme_element ). - when c_accent1. - accent1 = me->get_color( lo_scheme_element ). - when c_accent2. - accent2 = me->get_color( lo_scheme_element ). - when c_accent3. - accent3 = me->get_color( lo_scheme_element ). - when c_accent4. - accent4 = me->get_color( lo_scheme_element ). - when c_accent5. - accent5 = me->get_color( lo_scheme_element ). - when c_accent6. - accent6 = me->get_color( lo_scheme_element ). - when c_hlink. - hlink = me->get_color( lo_scheme_element ). - when c_folhlink. - folhlink = me->get_color( lo_scheme_element ). - endcase. - lo_scheme_element ?= lo_scheme_iterator->get_next( ). - endwhile. - endmethod. "load - - - - - - - method set_color. - field-symbols: <color> type t_color. - check iv_type is not initial. - check iv_srgb is not initial or iv_syscolorname is not initial. - case iv_type. - when c_dark1. - assign dark1 to <color>. - when c_dark2. - assign dark2 to <color>. - when c_light1. - assign light1 to <color>. - when c_light2. - assign light2 to <color>. - when c_accent1. - assign accent1 to <color>. - when c_accent2. - assign accent2 to <color>. - when c_accent3. - assign accent3 to <color>. - when c_accent4. - assign accent4 to <color>. - when c_accent5. - assign accent5 to <color>. - when c_accent6. - assign accent6 to <color>. - when c_hlink. - assign hlink to <color>. - when c_folhlink. - assign folhlink to <color>. - endcase. - check <color> is assigned. - clear <color>. - if iv_srgb is not initial. - <color>-srgb = iv_srgb. - else. - <color>-syscolor-val = iv_syscolorname. - if iv_syscolorlast is not initial. - <color>-syscolor-lastclr = iv_syscolorlast. - else. - <color>-syscolor-lastclr = '000000'. - endif. - endif. - endmethod. "set_color - - - method set_defaults. - name = 'Office'. - dark1-syscolor-val = 'windowText'. - dark1-syscolor-lastclr = '000000'. - light1-syscolor-val = 'window'. - light1-syscolor-lastclr = 'FFFFFF'. - dark2-srgb = '44546A'. - light2-srgb = 'E7E6E6'. - accent1-srgb = '5B9BD5'. - accent2-srgb = 'ED7D31'. - accent3-srgb = 'A5A5A5'. - accent4-srgb = 'FFC000'. - accent5-srgb = '4472C4'. - accent6-srgb = '70AD47'. - hlink-srgb = '0563C1'. - folhlink-srgb = '954F72'. - endmethod. "set_defaults - - - - method set_name. - if strlen( iv_name ) > 50. - name = iv_name(50). - else. - name = iv_name. - endif. - endmethod. "set_name - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_ECLRSCHEMELST.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_ECLRSCHEMELST.slnk deleted file mode 100644 index f186534..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_ECLRSCHEMELST.slnk +++ /dev/null @@ -1,40 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - method build_xml. - data: lo_theme_element type ref to if_ixml_element. - data: lo_theme type ref to if_ixml_element. - data: lo_theme_objdef type ref to if_ixml_element. - check io_document is bound. - lo_theme ?= io_document->get_root_element( ). - check lo_theme is bound. - if extracolor is initial. - lo_theme_objdef ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = zcl_excel_theme=>c_theme_extra_color - parent = lo_theme ). - - else. - lo_theme->append_child( new_child = extracolor ). - endif. - - endmethod. "build_xml - - - - method load. - "! so far copy only existing values - extracolor ?= io_extra_color. - endmethod. "load - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_ELEMENTS.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_ELEMENTS.slnk deleted file mode 100644 index 14e5aa6..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_ELEMENTS.slnk +++ /dev/null @@ -1,69 +0,0 @@ - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - - - - - - - method build_xml. - data: lo_theme_element type ref to if_ixml_element. - data: lo_theme type ref to if_ixml_element. - check io_document is bound. - lo_theme ?= io_document->get_root_element( ).. - if lo_theme is bound. - lo_theme_element ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = c_theme_elements - parent = lo_theme ). - - color_scheme->build_xml( io_document = io_document ). - font_scheme->build_xml( io_document = io_document ). - fmt_scheme->build_xml( io_document = io_document ). - endif. - endmethod. - - - method constructor. - create object color_scheme. - create object font_scheme. - create object fmt_scheme. - endmethod. "constructor - - - - method load. - data: lo_elements_children type ref to if_ixml_node_list. - data: lo_elements_iterator type ref to if_ixml_node_iterator. - data: lo_elements_element type ref to if_ixml_element. - check io_elements is not initial. - - lo_elements_children = io_elements->get_children( ). - lo_elements_iterator = lo_elements_children->create_iterator( ). - lo_elements_element ?= lo_elements_iterator->get_next( ). - while lo_elements_element is bound. - case lo_elements_element->get_name( ). - when c_color_scheme. - color_scheme->load( io_color_scheme = lo_elements_element ). - when c_font_scheme. - font_scheme->load( io_font_scheme = lo_elements_element ). - when c_fmt_scheme. - fmt_scheme->load( io_fmt_scheme = lo_elements_element ). - endcase. - lo_elements_element ?= lo_elements_iterator->get_next( ). - endwhile. - endmethod. "load - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_EXTLST.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_EXTLST.slnk deleted file mode 100644 index 0181bdb..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_EXTLST.slnk +++ /dev/null @@ -1,40 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - method build_xml. - data: lo_theme_element type ref to if_ixml_element. - data: lo_theme type ref to if_ixml_element. - data: lo_theme_objdef type ref to if_ixml_element. - check io_document is bound. - - lo_theme ?= io_document->get_root_element( ). - check lo_theme is bound. - if extlst is initial. - lo_theme_objdef ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = zcl_excel_theme=>c_theme_extlst - parent = lo_theme ). - - else. - lo_theme->append_child( new_child = extlst ). - endif. - endmethod. "build_xml - - - - method load. - "! so far copy only existing values - extlst ?= io_extlst. - endmethod. "load - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_FMT_SCHEME.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_FMT_SCHEME.slnk deleted file mode 100644 index 1d38194..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_FMT_SCHEME.slnk +++ /dev/null @@ -1,186 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - method build_xml. - data: lo_xml type ref to cl_xml_document. - data: lo_node type ref to if_ixml_node. - data: default_fmt_scheme type string. - data: lo_scheme_element type ref to if_ixml_element. - data: lo_elements type ref to if_ixml_element. - check io_document is bound. - lo_elements ?= io_document->find_from_name_ns( name = zcl_excel_theme=>c_theme_elements ). - if lo_elements is bound. - - if fmt_scheme is initial. - create object lo_xml. - lo_xml->parse_string( get_default_fmt( ) ). - lo_node = lo_xml->get_first_node( ). - lo_elements->append_child( new_child = lo_node ). - else. - lo_elements->append_child( new_child = fmt_scheme ). - endif. - endif. - endmethod. "build_xml - - - - method get_default_fmt. - concatenate '<a:fmtScheme name="Office">' - ' <a:fillStyleLst>' - ' <a:solidFill>' - ' <a:schemeClr val="phClr"/>' - ' </a:solidFill>' - ' <a:gradFill rotWithShape="1">' - ' <a:gsLst>' - ' <a:gs pos="0">' - ' <a:schemeClr val="phClr">' - ' <a:lumMod val="110000"/>' - ' <a:satMod val="105000"/>' - ' <a:tint val="67000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="50000">' - ' <a:schemeClr val="phClr">' - ' <a:lumMod val="105000"/>' - ' <a:satMod val="103000"/>' - ' <a:tint val="73000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="100000">' - ' <a:schemeClr val="phClr">' - ' <a:lumMod val="105000"/>' - ' <a:satMod val="109000"/>' - ' <a:tint val="81000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' </a:gsLst>' - ' <a:lin ang="5400000" scaled="0"/>' - ' </a:gradFill>' - ' <a:gradFill rotWithShape="1">' - ' <a:gsLst>' - ' <a:gs pos="0">' - ' <a:schemeClr val="phClr">' - ' <a:satMod val="103000"/>' - ' <a:lumMod val="102000"/>' - ' <a:tint val="94000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="50000">' - ' <a:schemeClr val="phClr">' - ' <a:satMod val="110000"/>' - ' <a:lumMod val="100000"/>' - ' <a:shade val="100000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="100000">' - ' <a:schemeClr val="phClr">' - ' <a:lumMod val="99000"/>' - ' <a:satMod val="120000"/>' - ' <a:shade val="78000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' </a:gsLst>' - ' <a:lin ang="5400000" scaled="0"/>' - ' </a:gradFill>' - ' </a:fillStyleLst>' - ' <a:lnStyleLst>' - ' <a:ln w="6350" cap="flat" cmpd="sng" algn="ctr">' - ' <a:solidFill>' - ' <a:schemeClr val="phClr"/>' - ' </a:solidFill>' - ' <a:prstDash val="solid"/>' - ' <a:miter lim="800000"/>' - ' </a:ln>' - ' <a:ln w="12700" cap="flat" cmpd="sng" algn="ctr">' - ' <a:solidFill>' - ' <a:schemeClr val="phClr"/>' - ' </a:solidFill>' - ' <a:prstDash val="solid"/>' - ' <a:miter lim="800000"/>' - ' </a:ln>' - ' <a:ln w="19050" cap="flat" cmpd="sng" algn="ctr">' - ' <a:solidFill>' - ' <a:schemeClr val="phClr"/>' - ' </a:solidFill>' - ' <a:prstDash val="solid"/>' - ' <a:miter lim="800000"/>' - ' </a:ln>' - ' </a:lnStyleLst>' - ' <a:effectStyleLst>' - ' <a:effectStyle>' - ' <a:effectLst/>' - ' </a:effectStyle>' - ' <a:effectStyle>' - ' <a:effectLst/>' - ' </a:effectStyle>' - ' <a:effectStyle>' - ' <a:effectLst>' - ' <a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0">' - ' <a:srgbClr val="000000">' - ' <a:alpha val="63000"/>' - ' </a:srgbClr>' - ' </a:outerShdw>' - ' </a:effectLst>' - ' </a:effectStyle>' - ' </a:effectStyleLst>' - ' <a:bgFillStyleLst>' - ' <a:solidFill>' - ' <a:schemeClr val="phClr"/>' - ' </a:solidFill>' - ' <a:solidFill>' - ' <a:schemeClr val="phClr">' - ' <a:tint val="95000"/>' - ' <a:satMod val="170000"/>' - ' </a:schemeClr>' - ' </a:solidFill>' - ' <a:gradFill rotWithShape="1">' - ' <a:gsLst>' - ' <a:gs pos="0">' - ' <a:schemeClr val="phClr">' - ' <a:tint val="93000"/>' - ' <a:satMod val="150000"/>' - ' <a:shade val="98000"/>' - ' <a:lumMod val="102000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="50000">' - ' <a:schemeClr val="phClr">' - ' <a:tint val="98000"/>' - ' <a:satMod val="130000"/>' - ' <a:shade val="90000"/>' - ' <a:lumMod val="103000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' <a:gs pos="100000">' - ' <a:schemeClr val="phClr">' - ' <a:shade val="63000"/>' - ' <a:satMod val="120000"/>' - ' </a:schemeClr>' - ' </a:gs>' - ' </a:gsLst>' - ' <a:lin ang="5400000" scaled="0"/>' - ' </a:gradFill>' - ' </a:bgFillStyleLst>' - ' </a:fmtScheme>' - into rv_string . - endmethod. "get_default_fmt - - - - method load. - "! so far copy only existing values - fmt_scheme ?= io_fmt_scheme. - endmethod. "load - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_FONT_SCHEME.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_FONT_SCHEME.slnk deleted file mode 100644 index f87d3fa..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_FONT_SCHEME.slnk +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - - - - - - - - - - - - - - method build_xml. - data: lo_scheme_element type ref to if_ixml_element. - data: lo_font type ref to if_ixml_element. - data: lo_latin type ref to if_ixml_element. - data: lo_ea type ref to if_ixml_element. - data: lo_cs type ref to if_ixml_element. - data: lo_major type ref to if_ixml_element. - data: lo_minor type ref to if_ixml_element. - data: lo_elements type ref to if_ixml_element. - field-symbols: <font> type t_font. - check io_document is bound. - lo_elements ?= io_document->find_from_name_ns( name = zcl_excel_theme=>c_theme_elements ). - if lo_elements is bound. - lo_scheme_element ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = zcl_excel_theme_elements=>c_font_scheme - parent = lo_elements ). - lo_scheme_element->set_attribute( name = c_name value = font_scheme-name ). - - lo_major ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_major - parent = lo_scheme_element ). - if lo_major is bound. - lo_latin ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_latin - parent = lo_major ). - lo_latin->set_attribute( name = c_typeface value = font_scheme-major-latin-typeface ). - if font_scheme-major-latin-panose is not initial. - lo_latin->set_attribute( name = c_panose value = font_scheme-major-latin-panose ). - endif. - if font_scheme-major-latin-pitchfamily is not initial. - lo_latin->set_attribute( name = c_pitchfamily value = font_scheme-major-latin-pitchfamily ). - endif. - if font_scheme-major-latin-charset is not initial. - lo_latin->set_attribute( name = c_charset value = font_scheme-major-latin-charset ). - endif. - - lo_ea ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_ea - parent = lo_major ). - lo_ea->set_attribute( name = c_typeface value = font_scheme-major-ea-typeface ). - if font_scheme-major-ea-panose is not initial. - lo_ea->set_attribute( name = c_panose value = font_scheme-major-ea-panose ). - endif. - if font_scheme-major-ea-pitchfamily is not initial. - lo_ea->set_attribute( name = c_pitchfamily value = font_scheme-major-ea-pitchfamily ). - endif. - if font_scheme-major-ea-charset is not initial. - lo_ea->set_attribute( name = c_charset value = font_scheme-major-ea-charset ). - endif. - - lo_cs ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_cs - parent = lo_major ). - lo_cs->set_attribute( name = c_typeface value = font_scheme-major-cs-typeface ). - if font_scheme-major-cs-panose is not initial. - lo_cs->set_attribute( name = c_panose value = font_scheme-major-cs-panose ). - endif. - if font_scheme-major-cs-pitchfamily is not initial. - lo_cs->set_attribute( name = c_pitchfamily value = font_scheme-major-cs-pitchfamily ). - endif. - if font_scheme-major-cs-charset is not initial. - lo_cs->set_attribute( name = c_charset value = font_scheme-major-cs-charset ). - endif. - - loop at font_scheme-major-fonts assigning <font>. - if <font>-script is not initial and <font>-typeface is not initial. - clear lo_font. - lo_font ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_font - parent = lo_major ). - lo_font->set_attribute( name = c_script value = <font>-script ). - lo_font->set_attribute( name = c_typeface value = <font>-typeface ). - endif. - endloop. - clear: lo_latin, lo_ea, lo_cs, lo_font. - endif. - - lo_minor ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_minor - parent = lo_scheme_element ). - if lo_minor is bound. - lo_latin ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_latin - parent = lo_minor ). - lo_latin->set_attribute( name = c_typeface value = font_scheme-minor-latin-typeface ). - if font_scheme-minor-latin-panose is not initial. - lo_latin->set_attribute( name = c_panose value = font_scheme-minor-latin-panose ). - endif. - if font_scheme-minor-latin-pitchfamily is not initial. - lo_latin->set_attribute( name = c_pitchfamily value = font_scheme-minor-latin-pitchfamily ). - endif. - if font_scheme-minor-latin-charset is not initial. - lo_latin->set_attribute( name = c_charset value = font_scheme-minor-latin-charset ). - endif. - - lo_ea ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_ea - parent = lo_minor ). - lo_ea->set_attribute( name = c_typeface value = font_scheme-minor-ea-typeface ). - if font_scheme-minor-ea-panose is not initial. - lo_ea->set_attribute( name = c_panose value = font_scheme-minor-ea-panose ). - endif. - if font_scheme-minor-ea-pitchfamily is not initial. - lo_ea->set_attribute( name = c_pitchfamily value = font_scheme-minor-ea-pitchfamily ). - endif. - if font_scheme-minor-ea-charset is not initial. - lo_ea->set_attribute( name = c_charset value = font_scheme-minor-ea-charset ). - endif. - - lo_cs ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_cs - parent = lo_minor ). - lo_cs->set_attribute( name = c_typeface value = font_scheme-minor-cs-typeface ). - if font_scheme-minor-cs-panose is not initial. - lo_cs->set_attribute( name = c_panose value = font_scheme-minor-cs-panose ). - endif. - if font_scheme-minor-cs-pitchfamily is not initial. - lo_cs->set_attribute( name = c_pitchfamily value = font_scheme-minor-cs-pitchfamily ). - endif. - if font_scheme-minor-cs-charset is not initial. - lo_cs->set_attribute( name = c_charset value = font_scheme-minor-cs-charset ). - endif. - - loop at font_scheme-minor-fonts assigning <font>. - if <font>-script is not initial and <font>-typeface is not initial. - clear lo_font. - lo_font ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix name = c_font - parent = lo_minor ). - lo_font->set_attribute( name = c_script value = <font>-script ). - lo_font->set_attribute( name = c_typeface value = <font>-typeface ). - endif. - endloop. - clear: lo_latin, lo_ea, lo_cs, lo_font. - endif. - - - endif. - endmethod. "build_xml - - - method constructor. - set_defaults( ). - endmethod. "constructor - - - - method load. - data: lo_scheme_children type ref to if_ixml_node_list. - data: lo_scheme_iterator type ref to if_ixml_node_iterator. - data: lo_scheme_element type ref to if_ixml_element. - data: lo_major_children type ref to if_ixml_node_list. - data: lo_major_iterator type ref to if_ixml_node_iterator. - data: lo_major_element type ref to if_ixml_element. - data: lo_minor_children type ref to if_ixml_node_list. - data: lo_minor_iterator type ref to if_ixml_node_iterator. - data: lo_minor_element type ref to if_ixml_element. - data: ls_font type t_font. - check io_font_scheme is not initial. - clear font_scheme. - font_scheme-name = io_font_scheme->get_attribute( name = c_name ). - lo_scheme_children = io_font_scheme->get_children( ). - lo_scheme_iterator = lo_scheme_children->create_iterator( ). - lo_scheme_element ?= lo_scheme_iterator->get_next( ). - while lo_scheme_element is bound. - case lo_scheme_element->get_name( ). - when c_major. - lo_major_children = lo_scheme_element->get_children( ). - lo_major_iterator = lo_major_children->create_iterator( ). - lo_major_element ?= lo_major_iterator->get_next( ). - while lo_major_element is bound. - case lo_major_element->get_name( ). - when c_latin. - font_scheme-major-latin-typeface = lo_major_element->get_attribute( name = c_typeface ). - font_scheme-major-latin-panose = lo_major_element->get_attribute( name = c_panose ). - font_scheme-major-latin-pitchfamily = lo_major_element->get_attribute( name = c_pitchfamily ). - font_scheme-major-latin-charset = lo_major_element->get_attribute( name = c_charset ). - when c_ea. - font_scheme-major-ea-typeface = lo_major_element->get_attribute( name = c_typeface ). - font_scheme-major-ea-panose = lo_major_element->get_attribute( name = c_panose ). - font_scheme-major-ea-pitchfamily = lo_major_element->get_attribute( name = c_pitchfamily ). - font_scheme-major-ea-charset = lo_major_element->get_attribute( name = c_charset ). - when c_cs. - font_scheme-major-cs-typeface = lo_major_element->get_attribute( name = c_typeface ). - font_scheme-major-cs-panose = lo_major_element->get_attribute( name = c_panose ). - font_scheme-major-cs-pitchfamily = lo_major_element->get_attribute( name = c_pitchfamily ). - font_scheme-major-cs-charset = lo_major_element->get_attribute( name = c_charset ). - when c_font. - clear ls_font. - ls_font-script = lo_major_element->get_attribute( name = c_script ). - ls_font-typeface = lo_major_element->get_attribute( name = c_typeface ). - try. - insert ls_font into table font_scheme-major-fonts. - catch cx_root. "not the best but just to avoid duplicate lines dump - - endtry. - endcase. - lo_major_element ?= lo_major_iterator->get_next( ). - endwhile. - when c_minor. - lo_minor_children = lo_scheme_element->get_children( ). - lo_minor_iterator = lo_minor_children->create_iterator( ). - lo_minor_element ?= lo_minor_iterator->get_next( ). - while lo_minor_element is bound. - case lo_minor_element->get_name( ). - when c_latin. - font_scheme-minor-latin-typeface = lo_minor_element->get_attribute( name = c_typeface ). - font_scheme-minor-latin-panose = lo_minor_element->get_attribute( name = c_panose ). - font_scheme-minor-latin-pitchfamily = lo_minor_element->get_attribute( name = c_pitchfamily ). - font_scheme-minor-latin-charset = lo_minor_element->get_attribute( name = c_charset ). - when c_ea. - font_scheme-minor-ea-typeface = lo_minor_element->get_attribute( name = c_typeface ). - font_scheme-minor-ea-panose = lo_minor_element->get_attribute( name = c_panose ). - font_scheme-minor-ea-pitchfamily = lo_minor_element->get_attribute( name = c_pitchfamily ). - font_scheme-minor-ea-charset = lo_minor_element->get_attribute( name = c_charset ). - when c_cs. - font_scheme-minor-cs-typeface = lo_minor_element->get_attribute( name = c_typeface ). - font_scheme-minor-cs-panose = lo_minor_element->get_attribute( name = c_panose ). - font_scheme-minor-cs-pitchfamily = lo_minor_element->get_attribute( name = c_pitchfamily ). - font_scheme-minor-cs-charset = lo_minor_element->get_attribute( name = c_charset ). - when c_font. - clear ls_font. - ls_font-script = lo_minor_element->get_attribute( name = c_script ). - ls_font-typeface = lo_minor_element->get_attribute( name = c_typeface ). - try. - insert ls_font into table font_scheme-minor-fonts. - catch cx_root. "not the best but just to avoid duplicate lines dump - - endtry. - endcase. - lo_minor_element ?= lo_minor_iterator->get_next( ). - endwhile. - endcase. - lo_scheme_element ?= lo_scheme_iterator->get_next( ). - endwhile. - endmethod. "load - - - - - - - - method modify_cs_font. - modify_lec_fonts( - exporting - iv_type = iv_type - iv_font_type = c_cs - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "modify_latin_font - - - - - - - - method modify_ea_font. - modify_lec_fonts( - exporting - iv_type = iv_type - iv_font_type = c_ea - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "modify_latin_font - - - - - - method modify_font. - data: ls_font type t_font. - field-symbols: <font> type t_font. - ls_font-script = iv_script. - ls_font-typeface = iv_typeface. - try. - case iv_type. - when c_major. - read table font_scheme-major-fonts with key script = iv_script assigning <font>. - if sy-subrc eq 0. - <font> = ls_font. - else. - insert ls_font into table font_scheme-major-fonts. - endif. - when c_minor. - read table font_scheme-minor-fonts with key script = iv_script assigning <font>. - if sy-subrc eq 0. - <font> = ls_font. - else. - insert ls_font into table font_scheme-minor-fonts. - endif. - endcase. - catch cx_root. "not the best but just to avoid duplicate lines dump - endtry. - endmethod. "add_font - - - - - - - - method modify_latin_font. - modify_lec_fonts( - exporting - iv_type = iv_type - iv_font_type = c_latin - iv_typeface = iv_typeface - iv_panose = iv_panose - iv_pitchfamily = iv_pitchfamily - iv_charset = iv_charset - ). - endmethod. "modify_latin_font - - - - - - - - - method modify_lec_fonts. - field-symbols: <type> type t_fonts, - <font> type t_fonttype. - case iv_type. - when c_minor. - assign font_scheme-minor to <type>. - when c_major. - assign font_scheme-major to <type>. - when others. - return. - endcase. - check <type> is assigned. - case iv_font_type. - when c_latin. - assign <type>-latin to <font>. - when c_ea. - assign <type>-ea to <font>. - when c_cs. - assign <type>-cs to <font>. - when others. - return. - endcase. - check <font> is assigned. - <font>-typeface = iv_typeface. - <font>-panose = iv_panose. - <font>-pitchfamily = iv_pitchfamily. - <font>-charset = iv_charset. - endmethod. "modify_lec_fonts - - - method set_defaults. - clear font_scheme. - font_scheme-name = 'Office'. - font_scheme-major-latin-typeface = 'Calibri Light'. - font_scheme-major-latin-panose = '020F0302020204030204'. - modify_font( iv_type = c_major iv_script = 'Jpan' iv_typeface = 'MS Pゴシック' ). - modify_font( iv_type = c_major iv_script = 'Hang' iv_typeface = '맑은 고딕' ). - modify_font( iv_type = c_major iv_script = 'Hans' iv_typeface = '宋体' ). - modify_font( iv_type = c_major iv_script = 'Hant' iv_typeface = '新細明體' ). - modify_font( iv_type = c_major iv_script = 'Arab' iv_typeface = 'Times New Roman' ). - modify_font( iv_type = c_major iv_script = 'Hebr' iv_typeface = 'Times New Roman' ). - modify_font( iv_type = c_major iv_script = 'Thai' iv_typeface = 'Tahoma' ). - modify_font( iv_type = c_major iv_script = 'Ethi' iv_typeface = 'Nyala' ). - modify_font( iv_type = c_major iv_script = 'Beng' iv_typeface = 'Vrinda' ). - modify_font( iv_type = c_major iv_script = 'Gujr' iv_typeface = 'Shruti' ). - modify_font( iv_type = c_major iv_script = 'Khmr' iv_typeface = 'MoolBoran' ). - modify_font( iv_type = c_major iv_script = 'Knda' iv_typeface = 'Tunga' ). - modify_font( iv_type = c_major iv_script = 'Guru' iv_typeface = 'Raavi' ). - modify_font( iv_type = c_major iv_script = 'Cans' iv_typeface = 'Euphemia' ). - modify_font( iv_type = c_major iv_script = 'Cher' iv_typeface = 'Plantagenet Cherokee' ). - modify_font( iv_type = c_major iv_script = 'Yiii' iv_typeface = 'Microsoft Yi Baiti' ). - modify_font( iv_type = c_major iv_script = 'Tibt' iv_typeface = 'Microsoft Himalaya' ). - modify_font( iv_type = c_major iv_script = 'Thaa' iv_typeface = 'MV Boli' ). - modify_font( iv_type = c_major iv_script = 'Deva' iv_typeface = 'Mangal' ). - modify_font( iv_type = c_major iv_script = 'Telu' iv_typeface = 'Gautami' ). - modify_font( iv_type = c_major iv_script = 'Taml' iv_typeface = 'Latha' ). - modify_font( iv_type = c_major iv_script = 'Syrc' iv_typeface = 'Estrangelo Edessa' ). - modify_font( iv_type = c_major iv_script = 'Orya' iv_typeface = 'Kalinga' ). - modify_font( iv_type = c_major iv_script = 'Mlym' iv_typeface = 'Kartika' ). - modify_font( iv_type = c_major iv_script = 'Laoo' iv_typeface = 'DokChampa' ). - modify_font( iv_type = c_major iv_script = 'Sinh' iv_typeface = 'Iskoola Pota' ). - modify_font( iv_type = c_major iv_script = 'Mong' iv_typeface = 'Mongolian Baiti' ). - modify_font( iv_type = c_major iv_script = 'Viet' iv_typeface = 'Times New Roman' ). - modify_font( iv_type = c_major iv_script = 'Uigh' iv_typeface = 'Microsoft Uighur' ). - modify_font( iv_type = c_major iv_script = 'Geor' iv_typeface = 'Sylfaen' ). - - font_scheme-minor-latin-typeface = 'Calibri'. - font_scheme-minor-latin-panose = '020F0502020204030204'. - modify_font( iv_type = c_minor iv_script = 'Jpan' iv_typeface = 'MS Pゴシック' ). - modify_font( iv_type = c_minor iv_script = 'Hang' iv_typeface = '맑은 고딕' ). - modify_font( iv_type = c_minor iv_script = 'Hans' iv_typeface = '宋体' ). - modify_font( iv_type = c_minor iv_script = 'Hant' iv_typeface = '新細明體' ). - modify_font( iv_type = c_minor iv_script = 'Arab' iv_typeface = 'Arial' ). - modify_font( iv_type = c_minor iv_script = 'Hebr' iv_typeface = 'Arial' ). - modify_font( iv_type = c_minor iv_script = 'Thai' iv_typeface = 'Tahoma' ). - modify_font( iv_type = c_minor iv_script = 'Ethi' iv_typeface = 'Nyala' ). - modify_font( iv_type = c_minor iv_script = 'Beng' iv_typeface = 'Vrinda' ). - modify_font( iv_type = c_minor iv_script = 'Gujr' iv_typeface = 'Shruti' ). - modify_font( iv_type = c_minor iv_script = 'Khmr' iv_typeface = 'DaunPenh' ). - modify_font( iv_type = c_minor iv_script = 'Knda' iv_typeface = 'Tunga' ). - modify_font( iv_type = c_minor iv_script = 'Guru' iv_typeface = 'Raavi' ). - modify_font( iv_type = c_minor iv_script = 'Cans' iv_typeface = 'Euphemia' ). - modify_font( iv_type = c_minor iv_script = 'Cher' iv_typeface = 'Plantagenet Cherokee' ). - modify_font( iv_type = c_minor iv_script = 'Yiii' iv_typeface = 'Microsoft Yi Baiti' ). - modify_font( iv_type = c_minor iv_script = 'Tibt' iv_typeface = 'Microsoft Himalaya' ). - modify_font( iv_type = c_minor iv_script = 'Thaa' iv_typeface = 'MV Boli' ). - modify_font( iv_type = c_minor iv_script = 'Deva' iv_typeface = 'Mangal' ). - modify_font( iv_type = c_minor iv_script = 'Telu' iv_typeface = 'Gautami' ). - modify_font( iv_type = c_minor iv_script = 'Taml' iv_typeface = 'Latha' ). - modify_font( iv_type = c_minor iv_script = 'Syrc' iv_typeface = 'Estrangelo Edessa' ). - modify_font( iv_type = c_minor iv_script = 'Orya' iv_typeface = 'Kalinga' ). - modify_font( iv_type = c_minor iv_script = 'Mlym' iv_typeface = 'Kartika' ). - modify_font( iv_type = c_minor iv_script = 'Laoo' iv_typeface = 'DokChampa' ). - modify_font( iv_type = c_minor iv_script = 'Sinh' iv_typeface = 'Iskoola Pota' ). - modify_font( iv_type = c_minor iv_script = 'Mong' iv_typeface = 'Mongolian Baiti' ). - modify_font( iv_type = c_minor iv_script = 'Viet' iv_typeface = 'Arial' ). - modify_font( iv_type = c_minor iv_script = 'Uigh' iv_typeface = 'Microsoft Uighur' ). - modify_font( iv_type = c_minor iv_script = 'Geor' iv_typeface = 'Sylfaen' ). - - endmethod. "set_defaults - - - - method set_name. - font_scheme-name = iv_name. - endmethod. "set_name - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_THEME_OBJECTDEFAULTS.slnk b/ZA2X/CLAS/ZCL_EXCEL_THEME_OBJECTDEFAULTS.slnk deleted file mode 100644 index b3f2a9f..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_THEME_OBJECTDEFAULTS.slnk +++ /dev/null @@ -1,38 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - *"* use this source file for your ABAP unit test classes - - - - method build_xml. - data: lo_theme_element type ref to if_ixml_element. - data: lo_theme type ref to if_ixml_element. - data: lo_theme_objdef type ref to if_ixml_element. - check io_document is bound. - lo_theme ?= io_document->get_root_element( ). - check lo_theme is bound. - if objectdefaults is initial. - lo_theme_objdef ?= io_document->create_simple_element_ns( prefix = zcl_excel_theme=>c_theme_prefix - name = zcl_excel_theme=>c_theme_object_def - parent = lo_theme ). - else. - lo_theme->append_child( new_child = objectdefaults ). - endif. - endmethod. "build_xml - - - - method load. - "! so far copy only existing values - objectdefaults ?= io_object_def. - endmethod. "load - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk deleted file mode 100644 index 5cdad1d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ /dev/null @@ -1,5234 +0,0 @@ - - - - - - - - - - - - - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - -*&---------------------------------------------------------------------* -*& Class (Implementation) C_OI_PROXY_ERROR -*&---------------------------------------------------------------------* -CLASS c_oi_proxy_error IMPLEMENTATION. - METHOD constructor. -* IMPORTING object_name TYPE c -* method_name TYPE c. - error_nr = ret_call_not_flushed. - me->i_oi_error~error_code = c_oi_errors=>ret_call_not_flushed. - me->i_oi_error~is_flushed = ' '. - me->i_oi_error~has_failed = 'X'. - me->i_oi_error~has_succeeded = ' '. - me->message_id = 'SOFFICEINTEGRATION'. - me->message_nr = '899'. - me->param1 = object_name. - me->param2 = method_name. - ENDMETHOD. "constructor - - METHOD i_oi_error~flush_error. - IF error_nr EQ 0. - me->i_oi_error~error_code = c_oi_errors=>ret_ok. - me->i_oi_error~is_flushed = 'X'. - me->i_oi_error~has_failed = ' '. - me->i_oi_error~has_succeeded = 'X'. - me->message_id = ''. - me->message_nr = '000'. - CALL METHOD c_oi_errors=>translate_proxy_error_code - EXPORTING - errorcode = error_nr - IMPORTING - retcode = me->i_oi_error~error_code. - ELSEIF error_nr EQ ret_call_not_flushed. - "call still not flushed - CALL METHOD c_oi_errors=>translate_proxy_error_code - EXPORTING - errorcode = error_nr - errorstring = me->param2 "method name - objectname = me->param1 - IMPORTING - retcode = me->i_oi_error~error_code. - ELSE. - me->i_oi_error~is_flushed = 'X'. - me->i_oi_error~has_succeeded = ' '. - me->i_oi_error~has_failed = 'X'. - CALL METHOD c_oi_errors=>translate_proxy_error_code - EXPORTING - errorcode = error_nr - errorstring = error_string - IMPORTING - retcode = me->i_oi_error~error_code. - CALL METHOD c_oi_errors=>get_message - IMPORTING - message_id = me->message_id - message_number = me->message_nr - param1 = me->param1 - param2 = me->param2 - param3 = me->param3 - param4 = me->param4. - ENDIF. - ENDMETHOD. "i_oi_error~flush_error - - METHOD i_oi_error~raise_message. -* IMPORTING type TYPE c. -* EXCEPTIONS message_raised flush_failed. - IF me->i_oi_error~has_succeeded IS INITIAL. - IF NOT me->i_oi_error~is_flushed IS INITIAL. - MESSAGE ID message_id TYPE type - NUMBER message_nr WITH param1 param2 param3 param4 - RAISING message_raised. - ELSE. - RAISE flush_failed. - ENDIF. - ENDIF. - ENDMETHOD. "i_oi_error~raise_message - - METHOD i_oi_error~get_message. -* EXPORTING message_id TYPE c -* message_number TYPE c -* param1 TYPE c -* param2 TYPE c -* param3 TYPE c -* param4 TYPE c. - param1 = me->param1. param2 = me->param2. - param3 = me->param3. param4 = me->param4. - - message_id = me->message_id. - message_number = me->message_nr. - ENDMETHOD. "i_oi_error~get_message -ENDCLASS. "C_OI_PROXY_ERROR - -*&---------------------------------------------------------------------* -*& Class (Implementation) CL_GRID_ACCESSION -*&---------------------------------------------------------------------* -CLASS lcl_gui_alv_grid IMPLEMENTATION. - - METHOD get_alv_attributes. - CREATE DATA et_table LIKE io_grid->mt_outtab. - et_table = io_grid->mt_outtab. - ENDMETHOD. "get_data - -ENDCLASS. "CL_GRID_ACCESSION - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature -TYPE-POOLS: sydes. -TYPE-POOLS: slis. -*--------------------------------------------------------------------* -* CLASS c_oi_proxy_error -*--------------------------------------------------------------------* -* use for method bind_ALV -*--------------------------------------------------------------------* -CLASS c_oi_proxy_error DEFINITION. - PUBLIC SECTION. - INTERFACES: i_oi_error. - DATA: error_nr TYPE i. - DATA: error_string TYPE sy-msgv1. - - METHODS: constructor IMPORTING object_name TYPE c - method_name TYPE c. - PRIVATE SECTION. - CONSTANTS: - ret_call_not_flushed TYPE i VALUE -999999. - - DATA: message_id TYPE sy-msgid, - message_nr TYPE sy-msgno, - param1 TYPE sy-msgv1, - param2 TYPE sy-msgv2, - param3 TYPE sy-msgv3, - param4 TYPE sy-msgv4. -ENDCLASS. "c_oi_proxy_error DEFINITION - -*--------------------------------------------------------------------* -* CLASS lcl_gui_alv_grid -*--------------------------------------------------------------------* -* to get protected attribute and method of cl_gui_alv_grid -* use for method bind_ALV -*--------------------------------------------------------------------* -CLASS lcl_gui_alv_grid DEFINITION INHERITING FROM cl_gui_alv_grid. - - PUBLIC SECTION. -* get ALV grid data - METHODS: get_alv_attributes - IMPORTING - io_grid TYPE REF TO cl_gui_alv_grid " ALV grid - EXPORTING - et_table TYPE REF TO data. " dta table - -ENDCLASS. "lcl_gui_alv_grid DEFINITION - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ABAP - SLIS - SOI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_COLUMNS. - -*--------------------------------------------------------------------* -* adjust internal representation -*--------------------------------------------------------------------* - CLEAR: me->print_title_col_from, - me->print_title_col_to . - - -*--------------------------------------------------------------------* -* adjust corresponding range -*--------------------------------------------------------------------* - me->print_title_set_range( ). - - - endmethod. - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_ROWS. - -*--------------------------------------------------------------------* -* adjust internal representation -*--------------------------------------------------------------------* - CLEAR: me->print_title_row_from, - me->print_title_row_to . - - -*--------------------------------------------------------------------* -* adjust corresponding range -*--------------------------------------------------------------------* - me->print_title_set_range( ). - - - endmethod. - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_COLUMNS. - ev_columns_from = me->print_title_col_from. - ev_columns_to = me->print_title_col_to. - endmethod. - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_ROWS. - ev_rows_from = me->print_title_row_from. - ev_rows_to = me->print_title_row_to. - endmethod. - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_COLUMNS. -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns -* - Stefan Schmöcker, 2012-12-02 -*--------------------------------------------------------------------* - - DATA: lv_col_from_int TYPE i, - lv_col_to_int TYPE i, - lv_errormessage TYPE string. - - DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator, - lo_range TYPE REF TO zcl_excel_range. - - - lv_col_from_int = zcl_excel_common=>convert_column2int( iv_columns_from ). - lv_col_to_int = zcl_excel_common=>convert_column2int( iv_columns_to ). - -*--------------------------------------------------------------------* -* Check if valid range is supplied -*--------------------------------------------------------------------* - IF lv_col_from_int < 1. - lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - IF lv_col_from_int > lv_col_to_int. - lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* adjust internal representation -*--------------------------------------------------------------------* - me->print_title_col_from = iv_columns_from. - me->print_title_col_to = iv_columns_to. - - -*--------------------------------------------------------------------* -* adjust corresponding range -*--------------------------------------------------------------------* - me->print_title_set_range( ). - - endmethod. - - - method ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_ROWS. -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns -* - Stefan Schmöcker, 2012-12-02 -*--------------------------------------------------------------------* - - DATA: lv_errormessage TYPE string. - - DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator, - lo_range TYPE REF TO zcl_excel_range. - - - -*--------------------------------------------------------------------* -* Check if valid range is supplied -*--------------------------------------------------------------------* - IF iv_rows_from < 1. - lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - IF iv_rows_from > iv_rows_to. - lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* adjust internal representation -*--------------------------------------------------------------------* - me->print_title_row_from = iv_rows_from. - me->print_title_row_to = iv_rows_to. - - -*--------------------------------------------------------------------* -* adjust corresponding range -*--------------------------------------------------------------------* - me->print_title_set_range( ). - - - endmethod. - - - method ZIF_EXCEL_SHEET_PROPERTIES~GET_STYLE. - IF zif_excel_sheet_properties~style IS NOT INITIAL. - ep_style = zif_excel_sheet_properties~style. - ELSE. - ep_style = me->excel->get_default_style( ). - ENDIF. - endmethod. - - - method ZIF_EXCEL_SHEET_PROPERTIES~INITIALIZE. - - zif_excel_sheet_properties~show_zeros = zif_excel_sheet_properties=>c_showzero. - zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_on. - zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_on. - -* inizialize zoomscale values - ZIF_EXCEL_SHEET_PROPERTIES~zoomscale = 100. - ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_normal = 100. - ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_pagelayoutview = 100 . - ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_sheetlayoutview = 100 . - endmethod. - - - method ZIF_EXCEL_SHEET_PROPERTIES~SET_STYLE. - zif_excel_sheet_properties~style = ip_style. - endmethod. - - - method ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE. - - me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected. - CLEAR me->zif_excel_sheet_protection~password. - me->zif_excel_sheet_protection~auto_filter = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~delete_columns = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~delete_rows = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~format_cells = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~format_columns = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~format_rows = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~insert_columns = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~insert_hyperlinks = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~insert_rows = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_noactive. -* me->zif_excel_sheet_protection~password = zif_excel_sheet_protection=>c_noactive. "issue #68 - me->zif_excel_sheet_protection~pivot_tables = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~select_locked_cells = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~select_unlocked_cells = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive. - me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive. - - endmethod. - - - method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME. - me->zif_excel_sheet_vba_project~codename = ip_codename. - endmethod. - - - method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR. - me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr. - endmethod. - - - - method ADD_DRAWING. - CASE ip_drawing->get_type( ). - WHEN zcl_excel_drawing=>type_image. - drawings->include( ip_drawing ). - WHEN zcl_excel_drawing=>type_chart. - charts->include( ip_drawing ). - ENDCASE. - endmethod. - - - - method ADD_NEW_CONDITIONAL_STYLE. - - CREATE OBJECT eo_conditional_style. - conditional_styles->add( eo_conditional_style ). - endmethod. - - - - method ADD_NEW_DATA_VALIDATION. - - CREATE OBJECT eo_data_validation. - data_validations->add( eo_data_validation ). - endmethod. - - - - method ADD_NEW_RANGE. -* Create default blank range - CREATE OBJECT eo_range. - ranges->add( eo_range ). - endmethod. - - - - - - - - - - method BIND_ALV. - data: lo_converter type ref to zcl_excel_converter. - - create object lo_converter. - - try. - lo_converter->convert( - exporting - io_alv = io_alv - it_table = it_table - i_row_int = i_top - i_column_int = i_left - i_table = i_table - i_style_table = table_style - io_worksheet = me - changing - co_excel = excel ). - catch zcx_excel . - endtry. - - endmethod. - - - - - - - - - - - - - - - - - - - - - - method BIND_ALV_OLE2. -*--------------------------------------------------------------------* -* Method description: -* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file -* with list header and characteristics of ALV field catalog such as: -* + Total, group's subtotal -* + Quantity fields, amount fields (dependent fields) -* + No_out, no_zero, ... -* Technique use in method: -* SAP Desktop Office Integration (DOI) -*--------------------------------------------------------------------* - -* Data for session 0: DOI constructor -* ------------------------------------------ - - data: lo_control type ref to I_OI_CONTAINER_CONTROL. - data: lo_proxy type ref to I_OI_DOCUMENT_PROXY. - data: lo_spreadsheet type ref to I_OI_SPREADSHEET. - data: lo_error type ref to I_OI_ERROR. - data: lc_retcode type SOI_RET_STRING. - data: li_has type i. "Proxy has spreadsheet interface? - data: l_is_closed type i. - -* Data for session 1: Get LVC data from ALV object -* ------------------------------------------ - - data: l_has_activex, - l_doctype_excel_sheet(11) type c. - data: wa_DOC_HANDLE Type CNTL_HANDLE. - -* LVC - data: lt_fieldcat_lvc type LVC_T_FCAT. - data: wa_fieldcat_lvc type lvc_s_fcat. - data: lt_sort_lvc type LVC_T_SORT. - data: lt_filter_idx_lvc type LVC_T_FIDX. - data: lt_GROUPLEVELS_LVC type LVC_T_GRPL. - -* KKBLO - DATA: LT_FIELDCAT_KKBLO Type KKBLO_T_FIELDCAT. - DATA: LT_SORT_KKBLO Type KKBLO_T_SORTINFO. - DATA: LT_GROUPLEVELS_KKBLO Type KKBLO_T_GROUPLEVELS. - DATA: LT_FILTER_IDX_KKBLO Type KKBLO_T_SFINFO. - data: wa_listheader like line of it_listheader. - -* Subtotal - data: lt_collect00 type ref to data. - data: lt_collect01 type ref to data. - data: lt_collect02 type ref to data. - data: lt_collect03 type ref to data. - data: lt_collect04 type ref to data. - data: lt_collect05 type ref to data. - data: lt_collect06 type ref to data. - data: lt_collect07 type ref to data. - data: lt_collect08 type ref to data. - data: lt_collect09 type ref to data. - -* data table name - data: l_tabname type kkblo_tabname. - -* local object - data: lo_grid type ref to lcl_gui_alv_grid. - -* data table get from ALV - data: lt_alv type ref to data. - -* total / subtotal data - field-symbols: <f_collect00> type standard table. - field-symbols: <f_collect01> type standard table. - field-symbols: <f_collect02> type standard table. - field-symbols: <f_collect03> type standard table. - field-symbols: <f_collect04> type standard table. - field-symbols: <f_collect05> type standard table. - field-symbols: <f_collect06> type standard table. - field-symbols: <f_collect07> type standard table. - field-symbols: <f_collect08> type standard table. - field-symbols: <f_collect09> type standard table. - -* table before append subtotal lines - field-symbols: <f_alv_tab> type standard table. - -* data for session 2: sort, filter and calculate total/subtotal -* ------------------------------------------ - -* table to save index of subotal / total line in excel tanle -* this ideal to control index of subtotal / total line later -* for ex, when get subtotal / total line to format - types: begin of st_subtot_indexs, - index type i, - end of st_subtot_indexs. - data: lt_subtot_indexs type table of st_subtot_indexs. - data: wa_subtot_indexs like line of lt_subtot_indexs. - -* data table after append subtotal - data: lt_excel type ref to data. - - data: l_tabix type i. - data: l_save_index type i. - -* dyn subtotal table name - data: l_collect type string. - -* subtotal range, to format subtotal (and total) - data: subranges type soi_range_list. - data: subrangeitem type soi_range_item. - data: l_sub_index type i. - - -* table after append subtotal lines - field-symbols: <f_excel_tab> type standard table. - field-symbols: <f_excel_line> type any. - -* dyn subtotal tables - field-symbols: <f_collect_tab> type standard table. - field-symbols: <f_collect_line> type any. - - field-symbols: <f_filter_idx_line> like line of LT_FILTER_IDX_KKBLO. - field-symbols: <f_fieldcat_line> like line of LT_FIELDCAT_KKBLO. - field-symbols: <f_grouplevels_line> like line of LT_GROUPLEVELS_KKBLO. - field-symbols: <f_line> type any. - -* Data for session 3: map data to semantic table -* ------------------------------------------ - - types: begin of st_column_index, - fieldname type kkblo_fieldname, - tabname type kkblo_tabname, - col like sy-index, - end of st_column_index. - -* columns index - data: lt_column_index type table of st_column_index. - data: wa_column_index like line of lt_column_index. - -* table of dependent field ( currency and quantity unit field) - data: lt_fieldcat_depf type kkblo_t_fieldcat. - data: wa_fieldcat_depf type kkblo_fieldcat. - -* XXL interface: -* -XXL: contain exporting columns characteristic - data: lt_sema type table of gxxlt_s initial size 0. - data: wa_sema like line of lt_sema. - -* -XXL interface: header - data: lt_hkey type table of gxxlt_h initial size 0. - data: wa_hkey like line of lt_hkey. - -* -XXL interface: header keys - data: lt_vkey type table of gxxlt_v initial size 0. - data: wa_vkey like line of lt_vkey. - -* Number of H Keys: number of key columns - data: l_n_hrz_keys type i. -* Number of data columns in the list object: non-key columns no - data: l_n_att_cols type i. -* Number of V Keys: number of header row - data: l_n_vrt_keys type i. - -* curency to format amount - data: lt_tcurx type table of tcurx. - data: wa_tcurx like line of lt_tcurx. - data: l_def type flag. " currency / quantity flag - data: wa_t006 type t006. " decimal place of unit - - data: l_num type i. " table columns number - data: l_typ type c. " table type - data: wa type ref to data. - data: l_int type i. - data: l_counter type i. - - field-symbols: <f_excel_column> type any. - field-symbols: <f_fcat_column> type any. - -* Data for session 4: write to excel -* ------------------------------------------ - - data: data_starting_at type i value 1. - data: data_ending_at type i value -1. - data: sema_type type c. - - data l_error type ref to c_oi_proxy_error. - data count type i. - data datac type i. - data datareal type i. " exporting column number - data vkeycount type i. - data all type i. - data mit type i value 1. " index of recent row? - data li_col_pos type i value 1. " column position - data li_col_num type i. " table columns number - field-symbols: <line> type any. - field-symbols: <item> type any. - - data td type sydes_desc. - - data: typ. - data: ranges type soi_range_list. - data: rangeitem type soi_range_item. - data: contents type soi_generic_table. - data: contentsitem type soi_generic_item. - data: semaitem type gxxlt_s. - data: hkeyitem type gxxlt_h. - data: vkeyitem type gxxlt_v. - data: li_commentary_rows type i. "row number of title lines + 1 - data: lo_error_w type ref to i_oi_error. - data: l_retcode type soi_ret_string. - data: no_flush type c value 'X'. - data: li_head_top type i. "header rows position - -* Data for session 5: Save and clode document -* ------------------------------------------ - - data: li_document_size type i. - data: ls_path type RLGRAP-FILENAME. - -* MACRO: Close_document -*------------------------------------------- - - DEFINE close_document. - clear: l_is_closed. - IF lo_proxy is not initial. - -* check proxy detroyed adi - - call method lo_proxy->is_destroyed - IMPORTING - ret_value = l_is_closed. - -* if dun detroyed yet: close -> release proxy - - IF l_is_closed is initial. - call method lo_proxy->close_document -* EXPORTING -* do_save = do_save - IMPORTING - error = lo_error - retcode = lc_retcode. - ENDIF. - - call method lo_proxy->release_document - IMPORTING - error = lo_error - retcode = lC_retcode. - - else. - lc_retcode = c_oi_errors=>ret_document_not_open. - ENDIF. - -* Detroy control container - - IF lo_control is not initial. - CALL METHOD lo_control->destroy_control. - ENDIF. - - clear: - lo_spreadsheet, - lo_proxy, - lo_control. - -* free local - - clear: l_is_closed. - - END-OF-DEFINITION. - -* Macro to catch DOI error -*------------------------------------------- - - DEFINE error_doi. - if lc_retcode ne c_oi_errors=>ret_ok. - close_document. - call method lo_error->raise_message - EXPORTING - type = 'E'. - clear: lo_error. - endif. - END-OF-DEFINITION. - -*--------------------------------------------------------------------* -* SESSION 0: DOI CONSTRUCTOR -*--------------------------------------------------------------------* - -* check active windown - - call function 'GUI_HAS_ACTIVEX' - IMPORTING - return = l_has_activex. - - if l_has_activex is initial. - raise MISS_GUIDE. - endif. - -* Get Container Object of Screen - - call method c_oi_container_control_creator=>get_container_control - IMPORTING - control = lo_control - retcode = lC_retcode. - - error_doi. - -* Initialize Container control - - CALL METHOD lo_control->init_control - EXPORTING - parent = CL_GUI_CONTAINER=>DEFAULT_SCREEN - r3_application_name = '' - inplace_enabled = 'X' - no_flush = 'X' - register_on_close_event = 'X' - register_on_custom_event = 'X' - IMPORTING - error = lO_ERROR - retcode = lc_retcode. - - error_doi. - -* Get Proxy Document: -* check exist of document proxy, if exist -> close first - - if not lo_proxy is initial. - close_document. - endif. - - IF i_xls is not initial. -* xls format, doctype = soi_doctype_excel97_sheet - l_doctype_excel_sheet = 'Excel.Sheet.8'. - else. -* xlsx format, doctype = soi_doctype_excel_sheet - l_doctype_excel_sheet = 'Excel.Sheet'. - ENDIF. - - CALL METHOD lo_control->get_document_proxy - EXPORTING - document_type = l_doctype_excel_sheet - register_container = 'X' - IMPORTING - document_proxy = lo_proxy - error = lO_ERROR - retcode = lc_retcode. - - error_doi. - - IF I_DOCUMENT_URL is initial. - -* create new excel document - - call method lo_proxy->create_document - EXPORTING - create_view_data = 'X' - open_inplace = 'X' - no_flush = 'X' - IMPORTING - ERROR = lO_ERROR - retcode = lc_retcode. - - error_doi. - - else. - -* Read excel template for i_DOCUMENT_URL -* this excel template can be store in local or server - - CALL METHOD lo_proxy->open_document - EXPORTING - document_url = i_document_url - open_inplace = 'X' - no_flush = 'X' - IMPORTING - error = lo_error - retcode = lc_retcode. - - error_doi. - - endif. - -* Check Spreadsheet Interface of Document Proxy - - CALL METHOD lo_proxy->has_spreadsheet_interface - IMPORTING - is_available = li_has - error = lO_ERROR - retcode = lc_retcode. - - error_doi. - -* create Spreadsheet object - - CHECK li_has IS NOT INITIAL. - - CALL METHOD lo_proxy->get_spreadsheet_interface - IMPORTING - sheet_interface = lo_spreadsheet - error = lO_ERROR - retcode = lc_retcode. - - error_doi. - -*--------------------------------------------------------------------* -* SESSION 1: GET LVC DATA FROM ALV OBJECT -*--------------------------------------------------------------------* - -* data table - - create object lo_grid - EXPORTING - i_parent = CL_GUI_CONTAINER=>SCREEN0. - - call method lo_grid->get_alv_attributes - EXPORTING - io_grid = io_alv - IMPORTING - Et_table = lt_alv. - - assign lt_alv->* to <f_alv_tab>. - -* fieldcat - - CALL METHOD iO_alv->GET_FRONTEND_FIELDCATALOG - IMPORTING - ET_FIELDCATALOG = lt_fieldcat_LVC. - -* table name - - loop at lt_fieldcat_LVC into wa_fieldcat_lvc - where not tabname is initial. - l_tabname = wa_fieldcat_lvc-tabname. - exit. - endloop. - - if sy-subrc ne 0. - l_tabname = '1'. - endif. - clear: wa_fieldcat_lvc. - -* sort table - - CALL METHOD IO_ALV->GET_SORT_CRITERIA - IMPORTING - ET_SORT = lt_sort_lvc. - - -* filter index - - CALL METHOD IO_ALV->GET_FILTERED_ENTRIES - IMPORTING - ET_FILTERED_ENTRIES = lt_filter_idx_lvc. - -* group level + subtotal - - CALL METHOD IO_ALV->GET_SUBTOTALS - IMPORTING - EP_COLLECT00 = lt_collect00 - EP_COLLECT01 = lt_collect01 - EP_COLLECT02 = lt_collect02 - EP_COLLECT03 = lt_collect03 - EP_COLLECT04 = lt_collect04 - EP_COLLECT05 = lt_collect05 - EP_COLLECT06 = lt_collect06 - EP_COLLECT07 = lt_collect07 - EP_COLLECT08 = lt_collect08 - EP_COLLECT09 = lt_collect09 - ET_GROUPLEVELS = lt_GROUPLEVELS_LVC. - - assign lt_collect00->* to <f_collect00>. - assign lt_collect01->* to <f_collect01>. - assign lt_collect02->* to <f_collect02>. - assign lt_collect03->* to <f_collect03>. - assign lt_collect04->* to <f_collect04>. - assign lt_collect05->* to <f_collect05>. - assign lt_collect06->* to <f_collect06>. - assign lt_collect07->* to <f_collect07>. - assign lt_collect08->* to <f_collect08>. - assign lt_collect09->* to <f_collect09>. - -* transfer to KKBLO struct - - CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO' - EXPORTING - IT_FIELDCAT_LVC = lt_fieldcat_lvc - IT_SORT_LVC = lt_sort_lvc - IT_FILTER_INDEX_LVC = lt_filter_idx_lvc - IT_GROUPLEVELS_LVC = lt_grouplevels_lvc - IMPORTING - ET_FIELDCAT_KKBLO = lt_fieldcat_kkblo - ET_SORT_KKBLO = lt_sort_kkblo - ET_FILTERED_ENTRIES_KKBLO = lt_filter_idx_kkblo - ET_GROUPLEVELS_KKBLO = lt_grouplevels_kkblo - TABLES - IT_DATA = <f_alv_tab> - EXCEPTIONS - IT_DATA_MISSING = 1 - IT_FIELDCAT_LVC_MISSING = 2 - OTHERS = 3. - IF SY-SUBRC <> 0. - raise ex_transfer_KKBLO_ERROR. - ENDIF. - - clear: - wa_fieldcat_lvc, - lt_fieldcat_lvc, - lt_sort_lvc, - lt_filter_idx_lvc, - lt_GROUPLEVELS_LVC. - - clear: - lo_grid. - - -*--------------------------------------------------------------------* -* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL -*--------------------------------------------------------------------* - -* append subtotal & total line - - create data lt_excel like <f_ALV_TAB>. - assign lt_excel->* to <f_excel_tab>. - - loop at <f_alv_tab> assigning <f_line>. - l_save_index = sy-tabix. - -* filter base on filter index table - - read table LT_FILTER_IDX_KKBLO assigning <f_filter_idx_line> - with key index = l_save_index - binary search. - if sy-subrc ne 0. - append <f_line> to <f_excel_tab>. - endif. - -* append subtotal lines - - read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line> - with key index_to = l_save_index - binary search. - if sy-subrc = 0. - l_tabix = sy-tabix. - do. - if <f_grouplevels_line>-subtot eq 'X' and - <f_grouplevels_line>-hide_level is initial and - <f_grouplevels_line>-cindex_from ne 0. - -* dynamic append subtotal line to excel table base on grouplevel table -* ex <f_GROUPLEVELS_line>-level = 1 -* then <f_collect_tab> = '<F_COLLECT01>' - - l_collect = <f_grouplevels_line>-level. - condense l_collect. - concatenate '<F_COLLECT0' - l_collect '>' -* '->*' - into l_collect. - - assign (l_collect) to <f_collect_tab>. - -* incase there're more than 1 total line of group, at the same level -* for example: subtotal of multi currency - - LOOP AT <f_collect_tab> assigning <f_collect_line>. - IF sy-tabix between <f_grouplevels_line>-cindex_from - and <f_grouplevels_line>-cindex_to. - - - append <f_collect_line> to <f_excel_tab>. - -* save subtotal lines index - - wa_subtot_indexs-index = sy-tabix. - append wa_subtot_indexs to lt_subtot_indexs. - -* append sub total ranges table for format later - - add 1 to l_sub_index. - subrangeitem-name = l_sub_index. - condense subrangeitem-name. - concatenate 'SUBTOT' - subrangeitem-name - into subrangeitem-name. - - subrangeitem-rows = wa_subtot_indexs-index. - subrangeitem-columns = 1. " start col - append subrangeitem to subranges. - clear: subrangeitem. - - ENDIF. - ENDLOOP. - unassign: <f_collect_tab>. - unassign: <f_collect_line>. - clear: l_collect. - endif. - -* check next subtotal level of group - - unassign: <f_grouplevels_line>. - add 1 to l_tabix. - - read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line> - index l_tabix. - if sy-subrc ne 0 - or <f_grouplevels_line>-index_to ne l_save_index. - exit. - endif. - - unassign: - <f_collect_tab>, - <f_collect_line>. - - enddo. - endif. - - clear: - l_tabix, - l_save_index. - - unassign: - <f_filter_idx_line>, - <f_grouplevels_line>. - - endloop. - -* free local data - - unassign: - <f_line>, - <f_collect_tab>, - <f_collect_line>, - <f_fieldcat_line>. - -* append grand total line - - IF <f_collect00> is assigned. - assign <f_collect00> to <f_collect_tab>. - if <f_collect_tab> is not initial. - LOOP AT <f_collect_tab> assigning <f_collect_line>. - - append <f_collect_line> to <f_excel_tab>. - -* save total line index - - wa_subtot_indexs-index = sy-tabix. - append wa_subtot_indexs to lt_subtot_indexs. - -* append grand total range (to format) - - add 1 to l_sub_index. - subrangeitem-name = l_sub_index. - condense subrangeitem-name. - concatenate 'TOTAL' - subrangeitem-name - into subrangeitem-name. - - subrangeitem-rows = wa_subtot_indexs-index. - subrangeitem-columns = 1. " start col - append subrangeitem to subranges. - ENDLOOP. - endif. - ENDIF. - - clear: - subrangeitem, - LT_SORT_KKBLO, - <f_collect00>, - <f_collect01>, - <f_collect02>, - <f_collect03>, - <f_collect04>, - <f_collect05>, - <f_collect06>, - <f_collect07>, - <f_collect08>, - <f_collect09>. - - unassign: - <f_collect00>, - <f_collect01>, - <f_collect02>, - <f_collect03>, - <f_collect04>, - <f_collect05>, - <f_collect06>, - <f_collect07>, - <f_collect08>, - <f_collect09>, - <f_collect_tab>, - <f_collect_line>. - -*--------------------------------------------------------------------* -* SESSION 3: MAP DATA TO SEMANTIC TABLE -*--------------------------------------------------------------------* - -* get dependent field field: currency and quantity - - create data wa like line of <f_excel_tab>. - assign wa->* to <f_excel_line>. - - describe field <f_excel_line> type l_typ components l_num. - - do l_num times. - l_save_index = sy-index. - assign component l_save_index of structure <f_excel_line> - to <f_excel_column>. - if sy-subrc ne 0. - message e059(0k) with 'FATAL ERROR' raising fatal_error. - endif. - - loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line> - where tabname = l_tabname. - assign component <f_fieldcat_line>-fieldname - of structure <f_excel_line> to <f_fcat_column>. - - describe distance between <f_excel_column> and <f_fcat_column> - into l_int in byte mode. - -* append column index -* this columns index is of table, not fieldcat - - if l_int = 0. - wa_column_index-fieldname = <f_fieldcat_line>-fieldname. - wa_column_index-tabname = <f_fieldcat_line>-tabname. - wa_column_index-col = l_save_index. - append wa_column_index to lt_column_index. - endif. - -* append dependent fields (currency and quantity unit) - - if <f_fieldcat_line>-cfieldname is not initial. - clear wa_fieldcat_depf. - wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname. - wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname. - collect wa_fieldcat_depf into lt_fieldcat_depf. - endif. - - if <f_fieldcat_line>-qfieldname is not initial. - clear wa_fieldcat_depf. - wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname. - wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname. - collect wa_fieldcat_depf into lt_fieldcat_depf. - endif. - -* rewrite field data type - - if <f_fieldcat_line>-inttype = 'X' - and <f_fieldcat_line>-datatype(3) = 'INT'. - <f_fieldcat_line>-inttype = 'I'. - endif. - - endloop. - - clear: l_save_index. - unassign: <f_fieldcat_line>. - - enddo. - -* build semantic tables - - l_n_hrz_keys = 1. - -* Get keyfigures - - loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line> - where tabname = l_tabname - and tech ne 'X' - and no_out ne 'X'. - - clear wa_sema. - clear wa_hkey. - -* Units belong to keyfigures -> display as str - - read table lt_fieldcat_depf into wa_fieldcat_depf with key - fieldname = <f_fieldcat_line>-fieldname - tabname = <f_fieldcat_line>-tabname. - - if sy-subrc = 0. - wa_sema-col_typ = 'STR'. - wa_sema-col_ops = 'DFT'. - -* Keyfigures - - else. - case <f_fieldcat_line>-datatype. - when 'QUAN'. - wa_sema-col_typ = 'N03'. - - if <f_fieldcat_line>-no_sum ne 'X'. - wa_sema-col_ops = 'ADD'. - else. - wa_sema-col_ops = 'NOP'. " no dependent field - endif. - - when 'DATS'. - wa_sema-col_typ = 'DAT'. - wa_sema-col_ops = 'NOP'. - - when 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans - wa_sema-col_typ = 'STR'. - wa_sema-col_ops = 'DFT'. " dependent field - -* incase numeric, ex '00120' -> display as '12' - - when 'NUMC'. - wa_sema-col_typ = 'STR'. - wa_sema-col_ops = 'DFT'. - - when others. - wa_sema-col_typ = 'NUM'. - - if <f_fieldcat_line>-no_sum ne 'X'. - wa_sema-col_ops = 'ADD'. - else. - wa_sema-col_ops = 'NOP'. - endif. - endcase. - endif. - - l_counter = l_counter + 1. - l_n_att_cols = l_n_att_cols + 1. - - wa_sema-col_no = l_counter. - - read table lt_column_index into wa_column_index with key - fieldname = <f_fieldcat_line>-fieldname - tabname = <f_fieldcat_line>-tabname. - - if sy-subrc = 0. - wa_sema-col_src = wa_column_index-col. - else. - raise fatal_error. - endif. - -* columns index of ref currency field in table - - if not <f_fieldcat_line>-cfieldname is initial. - read table lt_column_index into wa_column_index with key - fieldname = <f_fieldcat_line>-cfieldname - tabname = <f_fieldcat_line>-ctabname. - - if sy-subrc = 0. - wa_sema-col_cur = wa_column_index-col. - endif. - -* quantities fields -* treat as currency when display on excel - - elseif not <f_fieldcat_line>-qfieldname is initial. - read table lt_column_index into wa_column_index with key - fieldname = <f_fieldcat_line>-qfieldname - tabname = <f_fieldcat_line>-qtabname. - if sy-subrc = 0. - wa_sema-col_cur = wa_column_index-col. - endif. - - endif. - -* Treat of fixed currency in the fieldcatalog for column - - data: l_num_help(2) type n. - - if not <f_fieldcat_line>-currency is initial. - - select * from tcurx into table lt_tcurx. - sort lt_tcurx. - read table lt_tcurx into wa_tcurx - with key currkey = <f_fieldcat_line>-currency. - if sy-subrc = 0. - l_num_help = wa_tcurx-currdec. - concatenate 'N' l_num_help into wa_sema-col_typ. - wa_sema-col_cur = sy-tabix * ( -1 ). - endif. - - endif. - - wa_hkey-col_no = l_n_att_cols. - wa_hkey-row_no = l_n_hrz_keys. - wa_hkey-col_name = <f_fieldcat_line>-reptext. - append wa_hkey to lt_hkey. - append wa_sema to lt_sema. - - endloop. - -* free local data - - clear: - lt_column_index, - wa_column_index, - lt_fieldcat_depf, - wa_fieldcat_depf, - lt_tcurx, - wa_tcurx, - l_num, - l_typ, - wa, - l_int, - l_counter. - - unassign: - <f_fieldcat_line>, - <f_excel_line>, - <f_excel_column>, - <f_fcat_column>. - -*--------------------------------------------------------------------* -* SESSION 4: WRITE TO EXCEL -*--------------------------------------------------------------------* - - clear: wa_tcurx. - refresh: lt_tcurx. - -* if spreadsheet dun have proxy yet - - if li_has is initial. - l_retcode = c_oi_errors=>ret_interface_not_supported. - call method c_oi_errors=>create_error_for_retcode - EXPORTING - retcode = l_retcode - no_flush = no_flush - IMPORTING - error = lo_error_w. - exit. - endif. - - create object l_error - EXPORTING - object_name = 'OLE_DOCUMENT_PROXY' - method_name = 'get_ranges_names'. - - call method c_oi_errors=>add_error - EXPORTING - error = l_error. - - - describe table lt_sema lines datareal. - describe table <f_excel_tab> lines datac. - describe table lt_vkey lines vkeycount. - - if datac = 0. - raise inv_data_range. - endif. - - - if vkeycount ne l_n_vrt_keys. - raise dim_mismatch_vkey. - endif. - - all = l_n_vrt_keys + l_n_att_cols. - - if datareal ne all. - raise dim_mismatch_sema. - endif. - - data: decimal type c. - -* get decimal separator format ('.', ',', ...) in Office config - - call method lo_proxy->get_application_property - EXPORTING - property_name = 'INTERNATIONAL' - subproperty_name = 'DECIMAL_SEPARATOR' - CHANGING - retvalue = decimal. - - data: wa_usr type usr01. - select * from usr01 into wa_usr where bname = sy-uname. - endselect. - - data: comma_elim(4) type c. - data: help6 type i. - field-symbols <g> type any. - data search_item(4) value ' #'. - - concatenate ',' decimal '.' decimal into comma_elim. - - data help type i. " table (with subtotal) line number - - help = datac. - - data: rowmax type i value 1. " header row number - data: columnmax type i value 0. " header columns number - - loop at lt_hkey into hkeyitem. - if hkeyitem-col_no > columnmax. - columnmax = hkeyitem-col_no. - endif. - - if hkeyitem-row_no > rowmax. - rowmax = hkeyitem-row_no. - endif. - endloop. - - data: hkeycolumns type i. " header columns no - - hkeycolumns = columnmax. - - if hkeycolumns < l_n_att_cols. - hkeycolumns = l_n_att_cols. - endif. - - columnmax = 0. - - loop at lt_vkey into vkeyitem. - if vkeyitem-col_no > columnmax. - columnmax = vkeyitem-col_no. - endif. - endloop. - - data overflow type i value 1. - data testname(10) type c. - data temp2 type i. " 1st item row position in excel - data realmit type i value 1. - data realoverflow type i value 1. " row index in content - - call method lo_spreadsheet->screen_update - EXPORTING - updating = ''. - - call method lo_spreadsheet->load_lib. - - data: str(40) type c. " range names of columns range (w/o col header) - data: rows type i. " row postion of 1st item line in ecxel - -* calculate row position of data table - - describe table iT_LISTHEADER lines li_commentary_rows. - -* if grid had title, add 1 empy line between title and table - - if li_commentary_rows ne 0. - add 1 to li_commentary_rows. - endif. - -* add top position of block data - - li_commentary_rows = li_commentary_rows + i_top - 1. - -* write header (commentary rows) - - data: li_commentary_row_index type i value 1. - data: li_content_index type i value 1. - data: ls_index(10) type c. - data ls_commentary_range(40) type c value 'TITLE'. - data: li_font_bold type i. - data: li_font_italic type i. - data: li_font_size type i. - - loop at iT_LISTHEADER into wa_listheader. - li_commentary_row_index = i_top + li_content_index - 1. - ls_index = li_content_index. - condense ls_index. - concatenate ls_commentary_range(5) ls_index - into ls_commentary_range. - condense ls_commentary_range. - -* insert title range - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = ls_commentary_range - top = li_commentary_row_index - left = i_left - rows = 1 - columns = 1 - no_flush = no_flush. - -* format range - - case wa_listheader-typ. - when 'H'. "title - li_font_size = 16. - li_font_bold = 1. - li_font_italic = -1. - when 'S'. "subtile - li_font_size = -1. - li_font_bold = 1. - li_font_italic = -1. - when others. "'A' comment - li_font_size = -1. - li_font_bold = -1. - li_font_italic = 1. - endcase. - - call method lo_spreadsheet->set_font - EXPORTING - rangename = ls_commentary_range - family = '' - size = li_font_size - bold = li_font_bold - italic = li_font_italic - align = 0 - no_flush = no_flush. - -* title: range content - - rangeitem-name = ls_commentary_range. - rangeitem-columns = 1. - rangeitem-rows = 1. - append rangeitem to ranges. - - contentsitem-row = li_content_index. - contentsitem-column = 1. - concatenate wa_listheader-key - wa_listheader-info - into contentsitem-value - separated by space. - condense contentsitem-value. - append contentsitem to contents. - - add 1 to li_content_index. - - clear: - rangeitem, - contentsitem, - ls_index. - - endloop. - -* set range data title - - call method lo_spreadsheet->set_ranges_data - EXPORTING - ranges = ranges - contents = contents - no_flush = no_flush. - - refresh: - ranges, - contents. - - rows = rowmax + li_commentary_rows + 1. - - all = wa_usr-datfm. - all = all + 3. - - loop at lt_sema into semaitem. - if semaitem-col_typ = 'DAT' or semaitem-col_typ = 'MON' or - semaitem-col_typ = 'N00' or semaitem-col_typ = 'N01' or - semaitem-col_typ = 'N01' or semaitem-col_typ = 'N02' or - semaitem-col_typ = 'N03' or semaitem-col_typ = 'PCT' or - semaitem-col_typ = 'STR' or semaitem-col_typ = 'NUM'. - clear str. - str = semaitem-col_no. - condense str. - concatenate 'DATA' str into str. - mit = semaitem-col_no. - li_col_pos = semaitem-col_no + i_left - 1. - -* range from data1 to data(n), for each columns of table - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = str - top = rows - left = li_col_pos - rows = help - columns = 1 - no_flush = no_flush. - - data dec type i value -1. - data typeinfo type sydes_typeinfo. - loop at <f_excel_tab> assigning <line>. - assign component semaitem-col_no of structure <line> to <item>. - describe field <item> into td. - read table td-types index 1 into typeinfo. - if typeinfo-type = 'P'. - dec = typeinfo-decimals. - elseif typeinfo-type = 'I'. - dec = 0. - endif. - - describe field <line> type typ components count. - mit = 1. - do count times. - if mit = semaitem-col_src. - assign component sy-index of structure <line> to <item>. - describe field <item> into td. - read table td-types index 1 into typeinfo. - if typeinfo-type = 'P'. - dec = typeinfo-decimals. - endif. - exit. - endif. - mit = mit + 1. - enddo. - exit. - endloop. - -* format for each columns of table (w/o columns headers) - - if semaitem-col_typ = 'DAT'. - if semaitem-col_no > vkeycount. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = all - no_flush = no_flush. - else. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 0 - no_flush = no_flush. - endif. - elseif semaitem-col_typ = 'STR'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 0 - no_flush = no_flush. - elseif semaitem-col_typ = 'MON'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 10 - no_flush = no_flush. - elseif semaitem-col_typ = 'N00'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 0 - no_flush = no_flush. - elseif semaitem-col_typ = 'N01'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 1 - no_flush = no_flush. - elseif semaitem-col_typ = 'N02'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 2 - no_flush = no_flush. - elseif semaitem-col_typ = 'N03'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 3 - no_flush = no_flush. - elseif semaitem-col_typ = 'N04'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 4 - no_flush = no_flush. - elseif semaitem-col_typ = 'NUM'. - if dec eq -1. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = 2 - no_flush = no_flush. - else. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 1 - decimals = dec - no_flush = no_flush. - endif. - elseif semaitem-col_typ = 'PCT'. - call method lo_spreadsheet->set_format - EXPORTING - rangename = str - currency = '' - typ = 3 - decimals = 0 - no_flush = no_flush. - endif. - - endif. - endloop. - -* get item contents for set_range_data method -* get currency cell also - - mit = 1. - - data: currcells type soi_cell_table. - data: curritem type soi_cell_item. - - curritem-rows = 1. - curritem-columns = 1. - curritem-front = -1. - curritem-back = -1. - curritem-font = ''. - curritem-size = -1. - curritem-bold = -1. - curritem-italic = -1. - curritem-align = -1. - curritem-frametyp = -1. - curritem-framecolor = -1. - curritem-currency = ''. - curritem-number = 1. - curritem-input = -1. - - data: conv_exit(10) type c. - data: const type i. - -* Change for Correction request -* Initial 10000 lines are missing in Excel Export -* if there are only 2 columns in exported List object. - - if datareal gt 2. - const = 20000 / datareal. - else. - const = 20000 / ( datareal + 2 ). - endif. - - data: lines type i. - data: innerlines type i. - data: counter type i. - data: curritem2 like curritem. - data: curritem3 like curritem. - data: length type i. - data: found. - -* append content table (for method set_range_content) - - loop at <f_excel_tab> assigning <line>. - -* save line index to compare with lt_subtot_indexs, -* to discover line is a subtotal / totale line or not -* ex use to set 'dun display zero in subtotal / total line' - - l_save_index = sy-tabix. - - do datareal times. - read table lt_sema into semaitem with key col_no = sy-index. - if semaitem-col_src ne 0. - assign component semaitem-col_src - of structure <line> to <item>. - else. - assign component sy-index - of structure <line> to <item>. - endif. - - contentsitem-row = realoverflow. - - if sy-subrc = 0. - move semaitem-col_ops to search_item(3). - search 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#' - for search_item. - if sy-subrc ne 0. - raise error_in_sema. - endif. - move semaitem-col_typ to search_item(3). - search 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#' - for search_item. - if sy-subrc ne 0. - raise error_in_sema. - endif. - contentsitem-column = sy-index. - if semaitem-col_typ eq 'DAT' or semaitem-col_typ eq 'MON'. - if semaitem-col_no > vkeycount. - - " Hinweis 512418 - " EXCEL bezieht Datumsangaben - " auf den 31.12.1899, behandelt - " aber 1900 als ein Schaltjahr - " d.h. ab 1.3.1900 korrekt - " 1.3.1900 als Zahl = 61 - - data: genesis type d value '18991230'. - data: number_of_days type p. -* change for date in char format & sema_type = X - data: temp_date type d. - - if not <item> is initial and not <item> co ' ' and not - <item> co '0'. -* change for date in char format & sema_type = X starts - if sema_type = 'X'. - describe field <item> type typ. - if typ = 'C'. - temp_date = <item>. - number_of_days = temp_date - genesis. - else. - number_of_days = <item> - genesis. - endif. - else. - number_of_days = <item> - genesis. - endif. -* change for date in char format & sema_type = X ends - if number_of_days < 61. - number_of_days = number_of_days - 1. - endif. - - set country 'DE'. - write number_of_days to contentsitem-value - no-grouping - left-justified. - set country space. - translate contentsitem-value using comma_elim. - else. - clear contentsitem-value. - endif. - else. - move <item> to contentsitem-value. - endif. - elseif semaitem-col_typ eq 'NUM' or - semaitem-col_typ eq 'N00' or - semaitem-col_typ eq 'N01' or - semaitem-col_typ eq 'N02' or - semaitem-col_typ eq 'N03' or - semaitem-col_typ eq 'N04' or - semaitem-col_typ eq 'PCT'. - set country 'DE'. - describe field <item> type typ. - - if semaitem-col_cur is initial. - if typ ne 'F'. - write <item> to contentsitem-value no-grouping - no-sign decimals 14. - else. - write <item> to contentsitem-value no-grouping - no-sign. - endif. - else. -* Treat of fixed curreny for column >>Y9CK007319 - if semaitem-col_cur < 0. - semaitem-col_cur = semaitem-col_cur * ( -1 ). - select * from tcurx into table lt_tcurx. - sort lt_tcurx. - read table lt_tcurx into - wa_tcurx index semaitem-col_cur. - if sy-subrc = 0. - if typ ne 'F'. - write <item> to contentsitem-value no-grouping - currency wa_tcurx-currkey no-sign decimals 14. - else. - write <item> to contentsitem-value no-grouping - currency wa_tcurx-currkey no-sign. - endif. - endif. - else. - assign component semaitem-col_cur - of structure <line> to <g>. -* mit = index of recent row - curritem-top = rowmax + mit + li_commentary_rows. - - li_col_pos = sy-index + i_left - 1. - curritem-left = li_col_pos. - -* if filed is quantity field (qfieldname ne space) -* or amount field (cfieldname ne space), then format decimal place -* corresponding with config - - clear: l_def. - read table LT_FIELDCAT_KKBLO assigning <f_fieldcat_line> - with key tabname = l_tabname - tech = space - no_out = space - col_pos = semaitem-col_no. - IF sy-subrc = 0. - IF <f_fieldcat_line>-cfieldname is not initial. - l_def = 'C'. - else."if <f_fieldcat_line>-qfieldname is not initial. - l_def = 'Q'. - ENDIF. - ENDIF. - -* if field is amount field -* exporting of amount field base on currency decimal table: TCURX - IF l_def = 'C'. "field is amount field - select single * from tcurx into wa_tcurx - where currkey = <g>. -* if amount ref to un-know currency -> default decimal = 2 - if sy-subrc eq 0. - curritem-decimals = wa_tcurx-currdec. - else. - curritem-decimals = 2. - endif. - - append curritem to currcells. - if typ ne 'F'. - write <item> to contentsitem-value - currency <g> - no-sign no-grouping. - else. - write <item> to contentsitem-value - decimals 14 currency <g> - no-sign no-grouping. - endif. - -* if field is quantity field -* exporting of quantity field base on quantity decimal table: T006 - - else."if l_def = 'Q'. " field is quantity field - clear: wa_t006. - select single * from t006 into wa_t006 - where MSEHI = <g>. -* if quantity ref to un-know unit-> default decimal = 2 - if sy-subrc eq 0. - curritem-decimals = wa_t006-decan. - else. - curritem-decimals = 2. - endif. - append curritem to currcells. - - write <item> to contentsitem-value - unit <g> - no-sign no-grouping. - condense contentsitem-value. - - ENDIF. - - endif. "Y9CK007319 - endif. - condense contentsitem-value. - -* add function fieldcat-no zero display - - loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line> - where tabname = l_tabname - and tech ne 'X' - and no_out ne 'X'. - if <f_fieldcat_line>-col_pos = semaitem-col_no. - if <f_fieldcat_line>-no_zero = 'X'. - if <item> = '0'. - clear: contentsitem-value. - endif. - -* dun display zero in total/subtotal line too - - else. - clear: wa_subtot_indexs. - read table lt_subtot_indexs into wa_subtot_indexs - with key index = l_save_index. - IF sy-subrc = 0. - if <item> = '0'. - clear: contentsitem-value. - endif. - ENDIF. - endif. - endif. - endloop. - unassign: <f_fieldcat_line>. - - if <item> lt 0. - search contentsitem-value for 'E'. - if sy-fdpos eq 0. - -* use prefix notation for signed numbers - - translate contentsitem-value using '- '. - condense contentsitem-value no-gaps. - concatenate '-' contentsitem-value - into contentsitem-value. - else. - concatenate '-' contentsitem-value - into contentsitem-value. - endif. - endif. - set country space. -* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die -* Zeichen einer -* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten. -* Für die -* darf keine Kommaseparierung stattfinden. -* Changing for correction request - Y6BK041073 - if contentsitem-value co '0123456789.,-+E '. - translate contentsitem-value using comma_elim. - endif. - else. - clear contentsitem-value. - -* if type is not numeric -> dun display with zero - - write <item> to contentsitem-value no-zero. - - shift contentsitem-value left deleting leading space. - - endif. - append contentsitem to contents. - endif. - enddo. - - realmit = realmit + 1. - realoverflow = realoverflow + 1. - - mit = mit + 1. -* overflow = current row index in content table - overflow = overflow + 1. - endloop. - - unassign: <f_fieldcat_line>. - -* set item range for set_range_data method - - testname = mit / const. - condense testname. - - concatenate 'TEST' testname into testname. - - realoverflow = realoverflow - 1. - realmit = realmit - 1. - help = realoverflow. - - rangeitem-name = testname. - rangeitem-columns = datareal. - rangeitem-rows = help. - append rangeitem to ranges. - -* insert item range dim - - temp2 = rowmax + 1 + li_commentary_rows + realmit - realoverflow. - -* items data - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = testname - top = temp2 - left = i_left - rows = help - columns = datareal - no_flush = no_flush. - -* get columns header contents for set_range_data method -* export columns header only if no columns header option = space - - data: rowcount type i. - data: columncount type i. - - if i_columns_header = 'X'. - -* append columns header to contents: hkey - - rowcount = 1. - do rowmax times. - columncount = 1. - do hkeycolumns times. - loop at lt_hkey into hkeyitem where col_no = columncount - and row_no = rowcount. - endloop. - if sy-subrc = 0. - str = hkeyitem-col_name. - contentsitem-value = hkeyitem-col_name. - else. - contentsitem-value = str. - endif. - contentsitem-column = columncount. - contentsitem-row = rowcount. - append contentsitem to contents. - columncount = columncount + 1. - enddo. - rowcount = rowcount + 1. - enddo. - -* incase columns header in multiline - - data: rowmaxtemp type i. - if rowmax > 1. - rowmaxtemp = rowmax - 1. - rowcount = 1. - do rowmaxtemp times. - columncount = 1. - do columnmax times. - contentsitem-column = columncount. - contentsitem-row = rowcount. - contentsitem-value = ''. - append contentsitem to contents. - columncount = columncount + 1. - enddo. - rowcount = rowcount + 1. - enddo. - endif. - -* append columns header to contents: vkey - - columncount = 1. - do columnmax times. - loop at lt_vkey into vkeyitem where col_no = columncount. - endloop. - contentsitem-value = vkeyitem-col_name. - contentsitem-row = rowmax. - contentsitem-column = columncount. - append contentsitem to contents. - columncount = columncount + 1. - enddo. -*--------------------------------------------------------------------* -* set header range for method set_range_data -* insert header keys range dim - - li_head_top = li_commentary_rows + 1. - li_col_pos = i_left. - -* insert range headers - - if hkeycolumns ne 0. - rangeitem-name = 'TESTHKEY'. - rangeitem-rows = rowmax. - rangeitem-columns = hkeycolumns. - append rangeitem to ranges. - clear: rangeitem. - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = 'TESTHKEY' - top = li_head_top - left = li_col_pos - rows = rowmax - columns = hkeycolumns - no_flush = no_flush. - endif. - endif. - -* format for columns header + total + subtotal -* ------------------------------------------ - - help = rowmax + realmit. " table + header lines - - data: item type colxxl_t. - data: lt_format type soi_format_table. - data: wa_format like line of lt_format. - data: wa_format_temp like line of lt_format. - - field-symbols: <f_source> type any. - field-symbols: <f_des> type any. - -* columns header format - - wa_format-front = -1. - wa_format-back = 15. "grey - wa_format-font = space. - wa_format-size = -1. - wa_format-bold = 1. - wa_format-align = 0. - wa_format-frametyp = -1. - wa_format-framecolor = -1. - -* get column header format from input record -* -> map input format - - if i_columns_header = 'X'. - wa_format-name = 'TESTHKEY'. - if i_format_col_header is not initial. - describe field i_format_col_header type l_typ components - li_col_num. - do li_col_num times. - if sy-index ne 1. " dun map range name - assign component sy-index of structure i_format_col_header - to <f_source>. - if <f_source> is not initial. - assign component sy-index of structure wa_format to <f_des>. - <f_des> = <f_source>. - unassign: <f_des>. - endif. - unassign: <f_source>. - endif. - enddo. - - clear: li_col_num. - endif. - - append wa_format to lt_format. - endif. - -* Zusammenfassen der Spalten mit gleicher Nachkommastellenzahl -* collect vertical cells (col) with the same number of decimal places -* to increase perfomance in currency cell format - - describe table currcells lines lines. - lines = lines - 1. - do lines times. - describe table currcells lines innerlines. - innerlines = innerlines - 1. - sort currcells by left top. - clear found. - do innerlines times. - read table currcells index sy-index into curritem. - counter = sy-index + 1. - read table currcells index counter into curritem2. - if curritem-left eq curritem2-left. - length = curritem-top + curritem-rows. - if length eq curritem2-top. - if curritem-decimals eq curritem2-decimals. - move curritem to curritem3. - curritem3-rows = curritem3-rows + curritem2-rows. - curritem-left = -1. - modify currcells index sy-index from curritem. - curritem2-left = -1. - modify currcells index counter from curritem2. - append curritem3 to currcells. - found = 'X'. - endif. - endif. - endif. - enddo. - if found is initial. - exit. - endif. - delete currcells where left = -1. - enddo. - -* Zusammenfassen der Zeilen mit gleicher Nachkommastellenzahl -* collect horizontal cells (row) with the same number of decimal places -* to increase perfomance in currency cell format - - describe table currcells lines lines. - lines = lines - 1. - do lines times. - describe table currcells lines innerlines. - innerlines = innerlines - 1. - sort currcells by top left. - clear found. - do innerlines times. - read table currcells index sy-index into curritem. - counter = sy-index + 1. - read table currcells index counter into curritem2. - if curritem-top eq curritem2-top and curritem-rows eq - curritem2-rows. - length = curritem-left + curritem-columns. - if length eq curritem2-left. - if curritem-decimals eq curritem2-decimals. - move curritem to curritem3. - curritem3-columns = curritem3-columns + curritem2-columns. - curritem-left = -1. - modify currcells index sy-index from curritem. - curritem2-left = -1. - modify currcells index counter from curritem2. - append curritem3 to currcells. - found = 'X'. - endif. - endif. - endif. - enddo. - if found is initial. - exit. - endif. - delete currcells where left = -1. - enddo. -* Ende der Zusammenfassung - - -* item data: format for currency cell, corresponding with currency - - call method lo_spreadsheet->cell_format - EXPORTING - cells = currcells - no_flush = no_flush. - -* item data: write item table content - - call method lo_spreadsheet->set_ranges_data - EXPORTING - ranges = ranges - contents = contents - no_flush = no_flush. - -* whole table range to format all table - - if i_columns_header = 'X'. - li_head_top = li_commentary_rows + 1. - else. - li_head_top = li_commentary_rows + 2. - help = help - 1. - endif. - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = 'WHOLE_TABLE' - top = li_head_top - left = i_left - rows = help - columns = datareal - no_flush = no_flush. - -* columns width auto fix -* this parameter = space in case use with exist template - - IF i_columns_autofit = 'X'. - call method lo_spreadsheet->fit_widest - EXPORTING - name = 'WHOLE_TABLE' - no_flush = no_flush. - ENDIF. - -* frame -* The parameter has 8 bits -*0 Left margin -*1 Top marginT -*2 Bottom margin -*3 Right margin -*4 Horizontal line -*5 Vertical line -*6 Thinness -*7 Thickness -* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left - -* ( final DOI method call, set no_flush = space -* equal to call method CL_GUI_CFW=>FLUSH ) - - call method lo_spreadsheet->set_frame - EXPORTING - rangename = 'WHOLE_TABLE' - typ = 127 - color = 1 - no_flush = space - IMPORTING - error = lo_error - retcode = lc_retcode. - - error_doi. - -* reformat subtotal / total line after format wholw table - - loop at subranges into subrangeitem. - l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax. - - call method lo_spreadsheet->insert_range_dim - EXPORTING - name = subrangeitem-name - left = i_left - top = l_sub_index - rows = 1 - columns = datareal - no_flush = no_flush. - - wa_format-name = subrangeitem-name. - -* default format: -* - clolor: subtotal = light yellow, subtotal = yellow -* - frame: box - - IF subrangeitem-name(3) = 'SUB'. - wa_format-back = 36. "subtotal line - wa_format_temp = i_format_subtotal. - else. - wa_format-back = 27. "total line - wa_format_temp = i_format_total. - endif. - wa_format-FRAMETYP = 79. - wa_format-FRAMEcolor = 1. - wa_format-number = -1. - wa_format-align = -1. - -* get subtoal + total format from intput parameter -* overwrite default format - - if wa_format_temp is not initial. - describe field wa_format_temp type l_typ components li_col_num. - do li_col_num times. - if sy-index ne 1. " dun map range name - assign component sy-index of structure wa_format_temp - to <f_source>. - if <f_source> is not initial. - assign component sy-index of structure wa_format to <f_des>. - <f_des> = <f_source>. - unassign: <f_des>. - endif. - unassign: <f_source>. - endif. - enddo. - - clear: li_col_num. - endif. - - append wa_format to lt_format. - clear: wa_format-name. - clear: l_sub_index. - clear: wa_format_temp. - - endloop. - - if lt_format[] is not initial. - call method lo_spreadsheet->set_ranges_format - EXPORTING - formattable = lt_format - no_flush = no_flush. - refresh: lt_format. - endif. -*--------------------------------------------------------------------* - call method lo_spreadsheet->screen_update - EXPORTING - updating = 'X'. - - call method c_oi_errors=>flush_errors. - - lo_error_w = l_error. - lc_retcode = lo_error_w->error_code. - -** catch no_flush -> led to dump ( optional ) -* go_error = l_error. -* gc_retcode = go_error->error_code. -* error_doi. - - clear: - lt_sema, - wa_sema, - lt_hkey, - wa_hkey, - lt_vkey, - wa_vkey, - l_n_hrz_keys, - l_n_att_cols, - l_n_vrt_keys, - count, - datac, - datareal, - vkeycount, - all, - mit, - li_col_pos, - li_col_num, - ranges, - rangeitem, - contents, - contentsitem, - semaitem, - hkeyitem, - vkeyitem, - li_commentary_rows, - l_retcode, - li_head_top, - <f_excel_tab>. - - clear: - lo_error_w. - - unassign: - <line>, - <item>, - <f_excel_tab>. - -*--------------------------------------------------------------------* -* SESSION 5: SAVE AND CLOSE FILE -*--------------------------------------------------------------------* - -* ex of save path: 'FILE://C:\temp\test.xlsx' - concatenate 'FILE://' I_save_path - into ls_path. - - call method lo_proxy->save_document_to_url - EXPORTING - no_flush = 'X' - url = ls_path - IMPORTING - error = lo_error - retcode = lc_retcode - CHANGING - document_size = li_document_size. - - error_doi. - -* if save successfully -> raise successful message -* message i499(sy) with 'Document is Exported to ' p_path. - message i499(sy) with 'Data has been exported successfully'. - - clear: - ls_path, - li_document_size. - - close_document. - endmethod. - - - - - - - - - method BIND_TABLE. -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmöcker, (wi p) 2012-12-01 -* - ... -* aligning code -* message made to support multilinguality -*--------------------------------------------------------------------* -* issue #237 - Check if overlapping areas exist -* - Alessandro Iannacci 2012-12-01 -* changes: - Added raise if overlaps are detected -*--------------------------------------------------------------------* - - CONSTANTS: - lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'A', - lc_top_left_row TYPE zexcel_cell_row VALUE 1. - - DATA: - lv_row_int TYPE zexcel_cell_row, - lv_first_row TYPE zexcel_cell_row, - lv_last_row TYPE zexcel_cell_row, - lv_column_int TYPE zexcel_cell_column, - lv_column_alpha TYPE zexcel_cell_column_alpha, - lt_field_catalog TYPE zexcel_t_fieldcatalog, - lv_id TYPE i, - lv_rows TYPE i, - lv_formula TYPE string, - ls_settings TYPE zexcel_s_table_settings, - lo_table TYPE REF TO zcl_excel_table, - lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line, - lv_value TYPE string, - lv_value_lowercase TYPE string, - lv_syindex TYPE char3, - lv_errormessage TYPE string, "ins issue #237 - - lv_columns TYPE i, - lt_columns TYPE zexcel_t_fieldcatalog, - lv_maxcol TYPE i, - lv_maxrow TYPE i, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_curtable TYPE REF TO zcl_excel_table. - - FIELD-SYMBOLS: - <ls_field_catalog> TYPE zexcel_s_fieldcatalog, - <ls_field_catalog_custom> TYPE zexcel_s_fieldcatalog, - <fs_table_line> TYPE ANY, - <fs_fldval> TYPE ANY. - - ls_settings = is_table_settings. - - IF ls_settings-top_left_column IS INITIAL. - ls_settings-top_left_column = lc_top_left_column. - ENDIF. - - IF ls_settings-table_style IS INITIAL. - ls_settings-table_style = zcl_excel_table=>builtinstyle_medium2. - ENDIF. - - IF ls_settings-top_left_row IS INITIAL. - ls_settings-top_left_row = lc_top_left_row. - ENDIF. - - IF it_field_catalog IS NOT SUPPLIED. - lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = ip_table ). - ELSE. - lt_field_catalog = it_field_catalog. - ENDIF. - - SORT lt_field_catalog BY position. - -*--------------------------------------------------------------------* -* issue #237 Check if overlapping areas exist Start -*--------------------------------------------------------------------* - "Get the number of columns for the current table - lt_columns = lt_field_catalog. - DELETE lt_columns WHERE dynpfld NE abap_true. - DESCRIBE TABLE lt_columns LINES lv_columns. - - "Calculate the top left row of the current table - lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ). - lv_row_int = ls_settings-top_left_row. - - "Get number of row for the current table - DESCRIBE TABLE ip_table LINES lv_rows. - - "Calculate the bottom right row for the current table - lv_maxcol = lv_column_int + lv_columns - 1. - lv_maxrow = lv_row_int + lv_rows - 1. - ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ). - ls_settings-bottom_right_row = lv_maxrow. - - lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ). - - lo_iterator = me->tables->if_object_collection~get_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - - lo_curtable ?= lo_iterator->if_object_collection_iterator~get_next( ). - IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row ) - OR - ( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row ) - ) - AND - ( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) - OR - ( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) - ). - lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ENDWHILE. -*--------------------------------------------------------------------* -* issue #237 Check if overlapping areas exist End -*--------------------------------------------------------------------* - - CREATE OBJECT lo_table. - lo_table->settings = ls_settings. - lo_table->set_data( ir_data = ip_table ). - lv_id = me->excel->get_next_table_id( ). - lo_table->set_id( iv_id = lv_id ). -* lo_table->fieldcat = lt_field_catalog[]. - - me->tables->add( lo_table ). - -* It is better to loop column by column (only visible column) - LOOP AT lt_field_catalog ASSIGNING <ls_field_catalog> WHERE dynpfld EQ abap_true. - - lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). - - " Due restrinction of new table object we cannot have two column with the same name - " Check if a column with the same name exists, if exists add a counter - " If no medium description is provided we try to use small or long -* lv_value = <ls_field_catalog>-scrtext_m. - field-symbols: <scrtxt1> type any, - <scrtxt2> type any, - <scrtxt3> type any. - - case iv_default_descr. - when 'M'. - assign <ls_field_catalog>-scrtext_m to <scrtxt1>. - assign <ls_field_catalog>-scrtext_s to <scrtxt2>. - assign <ls_field_catalog>-scrtext_l to <scrtxt3>. - when 'S'. - assign <ls_field_catalog>-scrtext_s to <scrtxt1>. - assign <ls_field_catalog>-scrtext_m to <scrtxt2>. - assign <ls_field_catalog>-scrtext_l to <scrtxt3>. - when 'L'. - assign <ls_field_catalog>-scrtext_l to <scrtxt1>. - assign <ls_field_catalog>-scrtext_m to <scrtxt2>. - assign <ls_field_catalog>-scrtext_s to <scrtxt3>. - when others. - assign <ls_field_catalog>-scrtext_m to <scrtxt1>. - assign <ls_field_catalog>-scrtext_s to <scrtxt2>. - assign <ls_field_catalog>-scrtext_l to <scrtxt3>. - endcase. - - - if <scrtxt1> is not initial. - lv_value = <scrtxt1>. - <ls_field_catalog>-scrtext_l = lv_value. - elseif <scrtxt2> is not initial. - lv_value = <scrtxt2>. - <ls_field_catalog>-scrtext_l = lv_value. - elseif <scrtxt3> is not initial. - lv_value = <scrtxt3>. - <ls_field_catalog>-scrtext_l = lv_value. - else. - lv_value = 'Column'. " default value as Excel does - <ls_field_catalog>-scrtext_l = lv_value. - endif. - WHILE 1 = 1. - lv_value_lowercase = lv_value. - TRANSLATE lv_value_lowercase TO LOWER CASE. - READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value_lowercase BINARY SEARCH. - IF sy-subrc <> 0. - <ls_field_catalog>-scrtext_l = lv_value. - INSERT lv_value_lowercase INTO TABLE lt_column_name_buffer. - EXIT. - ELSE. - lv_syindex = sy-index. - CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value. - ENDIF. - - ENDWHILE. - " First of all write column header - IF <ls_field_catalog>-style_header IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = lv_value - ip_style = <ls_field_catalog>-style_header ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = lv_value ). - ENDIF. - - ADD 1 TO lv_row_int. - LOOP AT ip_table ASSIGNING <fs_table_line>. - - ASSIGN COMPONENT <ls_field_catalog>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>. - " issue #290 Add formula support in table - IF <ls_field_catalog>-formula EQ abap_true. - IF <ls_field_catalog>-style IS NOT INITIAL. - IF <ls_field_catalog>-abap_type IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_formula = <fs_fldval> - ip_abap_type = <ls_field_catalog>-abap_type - ip_style = <ls_field_catalog>-style ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_formula = <fs_fldval> - ip_style = <ls_field_catalog>-style ). - ENDIF. - ELSE. - IF <ls_field_catalog>-abap_type IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - - ip_formula = <fs_fldval> - ip_abap_type = <ls_field_catalog>-abap_type ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_formula = <fs_fldval> ). - ENDIF. - ENDIF. - ELSE. - IF <ls_field_catalog>-style IS NOT INITIAL. - IF <ls_field_catalog>-abap_type IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = <fs_fldval> - ip_abap_type = <ls_field_catalog>-abap_type - ip_style = <ls_field_catalog>-style ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = <fs_fldval> - ip_style = <ls_field_catalog>-style ). - ENDIF. - ELSE. - IF <ls_field_catalog>-abap_type IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_abap_type = <ls_field_catalog>-abap_type - ip_value = <fs_fldval> ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = <fs_fldval> ). - ENDIF. - ENDIF. - ENDIF. - ADD 1 TO lv_row_int. - - ENDLOOP. - IF sy-subrc <> 0. "create empty row if table has no data - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = space ). - ADD 1 TO lv_row_int. - ENDIF. - -*--------------------------------------------------------------------* - " totals -*--------------------------------------------------------------------* - IF <ls_field_catalog>-totals_function IS NOT INITIAL. - lv_formula = lo_table->get_totals_formula( ip_column = <ls_field_catalog>-scrtext_l ip_function = <ls_field_catalog>-totals_function ). - IF <ls_field_catalog>-style_total IS NOT INITIAL. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_formula = lv_formula - ip_style = <ls_field_catalog>-style_total ). - ELSE. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_formula = lv_formula ). - ENDIF. - ENDIF. - - lv_row_int = ls_settings-top_left_row. - ADD 1 TO lv_column_int. - -*--------------------------------------------------------------------* - " conditional formatting -*--------------------------------------------------------------------* - IF <ls_field_catalog>-cond_style IS NOT INITIAL. - lv_first_row = ls_settings-top_left_row + 1. " +1 to exclude header - lv_last_row = ls_settings-top_left_row + lv_rows. - <ls_field_catalog>-cond_style->set_range( ip_start_column = lv_column_alpha - ip_start_row = lv_first_row - ip_stop_column = lv_column_alpha - ip_stop_row = lv_last_row ). - ENDIF. - - ENDLOOP. - -*--------------------------------------------------------------------* - " Set field catalog -*--------------------------------------------------------------------* - lo_table->fieldcat = lt_field_catalog[]. - - es_table_settings = ls_settings. - es_table_settings-bottom_right_column = lv_column_alpha. - " >> Issue #291 - IF ip_table IS INITIAL. - es_table_settings-bottom_right_row = ls_settings-top_left_row + 2. "Last rows - ELSE. - es_table_settings-bottom_right_row = ls_settings-top_left_row + lv_rows + 1. "Last rows - ENDIF. - " << Issue #291 - - endmethod. - - - - - - - *--------------------------------------------------------------------* -* issue #293 - Roberto Bianco -* - Christian Assig 2014-03-14 -* -* changes: - Calculate widths using SAPscript font metrics -* (transaction SE73) -* - Calculate the width of dates -* - Add additional width for auto filter buttons -* - Add cell padding to simulate Excel behavior -*--------------------------------------------------------------------* -METHOD calculate_cell_width. - - CONSTANTS: - lc_default_font_name TYPE zexcel_style_font_name VALUE 'Calibri', "#EC NOTEXT - lc_default_font_height TYPE tdfontsize VALUE '110', - lc_excel_cell_padding TYPE float VALUE '0.75'. - - DATA: ld_cell_value TYPE zexcel_cell_value, - ld_current_character TYPE c LENGTH 1, - ld_style_guid TYPE zexcel_cell_style, - ls_stylemapping TYPE zexcel_s_stylemapping, - lo_table_object TYPE REF TO object, - lo_table TYPE REF TO zcl_excel_table, - ld_table_top_left_column TYPE zexcel_cell_column, - ld_table_bottom_right_column TYPE zexcel_cell_column, - ld_flag_contains_auto_filter TYPE abap_bool VALUE abap_false, - ld_flag_bold TYPE abap_bool VALUE abap_false, - ld_flag_italic TYPE abap_bool VALUE abap_false, - ld_date TYPE d, - ld_date_char TYPE c LENGTH 50, - ld_font_height TYPE tdfontsize VALUE lc_default_font_height, - lt_itcfc TYPE STANDARD TABLE OF itcfc, - ld_offset TYPE i, - ld_length TYPE i, - ld_uccp TYPE i, - ls_font_metric TYPE mty_s_font_metric, - ld_width_from_font_metrics TYPE i, - ld_font_family TYPE itcfh-tdfamily, - ld_font_name TYPE zexcel_style_font_name VALUE lc_default_font_name, - lt_font_families LIKE STANDARD TABLE OF ld_font_family, - ls_font_cache TYPE mty_s_font_cache. - - FIELD-SYMBOLS: <ls_font_cache> TYPE mty_s_font_cache, - <ls_font_metric> TYPE mty_s_font_metric, - <ls_itcfc> TYPE itcfc. - - " Determine cell content and cell style - me->get_cell( EXPORTING ip_column = ip_column - ip_row = ip_row - IMPORTING ep_value = ld_cell_value - ep_guid = ld_style_guid ). - - " ABAP2XLSX uses tables to define areas containing headers and - " auto-filters. Find out if the current cell is in the header - " of one of these tables. - LOOP AT me->tables->collection INTO lo_table_object. - " Downcast: OBJECT -> ZCL_EXCEL_TABLE - lo_table ?= lo_table_object. - - " Convert column letters to corresponding integer values - ld_table_top_left_column = - zcl_excel_common=>convert_column2int( - lo_table->settings-top_left_column ). - - ld_table_bottom_right_column = - zcl_excel_common=>convert_column2int( - lo_table->settings-bottom_right_column ). - - " Is the current cell part of the table header? - IF ip_column BETWEEN ld_table_top_left_column AND - ld_table_bottom_right_column AND - ip_row EQ lo_table->settings-top_left_row. - " Current cell is part of the table header - " -> Assume that an auto filter is present and that the font is - " bold - ld_flag_contains_auto_filter = abap_true. - ld_flag_bold = abap_true. - ENDIF. - ENDLOOP. - - " If a style GUID is present, read style attributes - IF ld_style_guid IS NOT INITIAL. - TRY. - " Read style attributes - ls_stylemapping = me->excel->get_style_to_guid( ld_style_guid ). - - " If the current cell contains the default date format, - " convert the cell value to a date and calculate its length - IF ls_stylemapping-complete_style-number_format-format_code = - zcl_excel_style_number_format=>c_format_date_std. - - " Convert excel date to ABAP date - ld_date = - zcl_excel_common=>excel_string_to_date( ld_cell_value ). - - " Format ABAP date using user's formatting settings - WRITE ld_date TO ld_date_char. - - " Remember the formatted date to calculate the cell size - ld_cell_value = ld_date_char. - - ENDIF. - - " Read the font size and convert it to the font height - " used by SAPscript (multiplication by 10) - IF ls_stylemapping-complete_stylex-font-size = abap_true. - ld_font_height = ls_stylemapping-complete_style-font-size * 10. - ENDIF. - - " If set, remember the font name - IF ls_stylemapping-complete_stylex-font-name = abap_true. - ld_font_name = ls_stylemapping-complete_style-font-name. - ENDIF. - - " If set, remember whether font is bold and italic. - IF ls_stylemapping-complete_stylex-font-bold = abap_true. - ld_flag_bold = ls_stylemapping-complete_style-font-bold. - ENDIF. - - IF ls_stylemapping-complete_stylex-font-italic = abap_true. - ld_flag_italic = ls_stylemapping-complete_style-font-italic. - ENDIF. - - CATCH zcx_excel. "#EC NO_HANDLER - " Style GUID is present, but style was not found - " Continue with default values - - ENDTRY. - ENDIF. - - " Check if the same font (font name and font attributes) was already - " used before - READ TABLE mth_font_cache - WITH TABLE KEY - font_name = ld_font_name - font_height = ld_font_height - flag_bold = ld_flag_bold - flag_italic = ld_flag_italic - ASSIGNING <ls_font_cache>. - - IF sy-subrc <> 0. - " Font is used for the first time - " Add the font to our local font cache - ls_font_cache-font_name = ld_font_name. - ls_font_cache-font_height = ld_font_height. - ls_font_cache-flag_bold = ld_flag_bold. - ls_font_cache-flag_italic = ld_flag_italic. - INSERT ls_font_cache INTO TABLE mth_font_cache - ASSIGNING <ls_font_cache>. - - " Determine the SAPscript font family name from the Excel - " font name - SELECT tdfamily - FROM tfo01 - INTO TABLE lt_font_families - UP TO 1 ROWS - WHERE tdtext = ld_font_name - ORDER BY PRIMARY KEY. - - " Check if a matching font family was found - " Fonts can be uploaded from TTF files using transaction SE73 - IF lines( lt_font_families ) > 0. - READ TABLE lt_font_families INDEX 1 INTO ld_font_family. - - " Load font metrics (returns a table with the size of each letter - " in the font) - CALL FUNCTION 'LOAD_FONT' - EXPORTING - family = ld_font_family - height = ld_font_height - printer = 'SWIN' - bold = ld_flag_bold - italic = ld_flag_italic - TABLES - metric = lt_itcfc - EXCEPTIONS - font_family = 1 - codepage = 2 - device_type = 3 - OTHERS = 4. - IF sy-subrc <> 0. - CLEAR lt_itcfc. - ENDIF. - - " For faster access, convert each character number to the actual - " character, and store the characters and their sizes in a hash - " table - LOOP AT lt_itcfc ASSIGNING <ls_itcfc>. - ld_uccp = <ls_itcfc>-cpcharno. - ls_font_metric-char = - cl_abap_conv_in_ce=>uccpi( ld_uccp ). - ls_font_metric-char_width = <ls_itcfc>-tdcwidths. - INSERT ls_font_metric - INTO TABLE <ls_font_cache>-th_font_metrics. - ENDLOOP. - - ENDIF. - ENDIF. - - " Calculate the cell width - " If available, use font metrics - IF lines( <ls_font_cache>-th_font_metrics ) = 0. - " Font metrics are not available - " -> Calculate the cell width using only the font size - ld_length = strlen( ld_cell_value ). - ep_width = ld_length * ld_font_height / lc_default_font_height + lc_excel_cell_padding. - - ELSE. - " Font metrics are available - - " Calculate the size of the text by adding the sizes of each - " letter - ld_length = strlen( ld_cell_value ). - DO ld_length TIMES. - " Subtract 1, because the first character is at offset 0 - ld_offset = sy-index - 1. - - " Read the current character from the cell value - ld_current_character = ld_cell_value+ld_offset(1). - - " Look up the size of the current letter - READ TABLE <ls_font_cache>-th_font_metrics - WITH TABLE KEY char = ld_current_character - ASSIGNING <ls_font_metric>. - IF sy-subrc = 0. - " The size of the letter is known - " -> Add the actual size of the letter - ADD <ls_font_metric>-char_width TO ld_width_from_font_metrics. - ELSE. - " The size of the letter is unknown - " -> Add the font height as the default letter size - ADD ld_font_height TO ld_width_from_font_metrics. - ENDIF. - ENDDO. - - " Add cell padding (Excel makes columns a bit wider than the space - " that is needed for the text itself) and convert unit - " (division by 100) - ep_width = ld_width_from_font_metrics / 100 + lc_excel_cell_padding. - ENDIF. - - " If the current cell contains an auto filter, make it a bit wider. - " The size used by the auto filter button does not depend on the font - " size. - IF ld_flag_contains_auto_filter = abap_true. - ADD 2 TO ep_width. - ENDIF. - -ENDMETHOD. - - - - method CALCULATE_COLUMN_WIDTHS. - TYPES: - BEGIN OF t_auto_size, - col_index TYPE int4, - width TYPE float, - END OF t_auto_size. - TYPES: tt_auto_size TYPE TABLE OF t_auto_size. - - DATA: column_dimensions TYPE zexcel_t_worksheet_columndime. - DATA: column_dimension TYPE REF TO zcl_excel_worksheet_columndime. - - DATA: auto_size TYPE flag. - DATA: auto_sizes TYPE tt_auto_size. -* DATA: col_alpha TYPE zexcel_cell_column_alpha." issue #155 - less restrictive typing for ip_column - DATA: cell_value TYPE zexcel_cell_value. - DATA: cell_style TYPE REF TO zcl_excel_style. - DATA: count TYPE int4. - DATA: highest_row TYPE int4. - DATA: width TYPE float. - - FIELD-SYMBOLS: <column_dimension> LIKE LINE OF column_dimensions. - FIELD-SYMBOLS: <auto_size> LIKE LINE OF auto_sizes. - - column_dimensions[] = me->get_column_dimensions( ). - LOOP AT column_dimensions ASSIGNING <column_dimension>. - auto_size = <column_dimension>-column_dimension->get_auto_size( ). - IF auto_size = abap_true. - APPEND INITIAL LINE TO auto_sizes ASSIGNING <auto_size>. - <auto_size>-col_index = <column_dimension>-column_dimension->get_column_index( ). - <auto_size>-width = -1. - ENDIF. - ENDLOOP. - - " There is only something to do if there are some auto-size columns - IF NOT auto_sizes IS INITIAL. - highest_row = me->get_highest_row( ). - LOOP AT auto_sizes ASSIGNING <auto_size>. -* col_alpha = zcl_excel_common=>convert_column2alpha( <auto_size>-col_index )." issue #155 - less restrictive typing for ip_column - count = 1. - WHILE count <= highest_row. -* Do not check merged cells - IF is_cell_merged( - ip_column = <auto_size>-col_index - ip_row = count ) = abap_false. -* Start of change # issue 139 - Dateretention of cellstyles -* IF cell_style IS BOUND. -* CREATE OBJECT cell_style. -* ENDIF. -* me->get_cell( -* EXPORTING -* ip_column = col_alpha " Cell Column -* ip_row = count " Cell Row -* IMPORTING -* ep_value = cell_value " Cell Value -* ep_style = cell_style " Request Cell Style as well -* ). -* " For an easy start we just take the number of characters as the width -* width = strlen( cell_value ). -* " Addition to solve issue #120, contribution by Stefan Schmöcker -* " Calculate width using Font Size and Font Type -* IF cell_style IS BOUND -* AND cell_style->font IS BOUND. -* width = cell_style->font->calculate_text_width( cell_value ). -* ENDIF. -* width = calculate_cell_width( ip_column = col_alpha " issue #155 - less restrictive typing for ip_column - width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column - ip_row = count ). -* End of change # issue 139 - Dateretention of cellstyles - IF width > <auto_size>-width. - <auto_size>-width = width. - ENDIF. - ENDIF. - count = count + 1. - ENDWHILE. -* column_dimension = me->get_column_dimension( col_alpha ). " issue #155 - less restrictive typing for ip_column - column_dimension = me->get_column_dimension( <auto_size>-col_index ). " issue #155 - less restrictive typing for ip_column - column_dimension->set_width( <auto_size>-width ). - ENDLOOP. - ENDIF. - - endmethod. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - METHOD change_cell_style. - " issue # 139 - DATA: stylemapping TYPE zexcel_s_stylemapping, - - complete_style TYPE zexcel_s_cstyle_complete, - complete_stylex TYPE zexcel_s_cstylex_complete, - - borderx TYPE zexcel_s_cstylex_border, - l_guid TYPE zexcel_cell_style. "issue # 177 - -* We have a lot of parameters. Use some macros to make the coding more structured - - DEFINE clear_initial_colorxfields. - if &1-rgb is initial. - clear &2-rgb. - endif. - if &1-indexed is initial. - clear &2-indexed. - endif. - if &1-theme is initial. - clear &2-theme. - endif. - if &1-tint is initial. - clear &2-tint. - endif. - END-OF-DEFINITION. - - DEFINE move_supplied_borders. - if ip_&1 is supplied. " only act if parameter was supplied - if ip_x&1 is supplied. " - borderx = ip_x&1. " use supplied x-parameter - else. - clear borderx with 'X'. -* clear in a way that would be expected to work easily - if ip_&1-border_style is initial. - clear borderx-border_style. - endif. - clear_initial_colorxfields ip_&1-border_color borderx-border_color. - endif. - move-corresponding ip_&1 to complete_style-&2. - move-corresponding borderx to complete_stylex-&2. - endif. - END-OF-DEFINITION. - -* First get current stylsettings - TRY. - me->get_cell( EXPORTING ip_column = ip_column " Cell Column - ip_row = ip_row " Cell Row - IMPORTING ep_guid = l_guid )." Cell Value ). "issue # 177 - - - stylemapping = me->excel->get_style_to_guid( l_guid ). "issue # 177 - complete_style = stylemapping-complete_style. - complete_stylex = stylemapping-complete_stylex. - CATCH zcx_excel. -* Error --> use submitted style - ENDTRY. - -* move_supplied_multistyles: complete. - IF ip_complete IS SUPPLIED. - IF ip_xcomplete IS NOT SUPPLIED. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Complete styleinfo has to be supplied with corresponding X-field'. - ENDIF. - MOVE-CORRESPONDING ip_complete TO complete_style. - MOVE-CORRESPONDING ip_xcomplete TO complete_stylex. - ENDIF. - - - - IF ip_font IS SUPPLIED. - DATA: fontx LIKE ip_xfont. - IF ip_xfont IS SUPPLIED. - fontx = ip_xfont. - ELSE. -* Only supplied values should be used - exception: Flags bold and italic strikethrough underline - MOVE 'X' TO: fontx-bold, - fontx-italic, - fontx-strikethrough, - fontx-underline_mode. - CLEAR fontx-color WITH 'X'. - clear_initial_colorxfields ip_font-color fontx-color. - IF ip_font-family IS NOT INITIAL. - fontx-family = 'X'. - ENDIF. - IF ip_font-name IS NOT INITIAL. - fontx-name = 'X'. - ENDIF. - IF ip_font-scheme IS NOT INITIAL. - fontx-scheme = 'X'. - ENDIF. - IF ip_font-size IS NOT INITIAL. - fontx-size = 'X'. - ENDIF. - IF ip_font-underline_mode IS NOT INITIAL. - fontx-underline_mode = 'X'. - ENDIF. - ENDIF. - MOVE-CORRESPONDING ip_font TO complete_style-font. - MOVE-CORRESPONDING fontx TO complete_stylex-font. -* Correction for undeline mode - ENDIF. - - IF ip_fill IS SUPPLIED. - DATA: fillx LIKE ip_xfill. - IF ip_xfill IS SUPPLIED. - fillx = ip_xfill. - ELSE. - CLEAR fillx WITH 'X'. - IF ip_fill-filltype IS INITIAL. - CLEAR fillx-filltype. - ENDIF. - clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor. - clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor. - - ENDIF. - MOVE-CORRESPONDING ip_fill TO complete_style-fill. - MOVE-CORRESPONDING fillx TO complete_stylex-fill. - ENDIF. - - - IF ip_borders IS SUPPLIED. - DATA: bordersx LIKE ip_xborders. - IF ip_xborders IS SUPPLIED. - bordersx = ip_xborders. - ELSE. - CLEAR bordersx WITH 'X'. - IF ip_borders-allborders-border_style IS INITIAL. - CLEAR bordersx-allborders-border_style. - ENDIF. - IF ip_borders-diagonal-border_style IS INITIAL. - CLEAR bordersx-diagonal-border_style. - ENDIF. - IF ip_borders-down-border_style IS INITIAL. - CLEAR bordersx-down-border_style. - ENDIF. - IF ip_borders-left-border_style IS INITIAL. - CLEAR bordersx-left-border_style. - ENDIF. - IF ip_borders-right-border_style IS INITIAL. - CLEAR bordersx-right-border_style. - ENDIF. - IF ip_borders-top-border_style IS INITIAL. - CLEAR bordersx-top-border_style. - ENDIF. - clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color. - clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color. - clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color. - clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color. - clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color. - clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color. - - ENDIF. - MOVE-CORRESPONDING ip_borders TO complete_style-borders. - MOVE-CORRESPONDING bordersx TO complete_stylex-borders. - ENDIF. - - IF ip_alignment IS SUPPLIED. - DATA: alignmentx LIKE ip_xalignment. - IF ip_xalignment IS SUPPLIED. - alignmentx = ip_xalignment. - ELSE. - CLEAR alignmentx WITH 'X'. - IF ip_alignment-horizontal IS INITIAL. - CLEAR alignmentx-horizontal. - ENDIF. - IF ip_alignment-vertical IS INITIAL. - CLEAR alignmentx-vertical. - ENDIF. - ENDIF. - MOVE-CORRESPONDING ip_alignment TO complete_style-alignment. - MOVE-CORRESPONDING alignmentx TO complete_stylex-alignment. - ENDIF. - - IF ip_protection IS SUPPLIED. - MOVE-CORRESPONDING ip_protection TO complete_style-protection. - IF ip_xprotection IS SUPPLIED. - MOVE-CORRESPONDING ip_xprotection TO complete_stylex-protection. - ELSE. - IF ip_protection-hidden IS NOT INITIAL. - complete_stylex-protection-hidden = 'X'. - ENDIF. - IF ip_protection-locked IS NOT INITIAL. - complete_stylex-protection-locked = 'X'. - ENDIF. - ENDIF. - ENDIF. - - - move_supplied_borders : borders_allborders borders-allborders, - borders_diagonal borders-diagonal , - borders_down borders-down , - borders_left borders-left , - borders_right borders-right , - borders_top borders-top . - - DEFINE move_supplied_singlestyles. - if ip_&1 is supplied. - complete_style-&2 = ip_&1. - complete_stylex-&2 = 'X'. - endif. - END-OF-DEFINITION. - - move_supplied_singlestyles: number_format_format_code number_format-format_code, - font_bold font-bold, - font_color font-color, - font_color_rgb font-color-rgb, - font_color_indexed font-color-indexed, - font_color_theme font-color-theme, - font_color_tint font-color-tint, - - font_family font-family, - font_italic font-italic, - font_name font-name, - font_scheme font-scheme, - font_size font-size, - font_strikethrough font-strikethrough, - font_underline font-underline, - font_underline_mode font-underline_mode, - fill_filltype fill-filltype, - fill_rotation fill-rotation, - fill_fgcolor fill-fgcolor, - fill_fgcolor_rgb fill-fgcolor-rgb, - fill_fgcolor_indexed fill-fgcolor-indexed, - fill_fgcolor_theme fill-fgcolor-theme, - fill_fgcolor_tint fill-fgcolor-tint, - - fill_bgcolor fill-bgcolor, - fill_bgcolor_rgb fill-bgcolor-rgb, - fill_bgcolor_indexed fill-bgcolor-indexed, - fill_bgcolor_theme fill-bgcolor-theme, - fill_bgcolor_tint fill-bgcolor-tint, - - fill_gradtype_type fill-gradtype-TYPE, - fill_gradtype_degree fill-gradtype-DEGREE, - fill_gradtype_bottom fill-gradtype-BOTTOM, - fill_gradtype_left fill-gradtype-LEFT, - fill_gradtype_top fill-gradtype-TOP, - fill_gradtype_right fill-gradtype-RIGHT, - fill_gradtype_position1 fill-gradtype-POSITION1, - fill_gradtype_position2 fill-gradtype-POSITION2, - fill_gradtype_position3 fill-gradtype-POSITION3, - - - - borders_diagonal_mode borders-diagonal_mode, - alignment_horizontal alignment-horizontal, - alignment_vertical alignment-vertical, - alignment_textrotation alignment-textrotation, - alignment_wraptext alignment-wraptext, - alignment_shrinktofit alignment-shrinktofit, - alignment_indent alignment-indent, - protection_hidden protection-hidden, - protection_locked protection-locked, - - borders_allborders_style borders-allborders-border_style, - borders_allborders_color borders-allborders-border_color, - borders_allbo_color_rgb borders-allborders-border_color-rgb, - borders_allbo_color_indexed borders-allborders-border_color-indexed, - borders_allbo_color_theme borders-allborders-border_color-theme, - borders_allbo_color_tint borders-allborders-border_color-tint, - - borders_diagonal_style borders-diagonal-border_style, - borders_diagonal_color borders-diagonal-border_color, - borders_diagonal_color_rgb borders-diagonal-border_color-rgb, - borders_diagonal_color_inde borders-diagonal-border_color-indexed, - borders_diagonal_color_them borders-diagonal-border_color-theme, - borders_diagonal_color_tint borders-diagonal-border_color-tint, - - borders_down_style borders-down-border_style, - borders_down_color borders-down-border_color, - borders_down_color_rgb borders-down-border_color-rgb, - borders_down_color_indexed borders-down-border_color-indexed, - borders_down_color_theme borders-down-border_color-theme, - borders_down_color_tint borders-down-border_color-tint, - - borders_left_style borders-left-border_style, - borders_left_color borders-left-border_color, - borders_left_color_rgb borders-left-border_color-rgb, - borders_left_color_indexed borders-left-border_color-indexed, - borders_left_color_theme borders-left-border_color-theme, - borders_left_color_tint borders-left-border_color-tint, - - borders_right_style borders-right-border_style, - borders_right_color borders-right-border_color, - borders_right_color_rgb borders-right-border_color-rgb, - borders_right_color_indexed borders-right-border_color-indexed, - borders_right_color_theme borders-right-border_color-theme, - borders_right_color_tint borders-right-border_color-tint, - - borders_top_style borders-top-border_style, - borders_top_color borders-top-border_color, - borders_top_color_rgb borders-top-border_color-rgb, - borders_top_color_indexed borders-top-border_color-indexed, - borders_top_color_theme borders-top-border_color-theme, - borders_top_color_tint borders-top-border_color-tint. - - -* Now we have a completly filled styles. -* This can be used to get the guid -* Return guid if requested. Might be used if copy&paste of styles is requested - ep_guid = me->excel->get_static_cellstyle_guid( ip_cstyle_complete = complete_style - ip_cstylex_complete = complete_stylex ). - me->set_cell_style( ip_column = ip_column - ip_row = ip_row - ip_style = ep_guid ). - -ENDMETHOD. - - - - - - METHOD constructor. - DATA: lv_title TYPE zexcel_sheet_title. - - me->excel = ip_excel. - -* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases -* IMPORTING -* ev_guid_16 = me->guid. - me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call - - IF ip_title IS NOT INITIAL. - lv_title = ip_title. - ELSE. -* lv_title = me->guid. " del issue #154 - Names of worksheets - lv_title = me->generate_title( ). " ins issue #154 - Names of worksheets - ENDIF. - - me->set_title( ip_title = lv_title ). - - CREATE OBJECT sheet_setup. - CREATE OBJECT conditional_styles. - CREATE OBJECT data_validations. - CREATE OBJECT tables. - CREATE OBJECT ranges. " issue #163 - CREATE OBJECT mo_pagebreaks. - CREATE OBJECT drawings - EXPORTING - ip_type = zcl_excel_drawing=>type_image. - CREATE OBJECT charts - EXPORTING - ip_type = zcl_excel_drawing=>type_chart. - me->zif_excel_sheet_protection~initialize( ). - me->zif_excel_sheet_properties~initialize( ). - CREATE OBJECT hyperlinks. - -* initialize active cell coordinates - active_cell-cell_row = 1. - active_cell-cell_column = 1. - -* inizialize dimension range - lower_cell-cell_row = 1. - lower_cell-cell_column = 1. - upper_cell-cell_row = 1. - upper_cell-cell_column = 1. - -ENDMETHOD. - - - - - METHOD delete_merge. - - FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells. - DATA: is_merged TYPE abap_bool. -*--------------------------------------------------------------------* -* If cell information is passed delete merge including this cell, -* otherwise delete all merges -*--------------------------------------------------------------------* - IF ip_cell_column IS INITIAL - OR ip_cell_row IS INITIAL. - CLEAR me->mt_merged_cells. - ELSE. - LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>. - - is_merged = me->is_cell_merged( ip_column = ip_cell_column - ip_row = ip_cell_row ). - IF is_merged = abap_true. - DELETE me->mt_merged_cells. " Delete this merge, that includes this cell - EXIT. - ENDIF. - - ENDLOOP. - ENDIF. - -ENDMETHOD. - - - - - - METHOD delete_row_outline. - - DELETE me->mt_row_outlines WHERE row_from = iv_row_from - AND row_to = iv_row_to. - IF sy-subrc <> 0. " didn't find outline that was to be deleted - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Row outline to be deleted does not exist'. - ENDIF. - -ENDMETHOD. - - - - - - method FREEZE_PANES. - data: lv_xsplit type i, - lv_ysplit type i. - - IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Pleas provide number of rows and/or columns to freeze'. - ENDIF. - - IF ip_num_columns IS SUPPLIED AND ip_num_columns <= 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Number of columns to freeze should be positive'. - ENDIF. - - IF ip_num_rows IS SUPPLIED AND ip_num_rows <= 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Number of rows to freeze should be positive'. - ENDIF. - - freeze_pane_cell_column = ip_num_columns + 1. - freeze_pane_cell_row = ip_num_rows + 1. - endmethod. - - - - method GENERATE_TITLE. - DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - errormessage TYPE string. - - DATA: t_titles TYPE HASHED TABLE OF zexcel_sheet_title WITH UNIQUE KEY table_line, - title TYPE zexcel_sheet_title, - sheetnumber TYPE i. - -* Get list of currently used titles - lo_worksheets_iterator = me->excel->get_worksheets_iterator( ). - WHILE lo_worksheets_iterator->has_next( ) = abap_true. - lo_worksheet ?= lo_worksheets_iterator->get_next( ). - title = lo_worksheet->get_title( ). - INSERT title INTO TABLE t_titles. - ADD 1 TO sheetnumber. - ENDWHILE. - -* Now build sheetnumber. Increase counter until we hit a number that is not used so far - ADD 1 TO sheetnumber. " Start counting with next number - DO. - title = sheetnumber. - SHIFT title LEFT DELETING LEADING space. - CONCATENATE 'Sheet'(001) title INTO ep_title. - INSERT ep_title INTO TABLE t_titles. - IF sy-subrc = 0. " Title not used so far --> take it - EXIT. - ENDIF. - - ADD 1 TO sheetnumber. - ENDDO. - endmethod. - - - - - method GET_ACTIVE_CELL. - - DATA: lv_active_column TYPE zexcel_cell_column_alpha, - lv_active_row TYPE string. - - lv_active_column = zcl_excel_common=>convert_column2alpha( active_cell-cell_column ). - lv_active_row = active_cell-cell_row. - SHIFT lv_active_row RIGHT DELETING TRAILING space. - SHIFT lv_active_row LEFT DELETING LEADING space. - CONCATENATE lv_active_column lv_active_row INTO ep_active_cell. - - endmethod. - - - - - - - - - - - method GET_CELL. - - DATA: lv_column TYPE zexcel_cell_column, - ls_sheet_content TYPE zexcel_s_cell_data. - - FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data. - - lv_column = zcl_excel_common=>convert_column2int( ip_column ). - - READ TABLE sheet_content INTO ls_sheet_content WITH TABLE KEY cell_row = ip_row - cell_column = lv_column. - - ep_rc = sy-subrc. - ep_value = ls_sheet_content-cell_value. - ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation - ep_formula = ls_sheet_content-cell_formula. - - " Addition to solve issue #120, contribution by Stefan Schmöcker - DATA: style_iterator TYPE REF TO cl_object_collection_iterator, - style TYPE REF TO zcl_excel_style. - IF ep_style IS REQUESTED. - style_iterator = me->excel->get_styles_iterator( ). - WHILE style_iterator->has_next( ) = 'X'. - style ?= style_iterator->get_next( ). - IF style->get_guid( ) = ls_sheet_content-cell_style. - ep_style = style. - EXIT. - ENDIF. - ENDWHILE. - ENDIF. - endmethod. - - - - - - method GET_COLUMN_DIMENSION. - FIELD-SYMBOLS: <fs_column_dimension> LIKE LINE OF column_dimensions. - DATA: lv_column_alpha TYPE zexcel_cell_column_alpha. " issue #155 - less restrictive typing for ip_column - - lv_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column )." issue #155 - less restrictive typing for ip_column - READ TABLE me->column_dimensions ASSIGNING <fs_column_dimension> - WITH KEY column = lv_column_alpha. " issue #155 - less restrictive typing for ip_column - - IF NOT <fs_column_dimension> IS ASSIGNED. - CREATE OBJECT r_column_dimension - EXPORTING - ip_index = lv_column_alpha " issue #155 - less restrictive typing for ip_column - ip_excel = me->excel " issue #157 - Allow style for columns - ip_worksheet = me. " issue #157 - Allow style for columns - APPEND INITIAL LINE TO me->column_dimensions ASSIGNING <fs_column_dimension>. - <fs_column_dimension>-column = lv_column_alpha. " issue #155 - less restrictive typing for ip_column - <fs_column_dimension>-column_dimension = r_column_dimension. - ELSE. - r_column_dimension = <fs_column_dimension>-column_dimension. - ENDIF. - - endmethod. - - - - method GET_COLUMN_DIMENSIONS. - r_column_dimension[] = me->column_dimensions[]. - endmethod. - - - - method GET_COND_STYLES_ITERATOR. - - eo_iterator = me->conditional_styles->get_iterator( ). - endmethod. - - - - method GET_DATA_VALIDATIONS_ITERATOR. - - eo_iterator = me->data_validations->get_iterator( ). - endmethod. - - - - method GET_DATA_VALIDATIONS_SIZE. - ep_size = me->data_validations->size( ). - endmethod. - - - - method GET_DEFAULT_COLUMN_DIMENSION. - IF me->default_column_dimension IS NOT BOUND. - CREATE OBJECT me->default_column_dimension - EXPORTING - ip_index = 'A' " ???? - ip_worksheet = me - ip_excel = me->excel. - ENDIF. - - r_column_dimension = me->default_column_dimension. - endmethod. - - - - method GET_DEFAULT_EXCEL_DATE_FORMAT. - CONSTANTS: c_lang_e TYPE lang VALUE 'E'. - - IF default_excel_date_format IS NOT INITIAL. - ep_default_excel_date_format = default_excel_date_format. - RETURN. - ENDIF. - - "try to get defaults - TRY. - cl_abap_datfm=>get_date_format_des( EXPORTING im_langu = c_lang_e - IMPORTING ex_dateformat = default_excel_date_format ). - CATCH cx_abap_datfm_format_unknown. - - ENDTRY. - - " and fallback to fixed format - IF default_excel_date_format IS INITIAL. - default_excel_date_format = zcl_excel_style_number_format=>c_format_date_ddmmyyyydot. - ENDIF. - - ep_default_excel_date_format = default_excel_date_format. - endmethod. - - - - method GET_DEFAULT_EXCEL_TIME_FORMAT. - DATA: l_timefm TYPE xutimefm. - - IF default_excel_time_format IS NOT INITIAL. - ep_default_excel_time_format = default_excel_time_format. - RETURN. - ENDIF. - -* Let's get default - l_timefm = cl_abap_timefm=>get_environment_timefm( ). - CASE l_timefm. - WHEN 0. -*0 24 Hour Format (Example: 12:05:10) - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6. - WHEN 1. -*1 12 Hour Format (Example: 12:05:10 PM) - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. - WHEN 2. -*2 12 Hour Format (Example: 12:05:10 pm) for now all the same. no chnage upper lower - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. - WHEN 3. -*3 Hours from 0 to 11 (Example: 00:05:10 PM) for now all the same. no chnage upper lower - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. - WHEN 4. -*4 Hours from 0 to 11 (Example: 00:05:10 pm) for now all the same. no chnage upper lower - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. - WHEN OTHERS. - " and fallback to fixed format - default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6. - ENDCASE. - - ep_default_excel_time_format = default_excel_time_format. - endmethod. - - - - method GET_DEFAULT_ROW_DIMENSION. - IF me->default_row_dimension IS NOT BOUND. - CREATE OBJECT me->default_row_dimension. - ENDIF. - - r_row_dimension = me->default_row_dimension. - endmethod. - - - - - method GET_DIMENSION_RANGE. - - me->update_dimension_range( ). - IF upper_cell EQ lower_cell. "only one cell - " Worksheet not filled -* IF upper_cell-cell_coords = '0'. - IF upper_cell-cell_coords IS INITIAL. - ep_dimension_range = 'A1'. - ELSE. - ep_dimension_range = upper_cell-cell_coords. - ENDIF. - ELSE. - CONCATENATE upper_cell-cell_coords ':' lower_cell-cell_coords INTO ep_dimension_range. - ENDIF. - - endmethod. - - - - - method GET_DRAWINGS. - - DATA: lo_drawing TYPE REF TO zcl_excel_drawing, - lo_iterator TYPE REF TO cl_object_collection_iterator. - - CASE ip_type. - WHEN zcl_excel_drawing=>type_image. - r_drawings = drawings. - WHEN zcl_excel_drawing=>type_chart. - r_drawings = charts. - WHEN space. - CREATE OBJECT r_drawings - EXPORTING - ip_type = ''. - - lo_iterator = drawings->get_iterator( ). - WHILE lo_iterator->has_next( ) = abap_true. - lo_drawing ?= lo_iterator->get_next( ). - r_drawings->include( lo_drawing ). - ENDWHILE. - lo_iterator = charts->get_iterator( ). - WHILE lo_iterator->has_next( ) = abap_true. - lo_drawing ?= lo_iterator->get_next( ). - r_drawings->include( lo_drawing ). - ENDWHILE. - WHEN OTHERS. - ENDCASE. - endmethod. - - - - - method GET_DRAWINGS_ITERATOR. - CASE ip_type. - WHEN zcl_excel_drawing=>type_image. - eo_iterator = drawings->get_iterator( ). - WHEN zcl_excel_drawing=>type_chart. - eo_iterator = charts->get_iterator( ). - ENDCASE. - endmethod. - - - - - method GET_FREEZE_CELL. - ep_row = me->freeze_pane_cell_row. - ep_column = me->freeze_pane_cell_column. - endmethod. - - - - METHOD get_guid. - - ep_guid = me->guid. - -ENDMETHOD. - - - - - method GET_HIGHEST_COLUMN. - me->update_dimension_range( ). - r_highest_column = me->lower_cell-cell_column. - endmethod. - - - - - METHOD get_highest_row. - me->update_dimension_range( ). - r_highest_row = me->lower_cell-cell_row. -ENDMETHOD. - - - - method GET_HYPERLINKS_ITERATOR. - eo_iterator = hyperlinks->get_iterator( ). - endmethod. - - - - method GET_HYPERLINKS_SIZE. - ep_size = hyperlinks->size( ). - endmethod. - - - - - METHOD get_merge. - - FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells. - - DATA: lv_col_from TYPE string, - lv_col_to TYPE string, - lv_row_from TYPE string, - lv_row_to TYPE string, - lv_merge_range TYPE string. - - LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>. - - lv_col_from = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_from ). - lv_col_to = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_to ). - lv_row_from = <ls_merged_cell>-row_from. - lv_row_to = <ls_merged_cell>-row_to . - CONCATENATE lv_col_from lv_row_from ':' lv_col_to lv_row_to - INTO lv_merge_range. - CONDENSE lv_merge_range NO-GAPS. - APPEND lv_merge_range TO merge_range. - - ENDLOOP. - -ENDMETHOD. - - - - - method GET_PAGEBREAKS. - ro_pagebreaks = mo_pagebreaks. -endmethod. - - - - method GET_RANGES_ITERATOR. - - eo_iterator = me->ranges->get_iterator( ). - - endmethod. - - - - - METHOD GET_ROW_DIMENSION. - - FIELD-SYMBOLS: <ls_row_dimension> LIKE LINE OF me->row_dimensions. - - DATA: ls_row_dimension LIKE LINE OF me->row_dimensions. - - READ TABLE me->row_dimensions ASSIGNING <ls_row_dimension> - WITH TABLE KEY row = ip_row. - - IF NOT <ls_row_dimension> IS ASSIGNED. - CREATE OBJECT r_row_dimension - EXPORTING - ip_index = ip_row. - ls_row_dimension-row = ip_row. - ls_row_dimension-row_dimension = r_row_dimension. - INSERT ls_row_dimension INTO TABLE me->row_dimensions. - ELSE. - r_row_dimension = <ls_row_dimension>-row_dimension. - ENDIF. - -ENDMETHOD. - - - - METHOD get_row_dimensions. - - r_row_dimension[] = me->row_dimensions[]. - -ENDMETHOD. - - - - METHOD get_row_outlines. - - rt_row_outlines = me->mt_row_outlines. - -ENDMETHOD. - - - - method GET_TABCOLOR. - ev_tabcolor = me->tabcolor. - endmethod. - - - - method GET_TABLES_ITERATOR. - eo_iterator = tables->if_object_collection~get_iterator( ). - endmethod. - - - - method GET_TABLES_SIZE. - ep_size = tables->if_object_collection~size( ). - endmethod. - - - - - method GET_TITLE. - DATA lv_value TYPE string. - IF ip_escaped EQ abap_true. - lv_value = me->title. - ep_title = zcl_excel_common=>escape_string( lv_value ). - ELSE. - ep_title = me->title. - ENDIF. - endmethod. - - - - - - METHOD get_value_type. - DATA: lo_addit TYPE REF TO cl_abap_elemdescr, - ls_dfies TYPE dfies, - l_function TYPE funcname, - l_value(50) TYPE c. - - ep_value = ip_value. - ep_value_type = cl_abap_typedescr=>typekind_string. " Thats our default if something goes wrong. - - TRY. - lo_addit ?= cl_abap_typedescr=>describe_by_data( ip_value ). - CATCH cx_sy_move_cast_error. - CLEAR lo_addit. - ENDTRY. - IF lo_addit IS BOUND. - lo_addit->get_ddic_field( RECEIVING p_flddescr = ls_dfies - EXCEPTIONS not_found = 1 - no_ddic_type = 2 - OTHERS = 3 ) . - IF sy-subrc = 0. - ep_value_type = ls_dfies-inttype. - - IF ls_dfies-convexit IS NOT INITIAL. -* We need to convert with output conversion function - CONCATENATE 'CONVERSION_EXIT_' ls_dfies-convexit '_OUTPUT' INTO l_function. - SELECT SINGLE funcname INTO l_function - FROM tfdir - WHERE funcname = l_function. - IF sy-subrc = 0. - CALL FUNCTION l_function - EXPORTING - input = ip_value - IMPORTING -* LONG_TEXT = - output = l_value -* SHORT_TEXT = - EXCEPTIONS - OTHERS = 1. - IF sy-subrc <> 0. -* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO -* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. - ELSE. - TRY. - ep_value = l_value. - CATCH cx_root. - ep_value = ip_value. - ENDTRY. - ENDIF. - ENDIF. - ENDIF. - ELSE. - ep_value_type = lo_addit->get_data_type_kind( ip_value ). - ENDIF. - ENDIF. - -ENDMETHOD. - - - - - - - METHOD is_cell_merged. - - DATA: lv_column TYPE i. - - FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells. - - lv_column = zcl_excel_common=>convert_column2int( ip_column ). - - rp_is_merged = abap_false. " Assume not in merged area - - LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>. - - IF <ls_merged_cell>-col_from <= lv_column - AND <ls_merged_cell>-col_to >= lv_column - AND <ls_merged_cell>-row_from <= ip_row - AND <ls_merged_cell>-row_to >= ip_row. - rp_is_merged = abap_true. " until we are proven different - RETURN. - ENDIF. - - ENDLOOP. - -ENDMETHOD. - - - method PRINT_TITLE_SET_RANGE. -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns -* - Stefan Schmoecker, 2012-12-02 -*--------------------------------------------------------------------* - - - DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator, - lo_range TYPE REF TO zcl_excel_range, - lv_repeat_range_sheetname TYPE string, - lv_repeat_range_col TYPE string, - lv_row_char_from TYPE char10, - lv_row_char_to TYPE char10, - lv_repeat_range_row TYPE string, - lv_repeat_range TYPE string. - - -*--------------------------------------------------------------------* -* Get range that represents printarea -* if non-existant, create it -*--------------------------------------------------------------------* - lo_range_iterator = me->get_ranges_iterator( ). - WHILE lo_range_iterator->has_next( ) = abap_true. - - lo_range ?= lo_range_iterator->get_next( ). - IF lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name. - EXIT. " Found it - ENDIF. - CLEAR lo_range. - - ENDWHILE. - - - IF me->print_title_col_from IS INITIAL AND - me->print_title_row_from IS INITIAL. -*--------------------------------------------------------------------* -* No print titles are present, -*--------------------------------------------------------------------* - IF lo_range IS BOUND. - me->ranges->remove( lo_range ). - ENDIF. - ELSE. -*--------------------------------------------------------------------* -* Print titles are present, -*--------------------------------------------------------------------* - IF lo_range IS NOT BOUND. - lo_range = me->add_new_range( ). - lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name. - ENDIF. - - lv_repeat_range_sheetname = me->get_title( ). - lv_repeat_range_sheetname = zcl_excel_common=>escape_string( lv_repeat_range_sheetname ). - -*--------------------------------------------------------------------* -* Repeat-columns -*--------------------------------------------------------------------* - IF me->print_title_col_from IS NOT INITIAL. - CONCATENATE lv_repeat_range_sheetname - '!$' me->print_title_col_from - ':$' me->print_title_col_to - INTO lv_repeat_range_col. - ENDIF. - -*--------------------------------------------------------------------* -* Repeat-rows -*--------------------------------------------------------------------* - IF me->print_title_row_from IS NOT INITIAL. - lv_row_char_from = me->print_title_row_from. - lv_row_char_to = me->print_title_row_to. - CONCATENATE '!$' lv_row_char_from - ':$' lv_row_char_to - INTO lv_repeat_range_row. - CONDENSE lv_repeat_range_row NO-GAPS. - CONCATENATE lv_repeat_range_sheetname - lv_repeat_range_row - INTO lv_repeat_range_row. - ENDIF. - -*--------------------------------------------------------------------* -* Concatenate repeat-rows and columns -*--------------------------------------------------------------------* - IF lv_repeat_range_col IS INITIAL. - lv_repeat_range = lv_repeat_range_row. - ELSEIF lv_repeat_range_row IS INITIAL. - lv_repeat_range = lv_repeat_range_col. - ELSE. - CONCATENATE lv_repeat_range_col lv_repeat_range_row - INTO lv_repeat_range SEPARATED BY ','. - ENDIF. - - - lo_range->set_range_value( lv_repeat_range ). - ENDIF. - - - - endmethod. - - - - - - - - - - - - method SET_CELL. - - DATA: lv_column TYPE zexcel_cell_column, - ls_sheet_content TYPE zexcel_s_cell_data, - lv_row_alpha TYPE string, - lv_col_alpha TYPE zexcel_cell_column_alpha, - lv_value TYPE zexcel_cell_value, - lv_data_type TYPE zexcel_cell_data_type, - lv_value_type TYPE abap_typekind, - lo_style TYPE REF TO zcl_excel_style, - lv_style_guid TYPE zexcel_cell_style, - lo_addit TYPE REF TO cl_abap_elemdescr, - lo_value TYPE REF TO data, - lo_value_new TYPE REF TO data. - - FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data, - <fs_numeric> TYPE numeric, - <fs_date> TYPE d, - <fs_time> TYPE t, - <fs_value> TYPE simple. - - IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Please provide the value or formula'. - ENDIF. - -* Begin of change issue #152 - don't touch exisiting style if only value is passed -* lv_style_guid = ip_style. - lv_column = zcl_excel_common=>convert_column2int( ip_column ). - READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH TABLE KEY cell_row = ip_row " Changed to access via table key , Stefan Schmöcker, 2013-08-03 - cell_column = lv_column. - IF sy-subrc = 0. - IF ip_style IS INITIAL. - " If no style is provided as method-parameter and cell is found use cell's current style - lv_style_guid = <fs_sheet_content>-cell_style. - ELSE. - " Style provided as method-parameter --> use this - lv_style_guid = ip_style. - ENDIF. - ELSE. - " No cell found --> use supplied style even if empty - lv_style_guid = ip_style. - ENDIF. -* End of change issue #152 - don't touch exisiting style if only value is passed - - IF ip_value IS SUPPLIED. - "if data type is passed just write the value. Otherwise map abap type to excel and perform conversion - "IP_DATA_TYPE is passed by excel reader so source types are preserved -*First we get reference into local var. - CREATE DATA lo_value LIKE ip_value. - ASSIGN lo_value->* TO <fs_value>. - <fs_value> = ip_value. - IF ip_data_type IS SUPPLIED. - IF ip_abap_type IS NOT SUPPLIED. - get_value_type( EXPORTING ip_value = ip_value - IMPORTING ep_value = <fs_value> ) . - ENDIF. - lv_value = <fs_value>. - lv_data_type = ip_data_type. - ELSE. - IF ip_abap_type IS SUPPLIED. - lv_value_type = ip_abap_type. - ELSE. - get_value_type( EXPORTING ip_value = ip_value - IMPORTING ep_value = <fs_value> - ep_value_type = lv_value_type ). - ENDIF. - CASE lv_value_type. - WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2. - lo_addit = cl_abap_elemdescr=>get_i( ). - CREATE DATA lo_value_new TYPE HANDLE lo_addit. - ASSIGN lo_value_new->* TO <fs_numeric>. - IF sy-subrc = 0. - <fs_numeric> = <fs_value>. - lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ). - ENDIF. - - WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed. - lo_addit = cl_abap_elemdescr=>get_f( ). - CREATE DATA lo_value_new TYPE HANDLE lo_addit. - ASSIGN lo_value_new->* TO <fs_numeric>. - IF sy-subrc = 0. - <fs_numeric> = <fs_value>. - lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ). - ENDIF. - - WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num OR - cl_abap_typedescr=>typekind_hex. - lv_value = <fs_value>. - lv_data_type = 's'. - - WHEN cl_abap_typedescr=>typekind_date. - lo_addit = cl_abap_elemdescr=>get_d( ). - CREATE DATA lo_value_new TYPE HANDLE lo_addit. - ASSIGN lo_value_new->* TO <fs_date>. - IF sy-subrc = 0. - <fs_date> = <fs_value>. - lv_value = zcl_excel_common=>date_to_excel_string( ip_value = <fs_date> ) . - ENDIF. -* Begin of change issue #152 - don't touch exisiting style if only value is passed -* Moved to end of routine - apply date-format even if other styleinformation is passed -* IF ip_style IS NOT SUPPLIED. "get default date format in case parameter is initial -* lo_style = excel->add_new_style( ). -* lo_style->number_format->format_code = get_default_excel_date_format( ). -* lv_style_guid = lo_style->get_guid( ). -* ENDIF. -* End of change issue #152 - don't touch exisiting style if only value is passed - - WHEN cl_abap_typedescr=>typekind_time. - lo_addit = cl_abap_elemdescr=>get_t( ). - CREATE DATA lo_value_new TYPE HANDLE lo_addit. - ASSIGN lo_value_new->* TO <fs_time>. - IF sy-subrc = 0. - <fs_time> = <fs_value>. - lv_value = zcl_excel_common=>time_to_excel_string( ip_value = <fs_time> ). - ENDIF. -* Begin of change issue #152 - don't touch exisiting style if only value is passed -* Moved to end of routine - apply time-format even if other styleinformation is passed -* IF ip_style IS NOT SUPPLIED. "get default time format for user in case parameter is initial -* lo_style = excel->add_new_style( ). -* lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_date_time6. -* lv_style_guid = lo_style->get_guid( ). -* ENDIF. -* End of change issue #152 - don't touch exisiting style if only value is passed - - WHEN OTHERS. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Invalid data type of input value'. - ENDCASE. - ENDIF. - - ENDIF. - - IF ip_hyperlink IS BOUND. - ip_hyperlink->set_cell_reference( ip_column = ip_column - ip_row = ip_row ). - me->hyperlinks->add( ip_hyperlink ). - ENDIF. - -* Begin of change issue #152 - don't touch exisiting style if only value is passed -* Read table moved up, so that current style may be evaluated -* lv_column = zcl_excel_common=>convert_column2int( ip_column ). - -* READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row -* cell_column = lv_column. -* -* IF sy-subrc EQ 0. - IF <fs_sheet_content> IS ASSIGNED. -* End of change issue #152 - don't touch exisiting style if only value is passed - <fs_sheet_content>-cell_value = lv_value. - <fs_sheet_content>-cell_formula = ip_formula. - <fs_sheet_content>-cell_style = lv_style_guid. - <fs_sheet_content>-data_type = lv_data_type. - ELSE. - ls_sheet_content-cell_row = ip_row. - ls_sheet_content-cell_column = lv_column. - ls_sheet_content-cell_value = lv_value. - ls_sheet_content-cell_formula = ip_formula. - ls_sheet_content-cell_style = lv_style_guid. - ls_sheet_content-data_type = lv_data_type. - lv_row_alpha = ip_row. -* SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster -* SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster - CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster - lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column - CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column - INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data -* APPEND ls_sheet_content TO sheet_content. -* SORT sheet_content BY cell_row cell_column. - " me->update_dimension_range( ). - - ENDIF. - -* Begin of change issue #152 - don't touch exisiting style if only value is passed -* For Date- or Timefields change the formatcode if nothing is set yet -* Enhancement option: Check if existing formatcode is a date/ or timeformat -* If not, use default - DATA: lo_format_code_datetime TYPE zexcel_number_format. - DATA: stylemapping TYPE zexcel_s_stylemapping. - CASE lv_value_type. - WHEN cl_abap_typedescr=>typekind_date. - TRY. - stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ). - CATCH zcx_excel . - ENDTRY. - IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR - stylemapping-complete_style-number_format-format_code IS INITIAL. - lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_std. - ELSE. - lo_format_code_datetime = stylemapping-complete_style-number_format-format_code. - ENDIF. - me->change_cell_style( ip_column = ip_column - ip_row = ip_row - ip_number_format_format_code = lo_format_code_datetime ). - - WHEN cl_abap_typedescr=>typekind_time. - TRY. - stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ). - CATCH zcx_excel . - ENDTRY. - IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR - stylemapping-complete_style-number_format-format_code IS INITIAL. - lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_time6. - ELSE. - lo_format_code_datetime = stylemapping-complete_style-number_format-format_code. - ENDIF. - me->change_cell_style( ip_column = ip_column - ip_row = ip_row - ip_number_format_format_code = lo_format_code_datetime ). - - ENDCASE. -* End of change issue #152 - don't touch exisiting style if only value is passed - -* Fix issue #162 - lv_value = ip_value. - IF lv_value CS cl_abap_char_utilities=>cr_lf. - me->change_cell_style( ip_column = ip_column - ip_row = ip_row - ip_alignment_wraptext = abap_true ). - ENDIF. -* End of Fix issue #162 - - endmethod. - - - - - - - method SET_CELL_FORMULA. - DATA: - lv_column TYPE zexcel_cell_column, - ls_sheet_content LIKE LINE OF me->sheet_content. - - FIELD-SYMBOLS: - <sheet_content> LIKE LINE OF me->sheet_content. - -*--------------------------------------------------------------------* -* Get cell to set formula into -*--------------------------------------------------------------------* - lv_column = zcl_excel_common=>convert_column2int( ip_column ). - READ TABLE me->sheet_content ASSIGNING <sheet_content> WITH TABLE KEY cell_row = ip_row - cell_column = lv_column. - IF sy-subrc <> 0. " Create new entry in sheet_content if necessary - CHECK ip_formula IS INITIAL. " no need to create new entry in sheet_content when no formula is passed - ls_sheet_content-cell_row = ip_row. - ls_sheet_content-cell_column = lv_column. - INSERT ls_sheet_content INTO TABLE me->sheet_content ASSIGNING <sheet_content>. - ENDIF. - -*--------------------------------------------------------------------* -* Fieldsymbol now holds the relevant cell -*--------------------------------------------------------------------* - <sheet_content>-cell_formula = ip_formula. - - - endmethod. - - - - - - - method SET_CELL_STYLE. - - DATA: lv_column TYPE zexcel_cell_column, - ls_sheet_content TYPE zexcel_s_cell_data, - lv_row_alpha TYPE string, - lo_style TYPE REF TO zcl_excel_style, - lv_style_guid TYPE zexcel_cell_style. - - FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data. - - lv_style_guid = ip_style. - - lv_column = zcl_excel_common=>convert_column2int( ip_column ). - - READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row - cell_column = lv_column. - - IF sy-subrc EQ 0. - <fs_sheet_content>-cell_style = lv_style_guid. - ELSE. - set_cell( ip_column = ip_column ip_row = ip_row ip_value = '' ip_style = ip_style ). - ENDIF. - - endmethod. - - - - - - - method SET_COLUMN_WIDTH. - DATA: column_dimension TYPE REF TO zcl_excel_worksheet_columndime. - DATA: width TYPE float. - - column_dimension = me->get_column_dimension( ip_column ). - -* if a fix size is supplied use this - IF ip_width_fix IS SUPPLIED. - TRY. - width = ip_width_fix. - IF width <= 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Please supply a positive number as column-width'. - ENDIF. - column_dimension->set_width( width ). - EXIT. - CATCH cx_sy_conversion_no_number. -* Strange stuff passed --> raise error - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unable to interpret supplied input as number'. - ENDTRY. - ENDIF. - -* If we get down to here, we have to use whatever is found in autosize. - column_dimension->set_auto_size( ip_width_autosize ). - - - endmethod. - - - - - method SET_DEFAULT_EXCEL_DATE_FORMAT. - - IF ip_default_excel_date_format IS INITIAL. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Default date format cannot be blank'. - ENDIF. - - default_excel_date_format = ip_default_excel_date_format. - endmethod. - - - - - - - - METHOD set_merge. - - DATA: ls_merge TYPE mty_merge, - lv_errormessage TYPE string. - - FIELD-SYMBOLS: <ls_merge> LIKE LINE OF me->mt_merged_cells. - -*--------------------------------------------------------------------* -* Build new range area to insert into range table -*--------------------------------------------------------------------* - ls_merge-row_from = ip_row. - IF ip_row IS SUPPLIED AND ip_row IS NOT INITIAL AND ip_row_to IS NOT SUPPLIED. - ls_merge-row_to = ls_merge-row_from. - ELSE. - ls_merge-row_to = ip_row_to. - ENDIF. - IF ls_merge-row_from > ls_merge-row_to. - lv_errormessage = 'Merge: First row larger then last row'(405). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - ls_merge-col_from = zcl_excel_common=>convert_column2int( ip_column_start ). - IF ip_column_start IS SUPPLIED AND ip_column_start IS NOT INITIAL AND ip_column_end IS NOT SUPPLIED. - ls_merge-col_to = ls_merge-col_from. - ELSE. - ls_merge-col_to = zcl_excel_common=>convert_column2int( ip_column_end ). - ENDIF. - IF ls_merge-col_from > ls_merge-col_to. - lv_errormessage = 'Merge: First column larger then last column'(406). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - -*--------------------------------------------------------------------* -* Check merge not overlapping with existing merges -*--------------------------------------------------------------------* - LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE NOT ( row_from > ls_merge-row_to - OR row_to < ls_merge-row_from - OR col_from > ls_merge-col_to - OR col_to < ls_merge-col_from ). - lv_errormessage = 'Overlapping merges'(404). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - - ENDLOOP. - -*--------------------------------------------------------------------* -* Everything seems ok --> add to merge table -*--------------------------------------------------------------------* - INSERT ls_merge INTO TABLE me->mt_merged_cells. - -ENDMETHOD. - - - - method SET_PRINT_GRIDLINES. - me->print_gridlines = i_print_gridlines. - endmethod. - - - - - - method SET_ROW_HEIGHT. - DATA: row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi. - DATA: height TYPE float. - - row_dimension = me->get_row_dimension( ip_row ). - -* if a fix size is supplied use this - TRY. - height = ip_height_fix. - IF height <= 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Please supply a positive number as row-height'. - ENDIF. - row_dimension->set_row_height( height ). - EXIT. - CATCH cx_sy_conversion_no_number. -* Strange stuff passed --> raise error - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unable to interpret supplied input as number'. - ENDTRY. - - - - endmethod. - - - - - - - METHOD set_row_outline. - - DATA: ls_row_outline LIKE LINE OF me->mt_row_outlines. - FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF me->mt_row_outlines. - - READ TABLE me->mt_row_outlines ASSIGNING <ls_row_outline> WITH TABLE KEY row_from = iv_row_from - row_to = iv_row_to. - IF sy-subrc <> 0. - IF iv_row_from <= 0. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'First row of outline must be a positive number'. - ENDIF. - IF iv_row_to < iv_row_from. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Last row of outline may not be less than first line of outline'. - ENDIF. - ls_row_outline-row_from = iv_row_from. - ls_row_outline-row_to = iv_row_to. - INSERT ls_row_outline INTO TABLE me->mt_row_outlines ASSIGNING <ls_row_outline>. - ENDIF. - - CASE iv_collapsed. - - WHEN abap_true - OR abap_false. - <ls_row_outline>-collapsed = iv_collapsed. - - WHEN OTHERS. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unknown collapse state'. - - ENDCASE. -ENDMETHOD. - - - - method SET_SHOW_GRIDLINES. - me->show_gridlines = i_show_gridlines. - endmethod. - - - - method SET_SHOW_ROWCOLHEADERS. - me->show_rowcolheaders = i_show_rowcolheaders. - endmethod. - - - - method SET_TABCOLOR. - me->tabcolor = iv_tabcolor. - endmethod. - - - - - - - - - - - - method SET_TABLE. - - DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr, - lr_data TYPE REF TO data, - ls_newline TYPE REF TO data, - ls_header TYPE x030l, - lt_dfies TYPE ddfields, - lv_row_header TYPE zexcel_cell_row VALUE 2, - lv_col_header TYPE zexcel_cell_column_alpha VALUE 'B', - lv_row_int TYPE zexcel_cell_row, - lv_column_int TYPE zexcel_cell_column, - lv_column_alpha TYPE zexcel_cell_column_alpha, - lv_cell_value TYPE zexcel_cell_value. - - - FIELD-SYMBOLS: <fs_table_line> TYPE ANY, - <fs_fldval> TYPE ANY, - <fs_dfies> TYPE dfies, - <fs_cell_value> TYPE zexcel_cell_value. - - lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ). - lv_row_int = ip_top_left_row. - - CREATE DATA lr_data LIKE LINE OF ip_table. - - lo_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ). - - ls_header = lo_tabdescr->get_ddic_header( ). - - lt_dfies = lo_tabdescr->get_ddic_field_list( ). - -* It is better to loop column by column - LOOP AT lt_dfies ASSIGNING <fs_dfies>. - lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). - - IF ip_no_header = abap_false. - " First of all write column header - lv_cell_value = <fs_dfies>-scrtext_m. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = lv_cell_value - ip_style = ip_hdr_style ). - IF ip_transpose = abap_true. - ADD 1 TO lv_column_int. - ELSE. - ADD 1 TO lv_row_int. - ENDIF. - ENDIF. - - LOOP AT ip_table ASSIGNING <fs_table_line>. - lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). - ASSIGN COMPONENT <fs_dfies>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>. - MOVE <fs_fldval> TO lv_cell_value. - me->set_cell( ip_column = lv_column_alpha - ip_row = lv_row_int - ip_value = <fs_fldval> "lv_cell_value - ip_style = ip_body_style ). - IF ip_transpose = abap_true. - ADD 1 TO lv_column_int. - ELSE. - ADD 1 TO lv_row_int. - ENDIF. - ENDLOOP. - IF ip_transpose = abap_true. - lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ). - ADD 1 TO lv_row_int. - ELSE. - lv_row_int = ip_top_left_row. - ADD 1 TO lv_column_int. - ENDIF. - ENDLOOP. - - endmethod. - - - - - method SET_TITLE. -*--------------------------------------------------------------------* -* ToDos: -* 2do §1 The current coding for replacing a named ranges name -* after renaming a sheet should be checked if it is -* really working if sheetname should be escaped -*--------------------------------------------------------------------* - -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (wip ) 2012-12-08 -* - ... -* changes: aligning code -* message made to support multilinguality -*--------------------------------------------------------------------* -* issue#243 - ' is not allowed as first character in sheet title -* - Stefan Schmoecker, 2012-12-02 -* changes: added additional check for ' as first character -*--------------------------------------------------------------------* - DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - errormessage TYPE string, - lv_rangesheetname_old TYPE string, - lv_rangesheetname_new TYPE string, - lo_ranges_iterator TYPE REF TO cl_object_collection_iterator, - lo_range TYPE REF TO zcl_excel_range, - lv_range_value TYPE zexcel_range_value, - lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class - - -*--------------------------------------------------------------------* -* Check whether title consists only of allowed characters -* Illegal characters are: / \ [ ] * ? : --> http://msdn.microsoft.com/en-us/library/ff837411.aspx -* Illegal characters not in documentation: ' as first character -*--------------------------------------------------------------------* - IF ip_title CA '/\[]*?:'. - lv_errormessage = 'Found illegal character in sheetname. List of forbidden characters: /\[]*?:'(402). - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - IF ip_title IS NOT INITIAL AND ip_title(1) = `'`. - lv_errormessage = 'Sheetname may not start with &'(403). " & used instead of ' to allow fallbacklanguage - REPLACE '&' IN lv_errormessage WITH `'`. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = lv_errormessage. - ENDIF. - - -*--------------------------------------------------------------------* -* Check whether title is unique in workbook -*--------------------------------------------------------------------* - lo_worksheets_iterator = me->excel->get_worksheets_iterator( ). - WHILE lo_worksheets_iterator->has_next( ) = 'X'. - - lo_worksheet ?= lo_worksheets_iterator->get_next( ). - CHECK me->guid <> lo_worksheet->get_guid( ). " Don't check against itself - IF ip_title = lo_worksheet->get_title( ). " Not unique --> raise exception - errormessage = 'Duplicate sheetname &'. - REPLACE '&' IN errormessage WITH ip_title. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = errormessage. - ENDIF. - - ENDWHILE. - -*--------------------------------------------------------------------* -* Remember old sheetname and rename sheet to desired name -*--------------------------------------------------------------------* - CONCATENATE me->title '!' INTO lv_rangesheetname_old. - me->title = ip_title. - -*--------------------------------------------------------------------* -* After changing this worksheet's title we have to adjust -* all ranges that are referring to this worksheet. -*--------------------------------------------------------------------* -* 2do §1 - Check if the following quickfix is solid -* I fear it isn't - but this implementation is better then -* nothing at all since it handles a supposed majority of cases -*--------------------------------------------------------------------* - CONCATENATE me->title '!' INTO lv_rangesheetname_new. - - lo_ranges_iterator = me->excel->get_ranges_iterator( ). - WHILE lo_ranges_iterator->has_next( ) = 'X'. - - lo_range ?= lo_ranges_iterator->get_next( ). - lv_range_value = lo_range->get_value( ). - REPLACE ALL OCCURRENCES OF lv_rangesheetname_old IN lv_range_value WITH lv_rangesheetname_new. - IF sy-subrc = 0. - lo_range->set_range_value( lv_range_value ). - ENDIF. - - ENDWHILE. - - - endmethod. - - - - METHOD update_dimension_range. - - DATA: ls_sheet_content TYPE zexcel_s_cell_data, - lt_sheet_content TYPE zexcel_t_cell_data_unsorted, - lv_row_alpha TYPE string, - lv_column_alpha TYPE zexcel_cell_column_alpha. - - CHECK sheet_content IS NOT INITIAL. - -* update dimension range - lt_sheet_content = sheet_content. - "upper left corner - SORT lt_sheet_content BY cell_row. - READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content. - upper_cell-cell_row = ls_sheet_content-cell_row. - SORT lt_sheet_content BY cell_column. - READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content. - upper_cell-cell_column = ls_sheet_content-cell_column. - - lv_row_alpha = upper_cell-cell_row. - lv_column_alpha = zcl_excel_common=>convert_column2alpha( upper_cell-cell_column ). - SHIFT lv_row_alpha RIGHT DELETING TRAILING space. - SHIFT lv_row_alpha LEFT DELETING LEADING space. - CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords. - - "bottom right corner - SORT lt_sheet_content BY cell_row DESCENDING. - READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content. - lower_cell-cell_row = ls_sheet_content-cell_row. - SORT lt_sheet_content BY cell_column DESCENDING. - READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content. - lower_cell-cell_column = ls_sheet_content-cell_column. - - lv_row_alpha = lower_cell-cell_row. - lv_column_alpha = zcl_excel_common=>convert_column2alpha( lower_cell-cell_column ). - SHIFT lv_row_alpha RIGHT DELETING TRAILING space. - SHIFT lv_row_alpha LEFT DELETING LEADING space. - CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords. - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEETS.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEETS.slnk deleted file mode 100644 index 99ee918..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEETS.slnk +++ /dev/null @@ -1,79 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - method ADD. - - worksheets->add( ip_worksheet ). - - endmethod. - - - method CLEAR. - - worksheets->clear( ). - - endmethod. - - - method CONSTRUCTOR. - - CREATE OBJECT worksheets. - - endmethod. - - - - - method GET. - - DATA lv_index TYPE i. - lv_index = ip_index. - eo_worksheet ?= worksheets->if_object_collection~get( lv_index ). - - endmethod. - - - - method GET_ITERATOR. - - eo_iterator ?= worksheets->if_object_collection~get_iterator( ). - - endmethod. - - - - method IS_EMPTY. - - is_empty = worksheets->if_object_collection~is_empty( ). - - endmethod. - - - - method REMOVE. - - worksheets->remove( ip_worksheet ). - - endmethod. - - - - method SIZE. - - ep_size = worksheets->if_object_collection~size( ). - - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_COLUMNDIME.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_COLUMNDIME.slnk deleted file mode 100644 index 8d44f7d..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_COLUMNDIME.slnk +++ /dev/null @@ -1,177 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - - - - - - - method CONSTRUCTOR. - me->column_index = zcl_excel_common=>convert_column2int( ip_index ). - me->width = -1. - me->auto_size = abap_false. - me->visible = abap_true. - me->outline_level = 0. - me->collapsed = abap_false. - me->excel = ip_excel. "ins issue #157 - Allow Style for columns - me->worksheet = ip_worksheet. "ins issue #157 - Allow Style for columns - - " set default index to cellXf - me->xf_index = 0. - - endmethod. - - - - method GET_AUTO_SIZE. - r_auto_size = me->auto_size. - endmethod. - - - - method GET_COLLAPSED. - r_Collapsed = me->Collapsed. - endmethod. - - - - method GET_COLUMN_INDEX. - r_column_index = me->column_index. - endmethod. - - - - - method GET_COLUMN_STYLE_GUID. - IF me->style_guid IS NOT INITIAL. - ep_style_guid = me->style_guid. - ELSE. - ep_style_guid = me->worksheet->zif_excel_sheet_properties~get_style( ). - ENDIF. - endmethod. - - - - method GET_OUTLINE_LEVEL. - r_outline_level = me->outline_level. - endmethod. - - - - method GET_VISIBLE. - r_Visible = me->Visible. - endmethod. - - - - method GET_WIDTH. - r_WIDTH = me->WIDTH. - endmethod. - - - - method GET_XF_INDEX. - r_xf_index = me->xf_index. - endmethod. - - - - - method SET_AUTO_SIZE. - me->auto_size = ip_auto_size. - r_worksheet_columndime = me. - endmethod. - - - - - method SET_COLLAPSED. - me->Collapsed = ip_Collapsed. - r_worksheet_columndime = me. - endmethod. - - - - - method SET_COLUMN_INDEX. - me->column_index = zcl_excel_common=>convert_column2int( ip_index ). - r_worksheet_columndime = me. - endmethod. - - - - - method SET_COLUMN_STYLE_BY_GUID. - DATA: stylemapping TYPE zexcel_s_stylemapping. - - IF me->excel IS NOT BOUND. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Internal error - reference to ZCL_EXCEL not bound'. - ENDIF. - TRY. - stylemapping = me->excel->get_style_to_guid( ip_style_guid ). - me->style_guid = stylemapping-guid. - - CATCH zcx_excel . - EXIT. " leave as is in case of error - ENDTRY. - - endmethod. - - - - method SET_OUTLINE_LEVEL. - me->outline_level = ip_outline_level. - endmethod. - - - - - method SET_VISIBLE. - me->Visible = ip_Visible. - r_worksheet_columndime = me. - endmethod. - - - - - - method SET_WIDTH. - TRY. - me->width = ip_width. - r_worksheet_columndime = me. - CATCH cx_sy_conversion_no_number. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unable to interpret width as number'. - ENDTRY. - endmethod. - - - - - method SET_XF_INDEX. - me->XF_INDEX = ip_XF_INDEX. - r_worksheet_columndime = me. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_PAGEBREAKS.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_PAGEBREAKS.slnk deleted file mode 100644 index 8df439c..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_PAGEBREAKS.slnk +++ /dev/null @@ -1,40 +0,0 @@ - - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - METHOD add_pagebreak. - DATA: ls_pagebreak LIKE LINE OF me->mt_pagebreaks. - - ls_pagebreak-cell_row = ip_row. - ls_pagebreak-cell_column = zcl_excel_common=>convert_column2int( ip_column ). - - INSERT ls_pagebreak INTO TABLE me->mt_pagebreaks. - - -ENDMETHOD. - - - - METHOD get_all_pagebreaks. - rt_pagebreaks = me->mt_pagebreaks. -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_ROWDIMENSI.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_ROWDIMENSI.slnk deleted file mode 100644 index a2ed626..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET_ROWDIMENSI.slnk +++ /dev/null @@ -1,185 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - ABAP - - - - - - - - - method CONSTRUCTOR. - " Initialise values - me->row_index = ip_index. - me->row_height = -1. - me->visible = abap_true. - me->outline_level = 0. - me->collapsed = abap_false. - - " set row dimension as unformatted by default - me->xf_index = 0. - endmethod. - - - - - METHOD get_collapsed. - - DATA: lt_row_outlines TYPE zcl_excel_worksheet=>mty_ts_outlines_row, - lv_previous_row TYPE i, - lv_following_row TYPE i. - - r_collapsed = me->collapsed. - - CHECK r_collapsed = abap_false. " Maybe new method for outlines is being used - CHECK io_worksheet IS BOUND. - -* If an outline is collapsed ( even inside an outer outline ) the line following the last line -* of the group gets the flag "collapsed" - IF io_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_off. - lv_following_row = me->row_index + 1. - lt_row_outlines = io_worksheet->get_row_outlines( ). - READ TABLE lt_row_outlines TRANSPORTING NO FIELDS WITH KEY row_from = lv_following_row " first line of an outline - collapsed = abap_true. " that is collapsed - ELSE. - lv_previous_row = me->row_index - 1. - lt_row_outlines = io_worksheet->get_row_outlines( ). - READ TABLE lt_row_outlines TRANSPORTING NO FIELDS WITH KEY row_to = lv_previous_row " last line of an outline - collapsed = abap_true. " that is collapsed - ENDIF. - CHECK sy-subrc = 0. " ok - we found it - r_collapsed = abap_true. - - -ENDMETHOD. - - - - - METHOD get_outline_level. - - DATA: lt_row_outlines TYPE zcl_excel_worksheet=>mty_ts_outlines_row. - FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF lt_row_outlines. - -* if someone has set the outline level explicitly - just use that - IF me->outline_level IS NOT INITIAL. - r_outline_level = me->outline_level. - RETURN. - ENDIF. -* Maybe we can use the outline information in the worksheet - CHECK io_worksheet IS BOUND. - - lt_row_outlines = io_worksheet->get_row_outlines( ). - LOOP AT lt_row_outlines ASSIGNING <ls_row_outline> WHERE row_from <= me->row_index - AND row_to >= me->row_index. - - ADD 1 TO r_outline_level. - - ENDLOOP. - -ENDMETHOD. - - - - method GET_ROW_HEIGHT. - r_row_height = me->row_height. - endmethod. - - - - method GET_ROW_INDEX. - r_row_index = me->row_index. - endmethod. - - - - - METHOD get_visible. - - DATA: lt_row_outlines TYPE zcl_excel_worksheet=>mty_ts_outlines_row. - FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF lt_row_outlines. - - r_visible = me->visible. - CHECK r_visible = 'X'. " Currently visible --> but maybe the new outline methodology will hide it implicitly - CHECK io_worksheet IS BOUND. " But we have to see the worksheet to make sure - - lt_row_outlines = io_worksheet->get_row_outlines( ). - LOOP AT lt_row_outlines ASSIGNING <ls_row_outline> WHERE row_from <= me->row_index - AND row_to >= me->row_index - AND collapsed = abap_true. " row is in a collapsed outline --> not visible - CLEAR r_visible. - RETURN. " one hit is enough to ensure invisibility - - ENDLOOP. - -ENDMETHOD. - - - - method GET_XF_INDEX. - r_xf_index = me->xf_index. - endmethod. - - - - method SET_COLLAPSED. - me->collapsed = ip_collapsed. - endmethod. - - - - - method SET_OUTLINE_LEVEL. - IF ip_outline_level < 0 - OR ip_outline_level > 7. - - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Outline level must range between 0 and 7.'. - - ENDIF. - me->outline_level = ip_outline_level. - endmethod. - - - - - method SET_ROW_HEIGHT. - TRY. - me->row_height = ip_row_height. - CATCH cx_sy_conversion_no_number. - RAISE EXCEPTION TYPE zcx_excel - EXPORTING - error = 'Unable to interpret ip_row_height as number'. - ENDTRY. - endmethod. - - - - method SET_ROW_INDEX. - me->row_index = ip_index. - endmethod. - - - - method SET_VISIBLE. - me->visible = ip_visible. - endmethod. - - - - method SET_XF_INDEX. - me->XF_INDEX = ip_XF_INDEX. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk deleted file mode 100644 index 488cddb..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_2007.slnk +++ /dev/null @@ -1,7054 +0,0 @@ - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - - - - - - - - - - - - - method ZIF_EXCEL_WRITER~WRITE_FILE. - me->excel = io_excel. - - ep_file = me->create( ). - endmethod. - - - - METHOD add_further_data_to_zip. -* Can be used by child classes like xlsm-writer to write additional data to zip archive -ENDMETHOD. - - - - method CREATE. - -* Office 2007 file format is a cab of several xml files with extension .xlsx - - DATA: lo_zip TYPE REF TO cl_abap_zip, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_active_worksheet TYPE REF TO zcl_excel_worksheet, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_nested_iterator TYPE REF TO cl_object_collection_iterator, - lo_table TYPE REF TO zcl_excel_table, - lo_drawing TYPE REF TO zcl_excel_drawing, - lo_drawings TYPE REF TO zcl_excel_drawings. - - DATA: lv_content TYPE xstring, - lv_active TYPE flag, - lv_xl_sheet TYPE string, - lv_xl_sheet_rels TYPE string, - lv_xl_drawing TYPE string, - lv_xl_drawing_rels TYPE string, - lv_syindex TYPE string, - lv_value TYPE string, - lv_drawing_index TYPE i. - -********************************************************************** -* Start of insertion # issue 139 - Dateretention of cellstyles - me->excel->add_static_styles( ). -* End of insertion # issue 139 - Dateretention of cellstyles - -********************************************************************** -* STEP 1: Create archive object file (ZIP) - CREATE OBJECT lo_zip. - -********************************************************************** -* STEP 2: Add [Content_Types].xml to zip - lv_content = me->create_content_types( ). - lo_zip->add( name = me->c_content_types - content = lv_content ). - -********************************************************************** -* STEP 3: Add _rels/.rels to zip - lv_content = me->create_relationships( ). - lo_zip->add( name = me->c_relationships - content = lv_content ). - -********************************************************************** -* STEP 4: Add docProps/app.xml to zip - lv_content = me->create_docprops_app( ). - lo_zip->add( name = me->c_docprops_app - content = lv_content ). - -********************************************************************** -* STEP 5: Add docProps/core.xml to zip - lv_content = me->create_docprops_core( ). - lo_zip->add( name = me->c_docprops_core - content = lv_content ). - -********************************************************************** -* STEP 6: Add xl/_rels/workbook.xml.rels to zip - lv_content = me->create_xl_relationships( ). - lo_zip->add( name = me->c_xl_relationships - content = lv_content ). - -********************************************************************** -* STEP 6: Add xl/_rels/workbook.xml.rels to zip - lv_content = me->create_xl_theme( ). - lo_zip->add( name = me->c_xl_theme - content = lv_content ). - -********************************************************************** -* STEP 7: Add xl/workbook.xml to zip - lv_content = me->create_xl_workbook( ). - lo_zip->add( name = me->c_xl_workbook - content = lv_content ). - -********************************************************************** -* STEP 8: Add xl/workbook.xml to zip -* lv_content = me->create_xl_styles_static( ). - lv_content = me->create_xl_styles( ). - lo_zip->add( name = me->c_xl_styles - content = lv_content ). - -********************************************************************** -* STEP 9: Add sharedStrings.xml to zip - lv_content = me->create_xl_sharedstrings( ). - lo_zip->add( name = me->c_xl_sharedstrings - content = lv_content ). - -********************************************************************** -* STEP 10: Add sheet#.xml and drawing#.xml to zip - lo_iterator = me->excel->get_worksheets_iterator( ). - lo_active_worksheet = me->excel->get_active_worksheet( ). - lv_drawing_index = 1. - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - IF lo_active_worksheet->get_guid( ) EQ lo_worksheet->get_guid( ). - lv_active = abap_true. - ELSE. - lv_active = abap_false. - ENDIF. - lv_content = me->create_xl_sheet( io_worksheet = lo_worksheet - iv_active = lv_active ). - lv_xl_sheet = me->c_xl_sheet. - MOVE sy-index TO lv_syindex. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - REPLACE ALL OCCURRENCES OF '#' IN lv_xl_sheet WITH lv_syindex. - lo_zip->add( name = lv_xl_sheet - content = lv_content ). - - lv_xl_sheet_rels = me->c_xl_sheet_rels. - lv_content = me->create_xl_sheet_rels( io_worksheet = lo_worksheet - iv_drawing_index = lv_drawing_index ). - REPLACE ALL OCCURRENCES OF '#' IN lv_xl_sheet_rels WITH lv_syindex. - lo_zip->add( name = lv_xl_sheet_rels - content = lv_content ). - - lo_nested_iterator = lo_worksheet->get_tables_iterator( ). - - WHILE lo_nested_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_nested_iterator->if_object_collection_iterator~get_next( ). - lv_content = me->create_xl_table( lo_table ). - - lv_value = lo_table->get_name( ). - CONCATENATE 'xl/tables/' lv_value '.xml' INTO lv_value. - lo_zip->add( name = lv_value - content = lv_content ). - ENDWHILE. - -* Add drawings ********************************** - lo_drawings = lo_worksheet->get_drawings( ). - IF lo_drawings->is_empty( ) = abap_false. - MOVE lv_drawing_index TO lv_syindex. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - - lv_content = me->create_xl_drawings( lo_worksheet ). - lv_xl_drawing = me->c_xl_drawings. - REPLACE ALL OCCURRENCES OF '#' IN lv_xl_drawing WITH lv_syindex. - lo_zip->add( name = lv_xl_drawing - content = lv_content ). - - lv_content = me->create_xl_drawings_rels( lo_worksheet ). - lv_xl_drawing_rels = me->c_xl_drawings_rels. - REPLACE ALL OCCURRENCES OF '#' IN lv_xl_drawing_rels WITH lv_syindex. - lo_zip->add( name = lv_xl_drawing_rels - content = lv_content ). - ADD 1 TO lv_drawing_index. - ENDIF. - - ENDWHILE. - -********************************************************************** -* STEP 11: Add media - lo_iterator = me->excel->get_drawings_iterator( zcl_excel_drawing=>type_image ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lv_content = lo_drawing->get_media( ). - lv_value = lo_drawing->get_media_name( ). - CONCATENATE 'xl/media/' lv_value INTO lv_value. - lo_zip->add( name = lv_value - content = lv_content ). - ENDWHILE. - -********************************************************************** -* STEP 12: Add charts - lo_iterator = me->excel->get_drawings_iterator( zcl_excel_drawing=>type_chart ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lv_content = lo_drawing->get_media( ). - - "-------------Added by Alessandro Iannacci - Only if template exist - IF lv_content IS NOT INITIAL AND me->excel->use_template EQ abap_true. - lv_value = lo_drawing->get_media_name( ). - CONCATENATE 'xl/charts/' lv_value INTO lv_value. - lo_zip->add( name = lv_value - content = lv_content ). - ELSE. "ADD CUSTOM CHART!!!! - lv_content = me->create_xl_charts( lo_drawing ). - lv_value = lo_drawing->get_media_name( ). - CONCATENATE 'xl/charts/' lv_value INTO lv_value. - lo_zip->add( name = lv_value - content = lv_content ). - ENDIF. - "------------------------------------------------- - ENDWHILE. - -* Second to last step: Allow further information put into the zip archive by child classes - me->add_further_data_to_zip( lo_zip ). - -********************************************************************** -* Last step: Create the final zip - ep_excel = lo_zip->save( ). - - endmethod. - - - - method CREATE_CONTENT_TYPES. - - -** Constant node name - DATA: lc_xml_node_types TYPE string VALUE 'Types', - lc_xml_node_override TYPE string VALUE 'Override', - lc_xml_node_default TYPE string VALUE 'Default', - " Node attributes - lc_xml_attr_partname TYPE string VALUE 'PartName', - lc_xml_attr_extension TYPE string VALUE 'Extension', - lc_xml_attr_contenttype TYPE string VALUE 'ContentType', - " Node namespace - lc_xml_node_types_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/content-types', - " Node extension - lc_xml_node_rels_ext TYPE string VALUE 'rels', - lc_xml_node_xml_ext TYPE string VALUE 'xml', - " Node partnumber - lc_xml_node_theme_pn TYPE string VALUE '/xl/theme/theme1.xml', - lc_xml_node_styles_pn TYPE string VALUE '/xl/styles.xml', - lc_xml_node_workb_pn TYPE string VALUE '/xl/workbook.xml', - lc_xml_node_props_pn TYPE string VALUE '/docProps/app.xml', - lc_xml_node_worksheet_pn TYPE string VALUE '/xl/worksheets/sheet#.xml', - lc_xml_node_strings_pn TYPE string VALUE '/xl/sharedStrings.xml', - lc_xml_node_core_pn TYPE string VALUE '/docProps/core.xml', - lc_xml_node_chart_pn TYPE string VALUE '/xl/charts/chart#.xml', - " Node contentType - lc_xml_node_theme_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.theme+xml', - lc_xml_node_styles_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml', - lc_xml_node_workb_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml', - lc_xml_node_rels_ct TYPE string VALUE 'application/vnd.openxmlformats-package.relationships+xml', - lc_xml_node_xml_ct TYPE string VALUE 'application/xml', - lc_xml_node_props_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.extended-properties+xml', - lc_xml_node_worksheet_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml', - lc_xml_node_strings_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml', - lc_xml_node_core_ct TYPE string VALUE 'application/vnd.openxmlformats-package.core-properties+xml', - lc_xml_node_table_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml', - lc_xml_node_drawings_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.drawing+xml', - lc_xml_node_chart_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_nested_iterator TYPE REF TO cl_object_collection_iterator, - lo_table TYPE REF TO zcl_excel_table. - - DATA: lv_worksheets_num TYPE i, - lv_worksheets_numc TYPE numc3, - lv_xml_node_worksheet_pn TYPE string, - lv_xml_size TYPE i, - lv_value TYPE string, - lv_drawing_index TYPE i VALUE 1, - lv_index_str TYPE string. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'UTF-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node types - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_types - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_types_ns ). - -********************************************************************** -* STEP 4: Create subnodes - - " rels node - lo_element = lo_document->create_simple_element( name = lc_xml_node_default - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_extension - value = lc_xml_node_rels_ext ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_rels_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " extension node - lo_element = lo_document->create_simple_element( name = lc_xml_node_default - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_extension - value = lc_xml_node_xml_ext ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_xml_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Theme node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_theme_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_theme_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Styles node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_styles_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_styles_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Workbook node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_workb_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_workb_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Properties node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_props_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_props_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Worksheet node - lv_worksheets_num = excel->get_worksheets_size( ). - DO lv_worksheets_num TIMES. - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - - MOVE sy-index TO lv_worksheets_numc. - SHIFT lv_worksheets_numc LEFT DELETING LEADING '0'. - lv_xml_node_worksheet_pn = lc_xml_node_worksheet_pn. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_worksheet_pn WITH lv_worksheets_numc. - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lv_xml_node_worksheet_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_worksheet_ct ). - lo_element_root->append_child( new_child = lo_element ). - ENDDO. - - lo_iterator = me->excel->get_worksheets_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lo_nested_iterator = lo_worksheet->get_tables_iterator( ). - - WHILE lo_nested_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_nested_iterator->if_object_collection_iterator~get_next( ). - - lv_value = lo_table->get_name( ). - CONCATENATE '/xl/tables/' lv_value '.xml' INTO lv_value. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_table_ct ). - lo_element_root->append_child( new_child = lo_element ). - ENDWHILE. - - " Drawings - DATA: lo_drawings TYPE REF TO zcl_excel_drawings. - - lo_drawings = lo_worksheet->get_drawings( ). - IF lo_drawings->is_empty( ) = abap_false. - lv_index_str = lv_drawing_index. - CONDENSE lv_index_str NO-GAPS. - CONCATENATE '/' me->c_xl_drawings INTO lv_value. - REPLACE '#' WITH lv_index_str INTO lv_value. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_drawings_ct ). - lo_element_root->append_child( new_child = lo_element ). - - ADD 1 TO lv_drawing_index. - ENDIF. - ENDWHILE. - - " media mimes - DATA: lo_drawing TYPE REF TO zcl_excel_drawing, - lt_media_type TYPE TABLE OF mimetypes-extension, - lv_media_type TYPE mimetypes-extension, - lv_mime_type TYPE mimetypes-type. - - lo_iterator = me->excel->get_drawings_iterator( zcl_excel_drawing=>type_image ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) = abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lv_media_type = lo_drawing->get_media_type( ). - COLLECT lv_media_type INTO lt_media_type. - ENDWHILE. - - LOOP AT lt_media_type INTO lv_media_type. - CALL FUNCTION 'SDOK_MIMETYPE_GET' - EXPORTING - extension = lv_media_type - IMPORTING - mimetype = lv_mime_type. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_default - parent = lo_document ). - lv_value = lv_media_type. - lo_element->set_attribute_ns( name = lc_xml_attr_extension - value = lv_value ). - lv_value = lv_mime_type. - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDLOOP. - - " Charts - lo_iterator = me->excel->get_drawings_iterator( zcl_excel_drawing=>type_chart ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) = abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lv_index_str = lo_drawing->get_index( ). - CONDENSE lv_index_str. - lv_value = lc_xml_node_chart_pn. - REPLACE ALL OCCURRENCES OF '#' IN lv_value WITH lv_index_str. - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_chart_ct ). - lo_element_root->append_child( new_child = lo_element ). - ENDWHILE. - - " Strings node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_strings_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_strings_ct ). - lo_element_root->append_child( new_child = lo_element ). - - " Strings node - lo_element = lo_document->create_simple_element( name = lc_xml_node_override - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_partname - value = lc_xml_node_core_pn ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_core_ct ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - method CREATE_DOCPROPS_APP. - - -** Constant node name - DATA: lc_xml_node_properties TYPE string VALUE 'Properties', - lc_xml_node_application TYPE string VALUE 'Application', - lc_xml_node_docsecurity TYPE string VALUE 'DocSecurity', - lc_xml_node_scalecrop TYPE string VALUE 'ScaleCrop', - lc_xml_node_headingpairs TYPE string VALUE 'HeadingPairs', - lc_xml_node_vector TYPE string VALUE 'vector', - lc_xml_node_variant TYPE string VALUE 'variant', - lc_xml_node_lpstr TYPE string VALUE 'lpstr', - lc_xml_node_i4 TYPE string VALUE 'i4', - lc_xml_node_titlesofparts TYPE string VALUE 'TitlesOfParts', - lc_xml_node_company TYPE string VALUE 'Company', - lc_xml_node_linksuptodate TYPE string VALUE 'LinksUpToDate', - lc_xml_node_shareddoc TYPE string VALUE 'SharedDoc', - lc_xml_node_hyperlinkschanged TYPE string VALUE 'HyperlinksChanged', - lc_xml_node_appversion TYPE string VALUE 'AppVersion', - " Namespace prefix - lc_vt_ns TYPE string VALUE 'vt', - lc_xml_node_props_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties', - lc_xml_node_props_vt_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes', - " Node attributes - lc_xml_attr_size TYPE string VALUE 'size', - lc_xml_attr_basetype TYPE string VALUE 'baseType'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_sub_element_vector TYPE REF TO if_ixml_element, - lo_sub_element_variant TYPE REF TO if_ixml_element, - lo_sub_element_lpstr TYPE REF TO if_ixml_element, - lo_sub_element_i4 TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet. - - DATA: lv_value TYPE string. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node properties - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_properties - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_props_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:vt' - value = lc_xml_node_props_vt_ns ). - -********************************************************************** -* STEP 4: Create subnodes - " Application - lo_element = lo_document->create_simple_element( name = lc_xml_node_application - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~application. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " DocSecurity - lo_element = lo_document->create_simple_element( name = lc_xml_node_docsecurity - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~docsecurity. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " ScaleCrop - lo_element = lo_document->create_simple_element( name = lc_xml_node_scalecrop - parent = lo_document ). - lv_value = me->flag2bool( excel->zif_excel_book_properties~scalecrop ). - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " HeadingPairs - lo_element = lo_document->create_simple_element( name = lc_xml_node_headingpairs - parent = lo_document ). - - - " * vector node - lo_sub_element_vector = lo_document->create_simple_element_ns( name = lc_xml_node_vector - prefix = lc_vt_ns - parent = lo_document ). - lo_sub_element_vector->set_attribute_ns( name = lc_xml_attr_size - value = '2' ). - lo_sub_element_vector->set_attribute_ns( name = lc_xml_attr_basetype - value = lc_xml_node_variant ). - - " ** variant node - lo_sub_element_variant = lo_document->create_simple_element_ns( name = lc_xml_node_variant - prefix = lc_vt_ns - parent = lo_document ). - - " *** lpstr node - lo_sub_element_lpstr = lo_document->create_simple_element_ns( name = lc_xml_node_lpstr - prefix = lc_vt_ns - parent = lo_document ). - lv_value = excel->get_worksheets_name( ). - lo_sub_element_lpstr->set_value( value = lv_value ). - lo_sub_element_variant->append_child( new_child = lo_sub_element_lpstr ). " lpstr node - - lo_sub_element_vector->append_child( new_child = lo_sub_element_variant ). " variant node - - " ** variant node - lo_sub_element_variant = lo_document->create_simple_element_ns( name = lc_xml_node_variant - prefix = lc_vt_ns - parent = lo_document ). - - " *** i4 node - lo_sub_element_i4 = lo_document->create_simple_element_ns( name = lc_xml_node_i4 - prefix = lc_vt_ns - parent = lo_document ). - lv_value = excel->get_worksheets_size( ). - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element_i4->set_value( value = lv_value ). - lo_sub_element_variant->append_child( new_child = lo_sub_element_i4 ). " lpstr node - - lo_sub_element_vector->append_child( new_child = lo_sub_element_variant ). " variant node - - lo_element->append_child( new_child = lo_sub_element_vector ). " vector node - - lo_element_root->append_child( new_child = lo_element ). " HeadingPairs - - - " TitlesOfParts - lo_element = lo_document->create_simple_element( name = lc_xml_node_titlesofparts - parent = lo_document ). - - - " * vector node - lo_sub_element_vector = lo_document->create_simple_element_ns( name = lc_xml_node_vector - prefix = lc_vt_ns - parent = lo_document ). - lv_value = excel->get_worksheets_size( ). - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element_vector->set_attribute_ns( name = lc_xml_attr_size - value = lv_value ). - lo_sub_element_vector->set_attribute_ns( name = lc_xml_attr_basetype - value = lc_xml_node_lpstr ). - - lo_iterator = excel->get_worksheets_iterator( ). - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - " ** lpstr node - lo_sub_element_lpstr = lo_document->create_simple_element_ns( name = lc_xml_node_lpstr - prefix = lc_vt_ns - parent = lo_document ). - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - lv_value = lo_worksheet->get_title( ). - lo_sub_element_lpstr->set_value( value = lv_value ). - lo_sub_element_vector->append_child( new_child = lo_sub_element_lpstr ). " lpstr node - ENDWHILE. - - lo_element->append_child( new_child = lo_sub_element_vector ). " vector node - - lo_element_root->append_child( new_child = lo_element ). " TitlesOfParts - - - - " Company - IF excel->zif_excel_book_properties~company IS NOT INITIAL. - lo_element = lo_document->create_simple_element( name = lc_xml_node_company - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~company. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - " LinksUpToDate - lo_element = lo_document->create_simple_element( name = lc_xml_node_linksuptodate - parent = lo_document ). - lv_value = me->flag2bool( excel->zif_excel_book_properties~linksuptodate ). - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " SharedDoc - lo_element = lo_document->create_simple_element( name = lc_xml_node_shareddoc - parent = lo_document ). - lv_value = me->flag2bool( excel->zif_excel_book_properties~shareddoc ). - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " HyperlinksChanged - lo_element = lo_document->create_simple_element( name = lc_xml_node_hyperlinkschanged - parent = lo_document ). - lv_value = me->flag2bool( excel->zif_excel_book_properties~hyperlinkschanged ). - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " AppVersion - lo_element = lo_document->create_simple_element( name = lc_xml_node_appversion - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~appversion. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - method CREATE_DOCPROPS_CORE. - - -** Constant node name - DATA: lc_xml_node_coreproperties TYPE string VALUE 'coreProperties', - lc_xml_node_creator TYPE string VALUE 'creator', - lc_xml_node_description TYPE string VALUE 'description', - lc_xml_node_lastmodifiedby TYPE string VALUE 'lastModifiedBy', - lc_xml_node_created TYPE string VALUE 'created', - lc_xml_node_modified TYPE string VALUE 'modified', - " Node attributes - lc_xml_attr_type TYPE string VALUE 'type', - lc_xml_attr_target TYPE string VALUE 'dcterms:W3CDTF', - " Node namespace - lc_cp_ns TYPE string VALUE 'cp', - lc_dc_ns TYPE string VALUE 'dc', - lc_dcterms_ns TYPE string VALUE 'dcterms', -* lc_dcmitype_ns TYPE string VALUE 'dcmitype', - lc_xsi_ns TYPE string VALUE 'xsi', - lc_xml_node_cp_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties', - lc_xml_node_dc_ns TYPE string VALUE 'http://purl.org/dc/elements/1.1/', - lc_xml_node_dcterms_ns TYPE string VALUE 'http://purl.org/dc/terms/', - lc_xml_node_dcmitype_ns TYPE string VALUE 'http://purl.org/dc/dcmitype/', - lc_xml_node_xsi_ns TYPE string VALUE 'http://www.w3.org/2001/XMLSchema-instance'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_value TYPE string, - lv_date TYPE sydatum, - lv_time TYPE syuzeit. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node coreProperties - lo_element_root = lo_document->create_simple_element_ns( name = lc_xml_node_coreproperties - prefix = lc_cp_ns - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns:cp' - value = lc_xml_node_cp_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:dc' - value = lc_xml_node_dc_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:dcterms' - value = lc_xml_node_dcterms_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:dcmitype' - value = lc_xml_node_dcmitype_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:xsi' - value = lc_xml_node_xsi_ns ). - -********************************************************************** -* STEP 4: Create subnodes - " Creator node - lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_creator - prefix = lc_dc_ns - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~creator. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " Description node - lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_description - prefix = lc_dc_ns - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~description. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " lastModifiedBy node - lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_lastmodifiedby - prefix = lc_cp_ns - parent = lo_document ). - lv_value = excel->zif_excel_book_properties~lastmodifiedby. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " Created node - lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_created - prefix = lc_dcterms_ns - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - prefix = lc_xsi_ns - value = lc_xml_attr_target ). - - CONVERT TIME STAMP excel->zif_excel_book_properties~created TIME ZONE sy-zonlo INTO DATE lv_date TIME lv_time. - CONCATENATE lv_date lv_time INTO lv_value RESPECTING BLANKS. - REPLACE ALL OCCURRENCES OF REGEX '([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})' IN lv_value WITH '$1-$2-$3T$4:$5:$6Z'. -* lv_value = excel->zif_excel_book_properties~created. -* lv_value = '2010-07-04T14:58:53Z'. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " Modified node - lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_modified - prefix = lc_dcterms_ns - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - prefix = lc_xsi_ns - value = lc_xml_attr_target ). - CONVERT TIME STAMP excel->zif_excel_book_properties~modified TIME ZONE sy-zonlo INTO DATE lv_date TIME lv_time. - CONCATENATE lv_date lv_time INTO lv_value RESPECTING BLANKS. - REPLACE ALL OCCURRENCES OF REGEX '([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})' IN lv_value WITH '$1-$2-$3T$4:$5:$6Z'. -* lv_value = excel->zif_excel_book_properties~modified. -* lv_value = '2010-07-04T14:58:53Z'. - lo_element->set_value( value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - - - - - - - METHOD create_dxf_style. - - CONSTANTS: lc_xml_node_dxf TYPE string VALUE 'dxf', - lc_xml_node_font TYPE string VALUE 'font', - lc_xml_node_b TYPE string VALUE 'b', "bold - lc_xml_node_i TYPE string VALUE 'i', "italic - lc_xml_node_u TYPE string VALUE 'u', "underline - lc_xml_node_strike TYPE string VALUE 'strike', "strikethrough - lc_xml_attr_val TYPE string VALUE 'val', - lc_xml_node_fill TYPE string VALUE 'fill', - lc_xml_node_patternfill TYPE string VALUE 'patternFill', - lc_xml_attr_patterntype TYPE string VALUE 'patternType', - lc_xml_node_fgcolor TYPE string VALUE 'fgColor', - lc_xml_node_bgcolor TYPE string VALUE 'bgColor', - y TYPE i VALUE 0. - - DATA: ls_styles_mapping TYPE zexcel_s_styles_mapping, - ls_cellxfs TYPE zexcel_s_cellxfs, - ls_style_cond_mapping TYPE zexcel_s_styles_cond_mapping, - lo_sub_element TYPE REF TO if_ixml_element, - lo_sub_element_2 TYPE REF TO if_ixml_element, - lv_index TYPE i, - ls_font TYPE zexcel_s_style_font, - lo_element_font TYPE REF TO if_ixml_element, - lv_value TYPE string, - ls_fill TYPE zexcel_s_style_fill, - lo_element_fill TYPE REF TO if_ixml_element, - x. - - CHECK iv_cell_style IS NOT INITIAL. - - READ TABLE me->styles_mapping INTO ls_styles_mapping WITH KEY guid = iv_cell_style. - ADD 1 TO ls_styles_mapping-style. " the numbering starts from 0 - READ TABLE it_cellxfs INTO ls_cellxfs INDEX ls_styles_mapping-style. - ADD 1 TO ls_cellxfs-fillid. " the numbering starts from 0 - - READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY style = ls_styles_mapping-style. - IF sy-subrc EQ 0. - ls_style_cond_mapping-guid = iv_cell_style. - APPEND ls_style_cond_mapping TO me->styles_cond_mapping. - ELSE. - ls_style_cond_mapping-guid = iv_cell_style. - ls_style_cond_mapping-style = ls_styles_mapping-style. - ls_style_cond_mapping-dxf = cv_dfx_count. - APPEND ls_style_cond_mapping TO me->styles_cond_mapping. - ADD 1 TO cv_dfx_count. - - " dxf node - lo_sub_element = io_ixml_document->create_simple_element( name = lc_xml_node_dxf - parent = io_ixml_document ). - - "Conditional formatting font style correction by Alessandro Iannacci START - lv_index = ls_cellxfs-fontid + 1. - READ TABLE it_fonts INTO ls_font INDEX lv_index. - IF ls_font IS NOT INITIAL. - lo_element_font = io_ixml_document->create_simple_element( name = lc_xml_node_font - parent = io_ixml_document ). - IF ls_font-bold EQ abap_true. - lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_b - parent = io_ixml_document ). - lo_element_font->append_child( new_child = lo_sub_element_2 ). - ENDIF. - IF ls_font-italic EQ abap_true. - lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_i - parent = io_ixml_document ). - lo_element_font->append_child( new_child = lo_sub_element_2 ). - ENDIF. - IF ls_font-underline EQ abap_true. - lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_u - parent = io_ixml_document ). - lv_value = ls_font-underline_mode. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element_2 ). - ENDIF. - IF ls_font-strikethrough EQ abap_true. - lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_strike - parent = io_ixml_document ). - lo_element_font->append_child( new_child = lo_sub_element_2 ). - ENDIF. - "color - create_xl_styles_color_node( - io_document = io_ixml_document - io_parent = lo_element_font - is_color = ls_font-color ). - lo_sub_element->append_child( new_child = lo_element_font ). - ENDIF. - "---Conditional formatting font style correction by Alessandro Iannacci END - - - READ TABLE it_fills INTO ls_fill INDEX ls_cellxfs-fillid. - IF ls_fill IS NOT INITIAL. - " fill properties - lo_element_fill = io_ixml_document->create_simple_element( name = lc_xml_node_fill - parent = io_ixml_document ). - "pattern - lo_sub_element_2 = io_ixml_document->create_simple_element( name = lc_xml_node_patternfill - parent = io_ixml_document ). - lv_value = ls_fill-filltype. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_patterntype - value = lv_value ). - " fgcolor - create_xl_styles_color_node( - io_document = io_ixml_document - io_parent = lo_sub_element_2 - is_color = ls_fill-fgcolor - iv_color_elem_name = lc_xml_node_fgcolor ). - - IF ls_fill-fgcolor-rgb IS INITIAL AND - ls_fill-fgcolor-indexed EQ zcl_excel_style_color=>c_indexed_not_set AND - ls_fill-fgcolor-theme EQ zcl_excel_style_color=>c_theme_not_set AND - ls_fill-fgcolor-tint IS INITIAL AND ls_fill-bgcolor-indexed EQ zcl_excel_style_color=>c_indexed_sys_foreground. - - " bgcolor - create_xl_styles_color_node( - io_document = io_ixml_document - io_parent = lo_sub_element_2 - is_color = ls_fill-bgcolor - iv_color_elem_name = lc_xml_node_bgcolor ). - - ENDIF. - - lo_element_fill->append_child( new_child = lo_sub_element_2 ). "pattern - - lo_sub_element->append_child( new_child = lo_element_fill ). - ENDIF. - ENDIF. - - io_dxf_element->append_child( new_child = lo_sub_element ). -ENDMETHOD. - - - - method CREATE_RELATIONSHIPS. - - -** Constant node name - DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'Id', - lc_xml_attr_type TYPE string VALUE 'Type', - lc_xml_attr_target TYPE string VALUE 'Target', - " Node namespace - lc_xml_node_rels_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships', - " Node id - lc_xml_node_rId1_id TYPE string VALUE 'rId1', - lc_xml_node_rId2_id TYPE string VALUE 'rId2', - lc_xml_node_rId3_id TYPE string VALUE 'rId3', - " Node type - lc_xml_node_rId1_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', - lc_xml_node_rId2_tp TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', - lc_xml_node_rId3_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', - " Node target - lc_xml_node_rId1_tg TYPE string VALUE 'xl/workbook.xml', - lc_xml_node_rId2_tg TYPE string VALUE 'docProps/core.xml', - lc_xml_node_rId3_tg TYPE string VALUE 'docProps/app.xml'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_relationships - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_rels_ns ). - -********************************************************************** -* STEP 4: Create subnodes - " Theme node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lc_xml_node_rId3_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rId3_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rId3_tg ). - lo_element_root->append_child( new_child = lo_element ). - - " Styles node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lc_xml_node_rId2_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rId2_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rId2_tg ). - lo_element_root->append_child( new_child = lo_element ). - - " rels node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lc_xml_node_rId1_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rId1_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rId1_tg ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - - method CREATE_XL_CHARTS. - - -** Constant node name - CONSTANTS: lc_xml_node_chartspace TYPE string VALUE 'c:chartSpace', - lc_xml_node_ns_c TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/chart', - lc_xml_node_ns_a TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/main', - lc_xml_node_ns_r TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', - lc_xml_node_date1904 TYPE string VALUE 'c:date1904', - lc_xml_node_lang TYPE string VALUE 'c:lang', - lc_xml_node_roundedcorners TYPE string VALUE 'c:roundedCorners', - lc_xml_node_altcont TYPE string VALUE 'mc:AlternateContent', - lc_xml_node_altcont_ns_mc TYPE string VALUE 'http://schemas.openxmlformats.org/markup-compatibility/2006', - lc_xml_node_choice TYPE string VALUE 'mc:Choice', - lc_xml_node_choice_ns_requires TYPE string VALUE 'c14', - lc_xml_node_choice_ns_c14 TYPE string VALUE 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart', - lc_xml_node_style TYPE string VALUE 'c14:style', - lc_xml_node_fallback TYPE string VALUE 'mc:Fallback', - lc_xml_node_style2 TYPE string VALUE 'c:style', - - "---------------------------CHART - lc_xml_node_chart TYPE string VALUE 'c:chart', - lc_xml_node_autotitledeleted TYPE string VALUE 'c:autoTitleDeleted', - "plotArea - lc_xml_node_plotarea TYPE string VALUE 'c:plotArea', - lc_xml_node_layout TYPE string VALUE 'c:layout', - lc_xml_node_varycolors TYPE string VALUE 'c:varyColors', - lc_xml_node_ser TYPE string VALUE 'c:ser', - lc_xml_node_idx TYPE string VALUE 'c:idx', - lc_xml_node_order TYPE string VALUE 'c:order', - lc_xml_node_tx TYPE string VALUE 'c:tx', - lc_xml_node_v TYPE string VALUE 'c:v', - lc_xml_node_val TYPE string VALUE 'c:val', - lc_xml_node_cat TYPE string VALUE 'c:cat', - lc_xml_node_numref TYPE string VALUE 'c:numRef', - lc_xml_node_strref TYPE string VALUE 'c:strRef', - lc_xml_node_f TYPE string VALUE 'c:f', "this is the range - lc_xml_node_overlap TYPE string VALUE 'c:overlap', - "note: numcache avoided - lc_xml_node_dlbls TYPE string VALUE 'c:dLbls', - lc_xml_node_showlegendkey TYPE string VALUE 'c:showLegendKey', - lc_xml_node_showval TYPE string VALUE 'c:showVal', - lc_xml_node_showcatname TYPE string VALUE 'c:showCatName', - lc_xml_node_showsername TYPE string VALUE 'c:showSerName', - lc_xml_node_showpercent TYPE string VALUE 'c:showPercent', - lc_xml_node_showbubblesize TYPE string VALUE 'c:showBubbleSize', - "plotArea->pie - lc_xml_node_piechart TYPE string VALUE 'c:pieChart', - lc_xml_node_showleaderlines TYPE string VALUE 'c:showLeaderLines', - lc_xml_node_firstsliceang TYPE string VALUE 'c:firstSliceAng', - "plotArea->line - lc_xml_node_linechart TYPE string VALUE 'c:lineChart', - lc_xml_node_symbol TYPE string VALUE 'c:symbol', - lc_xml_node_marker TYPE string VALUE 'c:marker', - lc_xml_node_smooth TYPE string VALUE 'c:smooth', - "plotArea->bar - lc_xml_node_invertifnegative TYPE string VALUE 'c:invertIfNegative', - lc_xml_node_barchart TYPE string VALUE 'c:barChart', - lc_xml_node_bardir TYPE string VALUE 'c:barDir', - lc_xml_node_gapwidth TYPE string VALUE 'c:gapWidth', - "plotArea->line + plotArea->bar - lc_xml_node_grouping TYPE string VALUE 'c:grouping', - lc_xml_node_axid TYPE string VALUE 'c:axId', - lc_xml_node_catax TYPE string VALUE 'c:catAx', - lc_xml_node_valax TYPE string VALUE 'c:valAx', - lc_xml_node_scaling TYPE string VALUE 'c:scaling', - lc_xml_node_orientation TYPE string VALUE 'c:orientation', - lc_xml_node_delete TYPE string VALUE 'c:delete', - lc_xml_node_axpos TYPE string VALUE 'c:axPos', - lc_xml_node_numfmt TYPE string VALUE 'c:numFmt', - lc_xml_node_majorgridlines TYPE string VALUE 'c:majorGridlines', - lc_xml_node_majortickmark TYPE string VALUE 'c:majorTickMark', - lc_xml_node_minortickmark TYPE string VALUE 'c:minorTickMark', - lc_xml_node_ticklblpos TYPE string VALUE 'c:tickLblPos', - lc_xml_node_crossax TYPE string VALUE 'c:crossAx', - lc_xml_node_crosses TYPE string VALUE 'c:crosses', - lc_xml_node_auto TYPE string VALUE 'c:auto', - lc_xml_node_lblalgn TYPE string VALUE 'c:lblAlgn', - lc_xml_node_lbloffset TYPE string VALUE 'c:lblOffset', - lc_xml_node_nomultilvllbl TYPE string VALUE 'c:noMultiLvlLbl', - lc_xml_node_crossbetween TYPE string VALUE 'c:crossBetween', - "legend - lc_xml_node_legend TYPE string VALUE 'c:legend', - "legend->pie - lc_xml_node_legendpos TYPE string VALUE 'c:legendPos', -* lc_xml_node_layout TYPE string VALUE 'c:layout', "already exist - lc_xml_node_overlay TYPE string VALUE 'c:overlay', - lc_xml_node_txpr TYPE string VALUE 'c:txPr', - lc_xml_node_bodypr TYPE string VALUE 'a:bodyPr', - lc_xml_node_lststyle TYPE string VALUE 'a:lstStyle', - lc_xml_node_p TYPE string VALUE 'a:p', - lc_xml_node_ppr TYPE string VALUE 'a:pPr', - lc_xml_node_defrpr TYPE string VALUE 'a:defRPr', - lc_xml_node_endpararpr TYPE string VALUE 'a:endParaRPr', - "legend->bar + legend->line - lc_xml_node_plotvisonly TYPE string VALUE 'c:plotVisOnly', - lc_xml_node_dispblanksas TYPE string VALUE 'c:dispBlanksAs', - lc_xml_node_showdlblsovermax TYPE string VALUE 'c:showDLblsOverMax', - "---------------------------END OF CHART - - lc_xml_node_printsettings TYPE string VALUE 'c:printSettings', - lc_xml_node_headerfooter TYPE string VALUE 'c:headerFooter', - lc_xml_node_pagemargins TYPE string VALUE 'c:pageMargins', - lc_xml_node_pagesetup TYPE string VALUE 'c:pageSetup'. - - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element_cellanchor TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - DATA: lv_rel_id TYPE i. - - DATA lo_element TYPE REF TO if_ixml_element. - DATA lo_element2 TYPE REF TO if_ixml_element. - DATA lo_element3 TYPE REF TO if_ixml_element. - DATA lo_el_rootchart TYPE REF TO if_ixml_element. - DATA lo_element4 TYPE REF TO if_ixml_element. - DATA lo_element5 TYPE REF TO if_ixml_element. - DATA lo_element6 TYPE REF TO if_ixml_element. - DATA lo_element7 TYPE REF TO if_ixml_element. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -*********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_chartspace - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns:c' - value = lc_xml_node_ns_c ). - lo_element_root->set_attribute_ns( name = 'xmlns:a' - value = lc_xml_node_ns_a ). - lo_element_root->set_attribute_ns( name = 'xmlns:r' - value = lc_xml_node_ns_r ). - -********************************************************************** -* STEP 4: Create chart - - DATA lo_chartb TYPE REF TO zcl_excel_graph_bars. - DATA lo_chartp TYPE REF TO zcl_excel_graph_pie. - DATA lo_chartl TYPE REF TO zcl_excel_graph_line. - DATA lo_chart TYPE REF TO zcl_excel_graph. - - DATA ls_serie TYPE zcl_excel_graph=>s_series. - DATA ls_ax TYPE zcl_excel_graph_bars=>s_ax. - DATA lv_str TYPE string. - - "Identify chart type - CASE io_drawing->graph_type. - WHEN zcl_excel_drawing=>c_graph_bars. - lo_chartb ?= io_drawing->graph. - WHEN zcl_excel_drawing=>c_graph_pie. - lo_chartp ?= io_drawing->graph. - WHEN zcl_excel_drawing=>c_graph_line. - lo_chartl ?= io_drawing->graph. - WHEN OTHERS. - ENDCASE. - - - lo_chart = io_drawing->graph. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_date1904 - parent = lo_element_root ). - lo_element->set_attribute_ns( name = 'val' - value = lo_chart->ns_1904val ). - - lo_element = lo_document->create_simple_element( name = lc_xml_node_lang - parent = lo_element_root ). - lo_element->set_attribute_ns( name = 'val' - value = lo_chart->ns_langval ). - - lo_element = lo_document->create_simple_element( name = lc_xml_node_roundedcorners - parent = lo_element_root ). - lo_element->set_attribute_ns( name = 'val' - value = lo_chart->ns_roundedcornersval ). - - lo_element = lo_document->create_simple_element( name = lc_xml_node_altcont - parent = lo_element_root ). - lo_element->set_attribute_ns( name = 'xmlns:mc' - value = lc_xml_node_altcont_ns_mc ). - - "Choice - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_choice - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'Requires' - value = lc_xml_node_choice_ns_requires ). - lo_element2->set_attribute_ns( name = 'xmlns:c14' - value = lc_xml_node_choice_ns_c14 ). - - "C14:style - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_style - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chart->ns_c14styleval ). - - "Fallback - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_fallback - parent = lo_element ). - - "C:style - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_style2 - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chart->ns_styleval ). - - "---------------------------CHART - lo_element = lo_document->create_simple_element( name = lc_xml_node_chart - parent = lo_element_root ). - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_autotitledeleted - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'val' - value = lo_chart->ns_autotitledeletedval ). - - "plotArea - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotarea - parent = lo_element ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - CASE io_drawing->graph_type. - WHEN zcl_excel_drawing=>c_graph_bars. - "----bar - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_barchart - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_bardir - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartb->ns_bardirval ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_grouping - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartb->ns_groupingval ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varycolors - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartb->ns_varycolorsval ). - - "series - LOOP AT lo_chartb->series INTO ls_serie. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx - parent = lo_element4 ). - IF ls_serie-idx IS NOT INITIAL. - lv_str = ls_serie-idx. - ELSE. - lv_str = sy-tabix - 1. - ENDIF. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order - parent = lo_element4 ). - lv_str = ls_serie-order. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - IF ls_serie-sername IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v - parent = lo_element5 ). - lo_element6->set_value( value = ls_serie-sername ). - ENDIF. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_invertifnegative - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_serie-invertifnegative ). - IF ls_serie-lbl IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_strref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-lbl ). - ENDIF. - IF ls_serie-ref IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_val - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_numref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-ref ). - ENDIF. - ENDLOOP. - "endseries - IF lo_chartb->ns_groupingval = zcl_excel_graph_bars=>c_groupingval_stacked. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_overlap - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = '100' ). - ENDIF. - - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showlegendkey - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showlegendkeyval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showval - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showvalval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showcatname - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showcatnameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showsername - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showsernameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showpercent - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showpercentval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showbubblesize - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartb->ns_showbubblesizeval ). - - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_gapwidth - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartb->ns_gapwidthval ). - - "axes - lo_el_rootchart = lo_element3. - LOOP AT lo_chartb->axes INTO ls_ax. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_el_rootchart ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - CASE ls_ax-type. - WHEN zcl_excel_graph_bars=>c_catax. - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catax - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_ax-orientation ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'formatCode' - value = ls_ax-formatcode ). - lo_element4->set_attribute_ns( name = 'sourceLinked' - value = ls_ax-sourcelinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-ticklblpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossax ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crosses ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_auto - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-auto ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblalgn - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lblalgn ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lbloffset - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lbloffset ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_nomultilvllbl - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-nomultilvllbl ). - WHEN zcl_excel_graph_bars=>c_valax. - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valax - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_ax-orientation ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorgridlines - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'formatCode' - value = ls_ax-formatcode ). - lo_element4->set_attribute_ns( name = 'sourceLinked' - value = ls_ax-sourcelinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-ticklblpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossax ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crosses ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossbetween - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossbetween ). - WHEN OTHERS. - ENDCASE. - ENDLOOP. - "endaxes - - WHEN zcl_excel_drawing=>c_graph_pie. - "----pie - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_piechart - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varycolors - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartp->ns_varycolorsval ). - - "series - LOOP AT lo_chartp->series INTO ls_serie. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx - parent = lo_element4 ). - IF ls_serie-idx IS NOT INITIAL. - lv_str = ls_serie-idx. - ELSE. - lv_str = sy-tabix - 1. - ENDIF. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order - parent = lo_element4 ). - lv_str = ls_serie-order. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - IF ls_serie-sername IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v - parent = lo_element5 ). - lo_element6->set_value( value = ls_serie-sername ). - ENDIF. - IF ls_serie-lbl IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_strref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-lbl ). - ENDIF. - IF ls_serie-ref IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_val - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_numref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-ref ). - ENDIF. - ENDLOOP. - "endseries - - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showlegendkey - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showlegendkeyval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showval - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showvalval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showcatname - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showcatnameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showsername - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showsernameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showpercent - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showpercentval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showbubblesize - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showbubblesizeval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showleaderlines - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartp->ns_showleaderlinesval ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_firstsliceang - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartp->ns_firstsliceangval ). - WHEN zcl_excel_drawing=>c_graph_line. - "----line - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_linechart - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_grouping - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->ns_groupingval ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_varycolors - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->ns_varycolorsval ). - - "series - LOOP AT lo_chartl->series INTO ls_serie. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ser - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_idx - parent = lo_element4 ). - IF ls_serie-idx IS NOT INITIAL. - lv_str = ls_serie-idx. - ELSE. - lv_str = sy-tabix - 1. - ENDIF. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_order - parent = lo_element4 ). - lv_str = ls_serie-order. - CONDENSE lv_str. - lo_element5->set_attribute_ns( name = 'val' - value = lv_str ). - IF ls_serie-sername IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_tx - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_v - parent = lo_element5 ). - lo_element6->set_value( value = ls_serie-sername ). - ENDIF. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_marker - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_symbol - parent = lo_element5 ). - lo_element6->set_attribute_ns( name = 'val' - value = ls_serie-symbol ). - IF ls_serie-lbl IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_cat - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_strref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-lbl ). - ENDIF. - IF ls_serie-ref IS NOT INITIAL. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_val - parent = lo_element4 ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_numref - parent = lo_element5 ). - lo_element7 = lo_document->create_simple_element( name = lc_xml_node_f - parent = lo_element6 ). - lo_element7->set_value( value = ls_serie-ref ). - ENDIF. - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_smooth - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_serie-smooth ). - ENDLOOP. - "endseries - - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_dlbls - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showlegendkey - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showlegendkeyval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showval - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showvalval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showcatname - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showcatnameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showsername - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showsernameval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showpercent - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showpercentval ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_showbubblesize - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = lo_chartl->ns_showbubblesizeval ). - - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_marker - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->NS_MARKERVAL ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_smooth - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = lo_chartl->NS_SMOOTHVAL ). - - "axes - lo_el_rootchart = lo_element3. - LOOP AT lo_chartl->axes INTO ls_ax. - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_el_rootchart ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - CASE ls_ax-type. - WHEN zcl_excel_graph_line=>c_catax. - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_catax - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_ax-orientation ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axpos ). -* lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt -* parent = lo_element3 ). -* lo_element4->set_attribute_ns( name = 'formatCode' -* value = ls_ax-formatcode ). -* lo_element4->set_attribute_ns( name = 'sourceLinked' -* value = ls_ax-sourcelinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-ticklblpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossax ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crosses ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_auto - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-auto ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lblalgn - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lblalgn ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lbloffset - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-lbloffset ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_nomultilvllbl - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-nomultilvllbl ). - WHEN zcl_excel_graph_line=>c_valax. - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_valax - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axid - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axid ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_scaling - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_orientation - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'val' - value = ls_ax-orientation ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_delete - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-delete ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_axpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-axpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majorgridlines - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_numfmt - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'formatCode' - value = ls_ax-formatcode ). - lo_element4->set_attribute_ns( name = 'sourceLinked' - value = ls_ax-sourcelinked ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_majortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-majortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_minortickmark - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-minortickmark ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_ticklblpos - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-ticklblpos ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossax - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossax ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crosses - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crosses ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_crossbetween - parent = lo_element3 ). - lo_element4->set_attribute_ns( name = 'val' - value = ls_ax-crossbetween ). - WHEN OTHERS. - ENDCASE. - ENDLOOP. - "endaxes - - WHEN OTHERS. - ENDCASE. - - "legend - IF lo_chart->print_label EQ abap_true. - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_legend - parent = lo_element ). - CASE io_drawing->graph_type. - WHEN zcl_excel_drawing=>c_graph_bars. - "----bar - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartb->ns_legendposval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartb->ns_overlayval ). - WHEN zcl_excel_drawing=>c_graph_line. - "----line - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartl->ns_legendposval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartl->ns_overlayval ). - WHEN zcl_excel_drawing=>c_graph_pie. - "----pie - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_legendpos - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartp->ns_legendposval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_layout - parent = lo_element2 ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_overlay - parent = lo_element2 ). - lo_element3->set_attribute_ns( name = 'val' - value = lo_chartp->ns_overlayval ). - lo_element3 = lo_document->create_simple_element( name = lc_xml_node_txpr - parent = lo_element2 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_bodypr - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_lststyle - parent = lo_element3 ). - lo_element4 = lo_document->create_simple_element( name = lc_xml_node_p - parent = lo_element3 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_ppr - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'rtl' - value = lo_chartp->ns_pprrtl ). - lo_element6 = lo_document->create_simple_element( name = lc_xml_node_defrpr - parent = lo_element5 ). - lo_element5 = lo_document->create_simple_element( name = lc_xml_node_endpararpr - parent = lo_element4 ). - lo_element5->set_attribute_ns( name = 'lang' - value = lo_chartp->ns_endpararprlang ). - WHEN OTHERS. - ENDCASE. - ENDIF. - - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_plotvisonly - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'val' - value = lo_chart->ns_plotvisonlyval ). - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_dispblanksas - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'val' - value = lo_chart->ns_dispblanksasval ). - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_showdlblsovermax - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'val' - value = lo_chart->ns_showdlblsovermaxval ). - "---------------------------END OF CHART - - "printSettings - lo_element = lo_document->create_simple_element( name = lc_xml_node_printsettings - parent = lo_element_root ). - "headerFooter - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_headerfooter - parent = lo_element ). - "pageMargins - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_pagemargins - parent = lo_element ). - lo_element2->set_attribute_ns( name = 'b' - value = lo_chart->pagemargins-b ). - lo_element2->set_attribute_ns( name = 'l' - value = lo_chart->pagemargins-l ). - lo_element2->set_attribute_ns( name = 'r' - value = lo_chart->pagemargins-r ). - lo_element2->set_attribute_ns( name = 't' - value = lo_chart->pagemargins-t ). - lo_element2->set_attribute_ns( name = 'header' - value = lo_chart->pagemargins-header ). - lo_element2->set_attribute_ns( name = 'footer' - value = lo_chart->pagemargins-footer ). - "pageSetup - lo_element2 = lo_document->create_simple_element( name = lc_xml_node_pagesetup - parent = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - - method CREATE_XL_DRAWINGS. - - -** Constant node name - CONSTANTS: lc_xml_node_wsdr TYPE string VALUE 'xdr:wsDr', - lc_xml_node_ns_xdr TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing', - lc_xml_node_ns_a TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/main'. - - CONSTANTS: lc_on TYPE string VALUE '1', - lc_off TYPE string VALUE '0'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element_cellanchor TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_drawings TYPE REF TO zcl_excel_drawings, - lo_drawing TYPE REF TO zcl_excel_drawing. - DATA: lv_rel_id TYPE i. - - - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -*********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_wsdr - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns:xdr' - value = lc_xml_node_ns_xdr ). - lo_element_root->set_attribute_ns( name = 'xmlns:a' - value = lc_xml_node_ns_a ). - -********************************************************************** -* STEP 4: Create drawings - - CLEAR: lv_rel_id. - - lo_drawings = io_worksheet->get_drawings( ). - - lo_iterator = lo_drawings->get_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - - ADD 1 TO lv_rel_id. - lo_element_cellanchor = me->create_xl_drawing_anchor( - io_drawing = lo_drawing - io_document = lo_document - ip_index = lv_rel_id ). - - lo_element_root->append_child( new_child = lo_element_cellanchor ). - - ENDWHILE. - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - - method CREATE_XL_DRAWINGS_RELS. - -** Constant node name - DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'Id', - lc_xml_attr_type TYPE string VALUE 'Type', - lc_xml_attr_target TYPE string VALUE 'Target', - " Node namespace - lc_xml_node_rels_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships', - lc_xml_node_rid_image_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', - lc_xml_node_rid_chart_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_drawings TYPE REF TO zcl_excel_drawings, - lo_drawing TYPE REF TO zcl_excel_drawing. - - DATA: lv_value TYPE string, - lv_counter TYPE i. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_relationships - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_rels_ns ). - -********************************************************************** -* STEP 4: Create subnodes - - " Add sheet Relationship nodes here - lv_counter = 0. - lo_drawings = io_worksheet->get_drawings( ). - lo_iterator = lo_drawings->get_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_drawing ?= lo_iterator->if_object_collection_iterator~get_next( ). - ADD 1 TO lv_counter. - - lv_value = lv_counter. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_value ). - - lv_value = lo_drawing->get_media_name( ). - CASE lo_drawing->get_type( ). - WHEN zcl_excel_drawing=>type_image. - CONCATENATE '../media/' lv_value INTO lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_image_tp ). - - WHEN zcl_excel_drawing=>type_chart. - CONCATENATE '../charts/' lv_value INTO lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_chart_tp ). - - ENDCASE. - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDWHILE. - - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - - - - method CREATE_XL_DRAWING_ANCHOR. - -** Constant node name - CONSTANTS: lc_xml_node_onecellanchor TYPE string VALUE 'xdr:oneCellAnchor', - lc_xml_node_twocellanchor TYPE string VALUE 'xdr:twoCellAnchor', - lc_xml_node_from TYPE string VALUE 'xdr:from', - lc_xml_node_to TYPE string VALUE 'xdr:to', - lc_xml_node_pic TYPE string VALUE 'xdr:pic', - lc_xml_node_ext TYPE string VALUE 'xdr:ext', - lc_xml_node_clientdata TYPE string VALUE 'xdr:clientData', - - lc_xml_node_col TYPE string VALUE 'xdr:col', - lc_xml_node_coloff TYPE string VALUE 'xdr:colOff', - lc_xml_node_row TYPE string VALUE 'xdr:row', - lc_xml_node_rowoff TYPE string VALUE 'xdr:rowOff', - - lc_xml_node_nvpicpr TYPE string VALUE 'xdr:nvPicPr', - lc_xml_node_cnvpr TYPE string VALUE 'xdr:cNvPr', - lc_xml_node_cnvpicpr TYPE string VALUE 'xdr:cNvPicPr', - lc_xml_node_piclocks TYPE string VALUE 'a:picLocks', - - lc_xml_node_sppr TYPE string VALUE 'xdr:spPr', - lc_xml_node_apgeom TYPE string VALUE 'a:prstGeom', - lc_xml_node_aavlst TYPE string VALUE 'a:avLst', - - lc_xml_node_graphicframe TYPE string VALUE 'xdr:graphicFrame', - lc_xml_node_nvgraphicframepr TYPE string VALUE 'xdr:nvGraphicFramePr', - lc_xml_node_cnvgraphicframepr TYPE string VALUE 'xdr:cNvGraphicFramePr', - lc_xml_node_graphicframelocks TYPE string VALUE 'a:graphicFrameLocks', - lc_xml_node_xfrm TYPE string VALUE 'xdr:xfrm', - lc_xml_node_aoff TYPE string VALUE 'a:off', - lc_xml_node_aext TYPE string VALUE 'a:ext', - lc_xml_node_agraphic TYPE string VALUE 'a:graphic', - lc_xml_node_agraphicdata TYPE string VALUE 'a:graphicData', - - lc_xml_node_ns_c TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/chart', - lc_xml_node_cchart TYPE string VALUE 'c:chart', - - lc_xml_node_blipfill TYPE string VALUE 'xdr:blipFill', - lc_xml_node_ablip TYPE string VALUE 'a:blip', - lc_xml_node_astretch TYPE string VALUE 'a:stretch', - lc_xml_node_ns_r TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'. - - - CONSTANTS: lc_on TYPE string VALUE '1', - lc_off TYPE string VALUE '0'. - - DATA: lo_element_graphicframe TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_element2 TYPE REF TO if_ixml_element, - lo_element3 TYPE REF TO if_ixml_element, - lo_element_from TYPE REF TO if_ixml_element, - lo_element_to TYPE REF TO if_ixml_element, - lo_element_ext TYPE REF TO if_ixml_element, - lo_element_pic TYPE REF TO if_ixml_element, - lo_element_clientdata TYPE REF TO if_ixml_element, - - ls_position TYPE zexcel_drawing_position, - - lv_col TYPE string, " zexcel_cell_column, - lv_row TYPE string, " zexcel_cell_row. - lv_col_offset TYPE string, - lv_row_offset TYPE string, - lv_value TYPE string. - - ls_position = io_drawing->get_position( ). - - IF ls_position-anchor = 'ONE'. - ep_anchor = io_document->create_simple_element( name = lc_xml_node_onecellanchor - parent = io_document ). - ELSE. - ep_anchor = io_document->create_simple_element( name = lc_xml_node_twocellanchor - parent = io_document ). - ENDIF. - -* from cell ****************************** - lo_element_from = io_document->create_simple_element( name = lc_xml_node_from - parent = io_document ). - - lv_col = ls_position-from-col. - lv_row = ls_position-from-row. - lv_col_offset = ls_position-from-col_offset. - lv_row_offset = ls_position-from-row_offset. - CONDENSE lv_col NO-GAPS. - CONDENSE lv_row NO-GAPS. - CONDENSE lv_col_offset NO-GAPS. - CONDENSE lv_row_offset NO-GAPS. - - lo_element = io_document->create_simple_element( name = lc_xml_node_col - parent = io_document ). - lo_element->set_value( value = lv_col ). - lo_element_from->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_coloff - parent = io_document ). - lo_element->set_value( value = lv_col_offset ). - lo_element_from->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_row - parent = io_document ). - lo_element->set_value( value = lv_row ). - lo_element_from->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_rowoff - parent = io_document ). - lo_element->set_value( value = lv_row_offset ). - lo_element_from->append_child( new_child = lo_element ). - ep_anchor->append_child( new_child = lo_element_from ). - - IF ls_position-anchor = 'ONE'. - -* ext ****************************** - lo_element_ext = io_document->create_simple_element( name = lc_xml_node_ext - parent = io_document ). - - lv_value = io_drawing->get_width_emu_str( ). - lo_element_ext->set_attribute_ns( name = 'cx' - value = lv_value ). - lv_value = io_drawing->get_height_emu_str( ). - lo_element_ext->set_attribute_ns( name = 'cy' - value = lv_value ). - ep_anchor->append_child( new_child = lo_element_ext ). - - ELSEIF ls_position-anchor = 'TWO'. - -* to cell ****************************** - lo_element_to = io_document->create_simple_element( name = lc_xml_node_to - parent = io_document ). - - lv_col = ls_position-to-col. - lv_row = ls_position-to-row. - lv_col_offset = ls_position-to-col_offset. - lv_row_offset = ls_position-to-row_offset. - CONDENSE lv_col NO-GAPS. - CONDENSE lv_row NO-GAPS. - CONDENSE lv_col_offset NO-GAPS. - CONDENSE lv_row_offset NO-GAPS. - - lo_element = io_document->create_simple_element( name = lc_xml_node_col - parent = io_document ). - lo_element->set_value( value = lv_col ). - lo_element_to->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_coloff - parent = io_document ). - lo_element->set_value( value = lv_col_offset ). - lo_element_to->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_row - parent = io_document ). - lo_element->set_value( value = lv_row ). - lo_element_to->append_child( new_child = lo_element ). - - lo_element = io_document->create_simple_element( name = lc_xml_node_rowoff - parent = io_document ). - lo_element->set_value( value = lv_row_offset ). - lo_element_to->append_child( new_child = lo_element ). - ep_anchor->append_child( new_child = lo_element_to ). - - ENDIF. - - CASE io_drawing->get_type( ). - WHEN zcl_excel_drawing=>type_image. -* pic ********************************** - lo_element_pic = io_document->create_simple_element( name = lc_xml_node_pic - parent = io_document ). -* nvPicPr - lo_element = io_document->create_simple_element( name = lc_xml_node_nvpicpr - parent = io_document ). -* cNvPr - lo_element2 = io_document->create_simple_element( name = lc_xml_node_cnvpr - parent = io_document ). - lv_value = sy-index. - CONDENSE lv_value. - lo_element2->set_attribute_ns( name = 'id' - value = lv_value ). - lo_element2->set_attribute_ns( name = 'name' - value = io_drawing->title ). - lo_element->append_child( new_child = lo_element2 ). - -* cNvPicPr - lo_element2 = io_document->create_simple_element( name = lc_xml_node_cnvpicpr - parent = io_document ). - -* picLocks - lo_element3 = io_document->create_simple_element( name = lc_xml_node_piclocks - parent = io_document ). - lo_element3->set_attribute_ns( name = 'noChangeAspect' - value = '1' ). - - lo_element2->append_child( new_child = lo_element3 ). - lo_element->append_child( new_child = lo_element2 ). - lo_element_pic->append_child( new_child = lo_element ). - -* blipFill - lv_value = ip_index. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - - lo_element = io_document->create_simple_element( name = lc_xml_node_blipfill - parent = io_document ). - lo_element2 = io_document->create_simple_element( name = lc_xml_node_ablip - parent = io_document ). - lo_element2->set_attribute_ns( name = 'xmlns:r' - value = lc_xml_node_ns_r ). - lo_element2->set_attribute_ns( name = 'r:embed' - value = lv_value ). - lo_element->append_child( new_child = lo_element2 ). - - lo_element2 = io_document->create_simple_element( name = lc_xml_node_astretch - parent = io_document ). - lo_element->append_child( new_child = lo_element2 ). - - lo_element_pic->append_child( new_child = lo_element ). - -* spPr - lo_element = io_document->create_simple_element( name = lc_xml_node_sppr - parent = io_document ). - - lo_element2 = io_document->create_simple_element( name = lc_xml_node_apgeom - parent = io_document ). - lo_element2->set_attribute_ns( name = 'prst' - value = 'rect' ). - lo_element3 = io_document->create_simple_element( name = lc_xml_node_aavlst - parent = io_document ). - lo_element2->append_child( new_child = lo_element3 ). - lo_element->append_child( new_child = lo_element2 ). - - lo_element_pic->append_child( new_child = lo_element ). - ep_anchor->append_child( new_child = lo_element_pic ). - WHEN zcl_excel_drawing=>type_chart. -* graphicFrame ********************************** - lo_element_graphicframe = io_document->create_simple_element( name = lc_xml_node_graphicframe - parent = io_document ). -* nvGraphicFramePr - lo_element = io_document->create_simple_element( name = lc_xml_node_nvgraphicframepr - parent = io_document ). -* cNvPr - lo_element2 = io_document->create_simple_element( name = lc_xml_node_cnvpr - parent = io_document ). - lv_value = sy-index. - CONDENSE lv_value. - lo_element2->set_attribute_ns( name = 'id' - value = lv_value ). - lo_element2->set_attribute_ns( name = 'name' - value = io_drawing->title ). - lo_element->append_child( new_child = lo_element2 ). -* cNvGraphicFramePr - lo_element2 = io_document->create_simple_element( name = lc_xml_node_cnvgraphicframepr - parent = io_document ). - lo_element3 = io_document->create_simple_element( name = lc_xml_node_graphicframelocks - parent = io_document ). - lo_element2->append_child( new_child = lo_element3 ). - lo_element->append_child( new_child = lo_element2 ). - lo_element_graphicframe->append_child( new_child = lo_element ). - -* xfrm - lo_element = io_document->create_simple_element( name = lc_xml_node_xfrm - parent = io_document ). -* off - lo_element2 = io_document->create_simple_element( name = lc_xml_node_aoff - parent = io_document ). - lo_element2->set_attribute_ns( name = 'y' value = '0' ). - lo_element2->set_attribute_ns( name = 'x' value = '0' ). - lo_element->append_child( new_child = lo_element2 ). -* ext - lo_element2 = io_document->create_simple_element( name = lc_xml_node_aext - parent = io_document ). - lo_element2->set_attribute_ns( name = 'cy' value = '0' ). - lo_element2->set_attribute_ns( name = 'cx' value = '0' ). - lo_element->append_child( new_child = lo_element2 ). - lo_element_graphicframe->append_child( new_child = lo_element ). - -* graphic - lo_element = io_document->create_simple_element( name = lc_xml_node_agraphic - parent = io_document ). -* graphicData - lo_element2 = io_document->create_simple_element( name = lc_xml_node_agraphicdata - parent = io_document ). - lo_element2->set_attribute_ns( name = 'uri' value = lc_xml_node_ns_c ). - -* chart - lo_element3 = io_document->create_simple_element( name = lc_xml_node_cchart - parent = io_document ). - - lo_element3->set_attribute_ns( name = 'xmlns:r' - value = lc_xml_node_ns_r ). - lo_element3->set_attribute_ns( name = 'xmlns:c' - value = lc_xml_node_ns_c ). - - lv_value = ip_index. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - lo_element3->set_attribute_ns( name = 'r:id' - value = lv_value ). - lo_element2->append_child( new_child = lo_element3 ). - lo_element->append_child( new_child = lo_element2 ). - lo_element_graphicframe->append_child( new_child = lo_element ). - ep_anchor->append_child( new_child = lo_element_graphicframe ). - - ENDCASE. - -* client data *************************** - lo_element_clientdata = io_document->create_simple_element( name = lc_xml_node_clientdata - parent = io_document ). - ep_anchor->append_child( new_child = lo_element_clientdata ). - - endmethod. - - - - method CREATE_XL_RELATIONSHIPS. - - -** Constant node name - DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'Id', - lc_xml_attr_type TYPE string VALUE 'Type', - lc_xml_attr_target TYPE string VALUE 'Target', - " Node namespace - lc_xml_node_rels_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships', - " Node id - lc_xml_node_ridx_id TYPE string VALUE 'rId#', - " Node type - lc_xml_node_rid_sheet_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', - lc_xml_node_rid_theme_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', - lc_xml_node_rid_styles_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', - lc_xml_node_rid_shared_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', - " Node target - lc_xml_node_ridx_tg TYPE string VALUE 'worksheets/sheet#.xml', - lc_xml_node_rid_shared_tg TYPE string VALUE 'sharedStrings.xml', - lc_xml_node_rid_styles_tg TYPE string VALUE 'styles.xml', - lc_xml_node_rid_theme_tg TYPE string VALUE 'theme/theme1.xml'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_xml_node_ridx_tg TYPE string, - lv_xml_node_ridx_id TYPE string, - lv_size TYPE i, - lv_syindex(3) TYPE c. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_relationships - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_rels_ns ). - -********************************************************************** -* STEP 4: Create subnodes - - lv_size = excel->get_worksheets_size( ). - - - " Relationship node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lv_size = lv_size + 1. - lv_syindex = lv_size. - shift lv_syindex RIGHT DELETING TRAILING space. - shift lv_syindex left DELETING leading space. - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - replace all occurrences of '#' in lv_xml_node_ridx_id with lv_syindex. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_xml_node_ridx_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_theme_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rid_theme_tg ). - lo_element_root->append_child( new_child = lo_element ). - - - " Relationship node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lv_size = lv_size + 1. - lv_syindex = lv_size. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_id WITH lv_syindex. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_xml_node_ridx_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_styles_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rid_styles_tg ). - lo_element_root->append_child( new_child = lo_element ). - - - - lv_size = excel->get_worksheets_size( ). - - DO lv_size TIMES. - " Relationship node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - lv_xml_node_ridx_tg = lc_xml_node_ridx_tg. - lv_syindex = sy-index. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_id WITH lv_syindex. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_tg WITH lv_syindex. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_xml_node_ridx_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_sheet_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lv_xml_node_ridx_tg ). - lo_element_root->append_child( new_child = lo_element ). - ENDDO. - - " Relationship node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - ADD 3 TO lv_size. - lv_syindex = lv_size. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_id WITH lv_syindex. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_xml_node_ridx_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_shared_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rid_shared_tg ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - endmethod. - - - - METHOD create_xl_sharedstrings. - - -** Constant node name - DATA: lc_xml_node_sst TYPE string VALUE 'sst', - lc_xml_node_si TYPE string VALUE 'si', - lc_xml_node_t TYPE string VALUE 't', - " Node attributes - lc_xml_attr_count TYPE string VALUE 'count', - lc_xml_attr_uniquecount TYPE string VALUE 'uniqueCount', - " Node namespace - lc_xml_node_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_sub_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet. - - DATA: lt_cell_data TYPE zexcel_t_cell_data_unsorted, - ls_shared_string TYPE zexcel_s_shared_string, - lv_value TYPE string, - lv_count_str TYPE string, - lv_uniquecount_str TYPE string, - lv_sytabix TYPE sytabix, - lv_count TYPE i, - lv_uniquecount TYPE i. - - FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data, - <fs_sheet_string> TYPE zexcel_s_shared_string. - -********************************************************************** -* STEP 1: Collect strings from each worksheet - lo_iterator = excel->get_worksheets_iterator( ). - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - APPEND LINES OF lo_worksheet->sheet_content TO lt_cell_data. - ENDWHILE. - - DELETE lt_cell_data WHERE cell_formula IS NOT INITIAL. " delete formula content - - DESCRIBE TABLE lt_cell_data LINES lv_count. - MOVE lv_count TO lv_count_str. - - SHIFT lv_count_str RIGHT DELETING TRAILING space. - SHIFT lv_count_str LEFT DELETING LEADING space. - - SORT lt_cell_data BY cell_value. - DELETE ADJACENT DUPLICATES FROM lt_cell_data COMPARING cell_value. - - DESCRIBE TABLE lt_cell_data LINES lv_uniquecount. - MOVE lv_uniquecount TO lv_uniquecount_str. - - SHIFT lv_uniquecount_str RIGHT DELETING TRAILING space. - SHIFT lv_uniquecount_str LEFT DELETING LEADING space. - - clear lv_count. - LOOP AT lt_cell_data ASSIGNING <fs_sheet_content> where data_type = 's'. -* lv_sytabix = sy-tabix - 1. - lv_sytabix = lv_count. - MOVE lv_sytabix TO ls_shared_string-string_no. - MOVE <fs_sheet_content>-cell_value TO ls_shared_string-string_value. - MOVE <fs_sheet_content>-data_type TO ls_shared_string-string_type. - APPEND ls_shared_string TO shared_strings. - add 1 to lv_count. - ENDLOOP. - - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_sst - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_ns ). - lo_element_root->set_attribute_ns( name = lc_xml_attr_count - value = lv_count_str ). - lo_element_root->set_attribute_ns( name = lc_xml_attr_uniquecount - value = lv_uniquecount_str ). - -********************************************************************** -* STEP 4: Create subnode - LOOP AT shared_strings ASSIGNING <fs_sheet_string>. - lo_element = lo_document->create_simple_element( name = lc_xml_node_si - parent = lo_document ). - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t - parent = lo_document ). -* if <fs_sheet_string>-string_type EQ 's_leading_blanks'. - IF <fs_sheet_string>-string_value IS NOT INITIAL AND <fs_sheet_string>-string_value(1) EQ ` `. - lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ). - ENDIF. - lo_sub_element->set_value( value = <fs_sheet_string>-string_value ). - lo_element->append_child( new_child = lo_sub_element ). - lo_element_root->append_child( new_child = lo_element ). - ENDLOOP. - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - - - - - METHOD create_xl_sheet. -*--------------------------------------------------------------------* -* issue #330 - Adding ColorScale conditional formatting -* - Ivan Femia, 2014-08-25 -*--------------------------------------------------------------------* - - TYPES: BEGIN OF colors, - colorrgb TYPE zexcel_color, - END OF colors. - -*--------------------------------------------------------------------* -* issue #237 - Error writing column-style -* - Stefan Schmoecker, 2012-11-01 -*--------------------------------------------------------------------* - - TYPES: BEGIN OF cfvo, - value TYPE zexcel_conditional_value, - type TYPE zexcel_conditional_type, - END OF cfvo. - -*--------------------------------------------------------------------* -* issue #220 - If cell in tables-area don't use default from row or column or sheet - Declarations 1 - start -*--------------------------------------------------------------------* - TYPES: BEGIN OF lty_table_area, - left TYPE i, - right TYPE i, - top TYPE i, - bottom TYPE i, - END OF lty_table_area. -*--------------------------------------------------------------------* -* issue #220 - If cell in tables-area don't use default from row or column or sheet - Declarations 1 - end -*--------------------------------------------------------------------* -** Constants - CONSTANTS: - lc_dummy_cell_content TYPE zexcel_s_cell_data-cell_value VALUE '})~~~ This is a dummy value for ABAP2XLSX and you should never find this in a real excelsheet Ihope'. - - -** Constant node name - DATA: lc_xml_node_worksheet TYPE string VALUE 'worksheet', - lc_xml_node_sheetpr TYPE string VALUE 'sheetPr', - lc_xml_node_tabcolor TYPE string VALUE 'tabColor', - lc_xml_node_outlinepr TYPE string VALUE 'outlinePr', - lc_xml_node_dimension TYPE string VALUE 'dimension', - lc_xml_node_sheetviews TYPE string VALUE 'sheetViews', - lc_xml_node_sheetview TYPE string VALUE 'sheetView', - lc_xml_node_selection TYPE string VALUE 'selection', - lc_xml_node_pane TYPE string VALUE 'pane', - lc_xml_node_sheetformatpr TYPE string VALUE 'sheetFormatPr', - lc_xml_node_cols TYPE string VALUE 'cols', - lc_xml_node_col TYPE string VALUE 'col', -* lc_xml_node_sheetdata TYPE string VALUE 'sheetData', -* lc_xml_node_row TYPE string VALUE 'row', -* lc_xml_node_c TYPE string VALUE 'c', -* lc_xml_node_v TYPE string VALUE 'v', -* lc_xml_node_f TYPE string VALUE 'f', - lc_xml_node_sheetprotection TYPE string VALUE 'sheetProtection', - lc_xml_node_pagemargins TYPE string VALUE 'pageMargins', - lc_xml_node_pagesetup TYPE string VALUE 'pageSetup', - lc_xml_node_pagesetuppr TYPE string VALUE 'pageSetUpPr', - lc_xml_node_condformatting TYPE string VALUE 'conditionalFormatting', - lc_xml_node_cfrule TYPE string VALUE 'cfRule', - lc_xml_node_color TYPE string VALUE 'color', " Databar by Albert Lladanosa - lc_xml_node_databar TYPE string VALUE 'dataBar', " Databar by Albert Lladanosa - lc_xml_node_colorscale TYPE string VALUE 'colorScale', - lc_xml_node_iconset TYPE string VALUE 'iconSet', - lc_xml_node_cfvo TYPE string VALUE 'cfvo', - lc_xml_node_formula TYPE string VALUE 'formula', - lc_xml_node_datavalidations TYPE string VALUE 'dataValidations', - lc_xml_node_datavalidation TYPE string VALUE 'dataValidation', - lc_xml_node_formula1 TYPE string VALUE 'formula1', - lc_xml_node_formula2 TYPE string VALUE 'formula2', - lc_xml_node_mergecell TYPE string VALUE 'mergeCell', - lc_xml_node_mergecells TYPE string VALUE 'mergeCells', - lc_xml_node_drawing TYPE string VALUE 'drawing', - lc_xml_node_headerfooter TYPE string VALUE 'headerFooter', - lc_xml_node_oddheader TYPE string VALUE 'oddHeader', - lc_xml_node_oddfooter TYPE string VALUE 'oddFooter', - lc_xml_node_evenheader TYPE string VALUE 'evenHeader', - lc_xml_node_evenfooter TYPE string VALUE 'evenFooter', - lc_xml_node_autofilter TYPE string VALUE 'autoFilter', - lc_xml_node_filtercolumn TYPE string VALUE 'filterColumn', - lc_xml_node_filters TYPE string VALUE 'filters', - lc_xml_node_filter TYPE string VALUE 'filter', - " Node attributes - lc_xml_attr_ref TYPE string VALUE 'ref', - lc_xml_attr_summarybelow TYPE string VALUE 'summaryBelow', - lc_xml_attr_summaryright TYPE string VALUE 'summaryRight', - lc_xml_attr_tabselected TYPE string VALUE 'tabSelected', - lc_xml_attr_showzeros TYPE string VALUE 'showZeros', - lc_xml_attr_zoomscale TYPE string VALUE 'zoomScale', - lc_xml_attr_zoomscalenormal TYPE string VALUE 'zoomScaleNormal', - lc_xml_attr_zoomscalepageview TYPE string VALUE 'zoomScalePageLayoutView', - lc_xml_attr_zoomscalesheetview TYPE string VALUE 'zoomScaleSheetLayoutView', - lc_xml_attr_workbookviewid TYPE string VALUE 'workbookViewId', - lc_xml_attr_showgridlines TYPE string VALUE 'showGridLines', - lc_xml_attr_gridlines TYPE string VALUE 'gridLines', - lc_xml_attr_showrowcolheaders TYPE string VALUE 'showRowColHeaders', - lc_xml_attr_activecell TYPE string VALUE 'activeCell', - lc_xml_attr_sqref TYPE string VALUE 'sqref', - lc_xml_attr_min TYPE string VALUE 'min', - lc_xml_attr_max TYPE string VALUE 'max', - lc_xml_attr_hidden TYPE string VALUE 'hidden', - lc_xml_attr_width TYPE string VALUE 'width', - lc_xml_attr_defaultwidth TYPE string VALUE '9.10', - lc_xml_attr_style TYPE string VALUE 'style', - lc_xml_attr_true TYPE string VALUE 'true', - lc_xml_attr_bestfit TYPE string VALUE 'bestFit', - lc_xml_attr_customheight TYPE string VALUE 'customHeight', - lc_xml_attr_customwidth TYPE string VALUE 'customWidth', - lc_xml_attr_collapsed TYPE string VALUE 'collapsed', - lc_xml_attr_defaultrowheight TYPE string VALUE 'defaultRowHeight', - lc_xml_attr_defaultcolwidth TYPE string VALUE 'defaultColWidth', - lc_xml_attr_outlinelevelrow TYPE string VALUE 'x14ac:outlineLevelRow', - lc_xml_attr_outlinelevelcol TYPE string VALUE 'x14ac:outlineLevelCol', - lc_xml_attr_outlinelevel TYPE string VALUE 'outlineLevel', -* lc_xml_attr_r TYPE string VALUE 'r', -* lc_xml_attr_s TYPE string VALUE 's', -* lc_xml_attr_spans TYPE string VALUE 'spans', -* lc_xml_attr_t TYPE string VALUE 't', - lc_xml_attr_password TYPE string VALUE 'password', - lc_xml_attr_sheet TYPE string VALUE 'sheet', - lc_xml_attr_objects TYPE string VALUE 'objects', - lc_xml_attr_scenarios TYPE string VALUE 'scenarios', - lc_xml_attr_autofilter TYPE string VALUE 'autoFilter', - lc_xml_attr_deletecolumns TYPE string VALUE 'deleteColumns', - lc_xml_attr_deleterows TYPE string VALUE 'deleteRows', - lc_xml_attr_formatcells TYPE string VALUE 'formatCells', - lc_xml_attr_formatcolumns TYPE string VALUE 'formatColumns', - lc_xml_attr_formatrows TYPE string VALUE 'formatRows', - lc_xml_attr_insertcolumns TYPE string VALUE 'insertColumns', - lc_xml_attr_inserthyperlinks TYPE string VALUE 'insertHyperlinks', - lc_xml_attr_insertrows TYPE string VALUE 'insertRows', - lc_xml_attr_pivottables TYPE string VALUE 'pivotTables', - lc_xml_attr_selectlockedcells TYPE string VALUE 'selectLockedCells', - lc_xml_attr_selectunlockedcell TYPE string VALUE 'selectUnlockedCells', - lc_xml_attr_sort TYPE string VALUE 'sort', - lc_xml_attr_left TYPE string VALUE 'left', - lc_xml_attr_right TYPE string VALUE 'right', - lc_xml_attr_top TYPE string VALUE 'top', - lc_xml_attr_bottom TYPE string VALUE 'bottom', - lc_xml_attr_header TYPE string VALUE 'header', - lc_xml_attr_footer TYPE string VALUE 'footer', - lc_xml_attr_type TYPE string VALUE 'type', - lc_xml_attr_iconset TYPE string VALUE 'iconSet', - lc_xml_attr_showvalue TYPE string VALUE 'showValue', - lc_xml_attr_val TYPE string VALUE 'val', - lc_xml_attr_dxfid TYPE string VALUE 'dxfId', - lc_xml_attr_priority TYPE string VALUE 'priority', - lc_xml_attr_operator TYPE string VALUE 'operator', - lc_xml_attr_allowblank TYPE string VALUE 'allowBlank', - lc_xml_attr_showinputmessage TYPE string VALUE 'showInputMessage', - lc_xml_attr_showerrormessage TYPE string VALUE 'showErrorMessage', - lc_xml_attr_showdropdown TYPE string VALUE 'showDropDown', - lc_xml_attr_errortitle TYPE string VALUE 'errorTitle', - lc_xml_attr_error TYPE string VALUE 'error', - lc_xml_attr_prompttitle TYPE string VALUE 'promptTitle', - lc_xml_attr_prompt TYPE string VALUE 'prompt', - lc_xml_attr_count TYPE string VALUE 'count', - lc_xml_attr_blackandwhite TYPE string VALUE 'blackAndWhite', - lc_xml_attr_cellcomments TYPE string VALUE 'cellComments', - lc_xml_attr_copies TYPE string VALUE 'copies', - lc_xml_attr_draft TYPE string VALUE 'draft', - lc_xml_attr_errors TYPE string VALUE 'errors', - lc_xml_attr_firstpagenumber TYPE string VALUE 'firstPageNumber', - lc_xml_attr_fittopage TYPE string VALUE 'fitToPage', - lc_xml_attr_fittoheight TYPE string VALUE 'fitToHeight', - lc_xml_attr_fittowidth TYPE string VALUE 'fitToWidth', - lc_xml_attr_horizontaldpi TYPE string VALUE 'horizontalDpi', - lc_xml_attr_orientation TYPE string VALUE 'orientation', - lc_xml_attr_pageorder TYPE string VALUE 'pageOrder', - lc_xml_attr_paperheight TYPE string VALUE 'paperHeight', - lc_xml_attr_papersize TYPE string VALUE 'paperSize', - lc_xml_attr_paperwidth TYPE string VALUE 'paperWidth', - lc_xml_attr_scale TYPE string VALUE 'scale', - lc_xml_attr_usefirstpagenumber TYPE string VALUE 'useFirstPageNumber', - lc_xml_attr_useprinterdefaults TYPE string VALUE 'usePrinterDefaults', - lc_xml_attr_verticaldpi TYPE string VALUE 'verticalDpi', - lc_xml_attr_differentoddeven TYPE string VALUE 'differentOddEven', - lc_xml_attr_colid TYPE string VALUE 'colId', - lc_xml_attr_filtermode TYPE string VALUE 'filterMode', - lc_xml_attr_tabcolor_rgb TYPE string VALUE 'rgb', - lc_xml_attr_tabcolor_theme TYPE string VALUE 'theme', - " Node namespace - lc_xml_node_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', - lc_xml_node_r_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', - lc_xml_node_comp_ns TYPE string VALUE 'http://schemas.openxmlformats.org/markup-compatibility/2006', - lc_xml_node_comp_pref TYPE string VALUE 'x14ac', - lc_xml_node_ig_ns TYPE string VALUE 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_element_2 TYPE REF TO if_ixml_element, - lo_element_3 TYPE REF TO if_ixml_element, - lo_element_4 TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_style_conditional TYPE REF TO zcl_excel_style_conditional, - lo_data_validation TYPE REF TO zcl_excel_data_validation, - lo_table TYPE REF TO zcl_excel_table, - row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, - lo_row_dim_empty TYPE REF TO zcl_excel_worksheet_rowdimensi, - default_col_dimension TYPE REF TO zcl_excel_worksheet_columndime, - default_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi. - - DATA: lv_value TYPE string, - lt_range_merge TYPE string_table, - lv_merge TYPE string, - lv_column_p TYPE zexcel_cell_column_alpha, - lv_column TYPE zexcel_cell_column, - lv_cell_value TYPE zexcel_cell_value, - lv_style_guid TYPE zexcel_cell_style, - lv_flag TYPE c, - ls_databar TYPE zexcel_conditional_databar, " Databar by Albert Lladanosa - ls_colorscale TYPE zexcel_conditional_colorscale, - ls_iconset TYPE zexcel_conditional_iconset, - ls_cellis TYPE zexcel_conditional_cellis, - ls_expression TYPE zexcel_conditional_expression, - ls_conditional_top10 TYPE zexcel_conditional_top10, - ls_conditional_above_avg TYPE zexcel_conditional_above_avg, - lt_cfvo TYPE TABLE OF cfvo, - ls_cfvo TYPE cfvo, - lt_colors TYPE TABLE OF colors, - ls_colors TYPE colors, - lv_cell_row_s TYPE string, - ls_last_row TYPE zexcel_s_cell_data, - ls_style_mapping TYPE zexcel_s_styles_mapping, - lv_freeze_cell_row TYPE zexcel_cell_row, - lv_freeze_cell_column TYPE zexcel_cell_column, - lv_freeze_cell_column_alpha TYPE zexcel_cell_column_alpha, - column_dimensions TYPE zexcel_t_worksheet_columndime, - row_dimensions TYPE zexcel_t_worksheet_rowdimensio, - ls_style_cond_mapping TYPE zexcel_s_styles_cond_mapping, - lv_relation_id TYPE i VALUE 0, - outline_level_row TYPE i VALUE 0, - outline_level_col TYPE i VALUE 0, - lv_current_row TYPE i, - lv_next_row TYPE i, - ls_sheet_content LIKE LINE OF io_worksheet->sheet_content, - ls_sheet_content_empty LIKE LINE OF io_worksheet->sheet_content, - lv_last_row TYPE i, - lts_row_dimensions TYPE zexcel_t_worksheet_rowdimensio, - lts_row_outlines TYPE zcl_excel_worksheet=>mty_ts_outlines_row, - col_count TYPE int4, - merge_count TYPE int4, - write_current_row TYPE boolean, - lt_values TYPE zexcel_t_autofilter_values, - ls_values TYPE zexcel_s_autofilter_values, -* lv_guid TYPE uuid, - lo_autofilters TYPE REF TO zcl_excel_autofilters, - lo_autofilter TYPE REF TO zcl_excel_autofilter, - l_autofilter_hidden TYPE flag, - ls_area TYPE zexcel_s_autofilter_area, - lv_ref TYPE string, - lv_style_index TYPE i. " issue #237 - - - - FIELD-SYMBOLS: <ls_sheet_content> TYPE zexcel_s_cell_data, - <fs_range_merge> LIKE LINE OF lt_range_merge, - <column_dimension> TYPE zexcel_s_worksheet_columndime, - <row_dimension> TYPE zexcel_s_worksheet_rowdimensio, - <ls_row_outline> LIKE LINE OF lts_row_outlines. - -*--------------------------------------------------------------------* -* issue #220 - If cell in tables-area don't use default from row or column or sheet - Declarations 2 - start -*--------------------------------------------------------------------* - DATA: lt_table_areas TYPE SORTED TABLE OF lty_table_area WITH NON-UNIQUE KEY left right top bottom, - ls_table_area LIKE LINE OF lt_table_areas. -*--------------------------------------------------------------------* -* issue #220 - If cell in tables-area don't use default from row or column or sheet - Declarations 2 - end -*--------------------------------------------------------------------* - - - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -*********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_worksheet - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:r' - value = lc_xml_node_r_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:mc' - value = lc_xml_node_comp_ns ). - lo_element_root->set_attribute_ns( name = 'mc:Ignorable' - value = lc_xml_node_comp_pref ). - lo_element_root->set_attribute_ns( name = 'xmlns:x14ac' - value = lc_xml_node_ig_ns ). - - -********************************************************************** -* STEP 4: Create subnodes - " sheetPr - lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetpr - parent = lo_document ). - " TODO tabColor - IF io_worksheet->tabcolor IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_tabcolor - parent = lo_element ). -* Theme not supported yet - start with RGB - lv_value = io_worksheet->tabcolor-rgb. - lo_element_2->set_attribute_ns( name = lc_xml_attr_tabcolor_rgb - value = lv_value ). - ENDIF. - - " outlinePr - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_outlinepr - parent = lo_document ). - - lv_value = io_worksheet->zif_excel_sheet_properties~summarybelow. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_summarybelow - value = lv_value ). - - lv_value = io_worksheet->zif_excel_sheet_properties~summaryright. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_summaryright - value = lv_value ). - - lo_element->append_child( new_child = lo_element_2 ). - - IF io_worksheet->sheet_setup->fit_to_page IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_pagesetuppr - parent = lo_document ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_fittopage - value = `1` ). - lo_element->append_child( new_child = lo_element_2 ). " pageSetupPr node - ENDIF. - - lo_element_root->append_child( new_child = lo_element ). - - " dimension node - lo_element = lo_document->create_simple_element( name = lc_xml_node_dimension - parent = lo_document ). - lv_value = io_worksheet->get_dimension_range( ). - lo_element->set_attribute_ns( name = lc_xml_attr_ref - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " sheetViews node - lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetviews - parent = lo_document ). - " sheetView node - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_sheetview - parent = lo_document ). - IF io_worksheet->zif_excel_sheet_properties~show_zeros EQ abap_false. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showzeros - value = '0' ). - ENDIF. - IF iv_active = abap_true - OR io_worksheet->zif_excel_sheet_properties~selected EQ abap_true. - lo_element_2->set_attribute_ns( name = lc_xml_attr_tabselected - value = '1' ). - ELSE. - lo_element_2->set_attribute_ns( name = lc_xml_attr_tabselected - value = '0' ). - ENDIF. - " Zoom scale - IF io_worksheet->zif_excel_sheet_properties~zoomscale GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale = 10. - ENDIF. - lv_value = io_worksheet->zif_excel_sheet_properties~zoomscale. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_zoomscale - value = lv_value ). - IF io_worksheet->zif_excel_sheet_properties~zoomscale_normal NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_normal GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_normal = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_normal LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_normal = 10. - ENDIF. - lv_value = io_worksheet->zif_excel_sheet_properties~zoomscale_normal. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_zoomscalenormal - value = lv_value ). - ENDIF. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview = 10. - ENDIF. - lv_value = io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_zoomscalepageview - value = lv_value ). - ENDIF. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview = 10. - ENDIF. - lv_value = io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_zoomscalesheetview - value = lv_value ). - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_workbookviewid - value = '0' ). - " showGridLines attribute - IF io_worksheet->show_gridlines = abap_true. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showgridlines - value = '1' ). - ELSE. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showgridlines - value = '0' ). - ENDIF. - - " showRowColHeaders attribute - IF io_worksheet->show_rowcolheaders = abap_true. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showrowcolheaders - value = '1' ). - ELSE. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showrowcolheaders - value = '0' ). - ENDIF. - - - " freeze panes - io_worksheet->get_freeze_cell( IMPORTING ep_row = lv_freeze_cell_row - ep_column = lv_freeze_cell_column ). - - IF lv_freeze_cell_row IS NOT INITIAL AND lv_freeze_cell_column IS NOT INITIAL. - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_pane - parent = lo_element_2 ). - - IF lv_freeze_cell_row > 1. - lv_value = lv_freeze_cell_row - 1. - CONDENSE lv_value. - lo_element_3->set_attribute_ns( name = 'ySplit' - value = lv_value ). - ENDIF. - - IF lv_freeze_cell_column > 1. - lv_value = lv_freeze_cell_column - 1. - CONDENSE lv_value. - lo_element_3->set_attribute_ns( name = 'xSplit' - value = lv_value ). - ENDIF. - - lv_freeze_cell_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column = lv_freeze_cell_column ). - lv_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_freeze_cell_row ). - CONCATENATE lv_freeze_cell_column_alpha lv_value INTO lv_value. - lo_element_3->set_attribute_ns( name = 'topLeftCell' - value = lv_value ). - - lo_element_3->set_attribute_ns( name = 'activePane' - value = 'bottomRight' ). - - lo_element_3->set_attribute_ns( name = 'state' - value = 'frozen' ). - - lo_element_2->append_child( new_child = lo_element_3 ). - ENDIF. - " selection node - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_selection - parent = lo_document ). - lv_value = io_worksheet->get_active_cell( ). - lo_element_3->set_attribute_ns( name = lc_xml_attr_activecell - value = lv_value ). - - lo_element_3->set_attribute_ns( name = lc_xml_attr_sqref - value = lv_value ). - - lo_element_2->append_child( new_child = lo_element_3 ). " sheetView node - - lo_element->append_child( new_child = lo_element_2 ). " sheetView node - - lo_element_root->append_child( new_child = lo_element ). " sheetViews node - - - column_dimensions[] = io_worksheet->get_column_dimensions( ). - " Calculate col - IF NOT column_dimensions IS INITIAL. - io_worksheet->calculate_column_widths( ). - column_dimensions[] = io_worksheet->get_column_dimensions( ). - ENDIF. - row_dimensions[] = io_worksheet->get_row_dimensions( ). - " sheetFormatPr node - lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetformatpr - parent = lo_document ). - " defaultRowHeight - default_row_dimension = io_worksheet->get_default_row_dimension( ). - IF default_row_dimension IS BOUND. - IF default_row_dimension->get_row_height( ) >= 0. - lo_element->set_attribute_ns( name = lc_xml_attr_customheight - value = lc_xml_attr_true ). - lv_value = default_row_dimension->get_row_height( ). - ELSE. - lv_value = '12.75'. - ENDIF. - ELSE. - lv_value = '12.75'. - ENDIF. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_defaultrowheight - value = lv_value ). - " defaultColWidth - default_col_dimension = io_worksheet->get_default_column_dimension( ). - IF default_col_dimension IS BOUND. - IF default_col_dimension->get_width( ) >= 0. - lv_value = default_col_dimension->get_width( ). - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_defaultcolwidth - value = lv_value ). - ENDIF. - ENDIF. - " outlineLevelRow -* Excel is recalculating the outlinelevel on startup from the outline levels found in the rows -* If we place anything incorrect here it gets corrected, if don't place anything it gets added -* So no need to calculate the outlinelevel here ( at least for rows - probably for columns as well but I haven't tested yet -* LOOP AT row_dimensions ASSIGNING <row_dimension>. -* IF <row_dimension>-row_dimension->get_outline_level( ) > outline_level_row. -* outline_level_row = <row_dimension>-row_dimension->get_outline_level( ). -* ENDIF. -* ENDLOOP. -* lv_value = outline_level_row. -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* lo_element->set_attribute_ns( name = lc_xml_attr_outlinelevelrow -* value = lv_value ). - " outlineLevelCol - LOOP AT column_dimensions ASSIGNING <column_dimension>. - IF <column_dimension>-column_dimension->get_outline_level( ) > outline_level_col. - outline_level_col = <column_dimension>-column_dimension->get_outline_level( ). - ENDIF. - ENDLOOP. - lv_value = outline_level_col. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_outlinelevelcol - value = lv_value ). -* lv_value = 0. -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* lo_element->set_attribute_ns( name = lc_xml_attr_dydescent -* value = lv_value ). - - lo_element_root->append_child( new_child = lo_element ). " sheetFormatPr node - - IF io_worksheet->zif_excel_sheet_properties~get_style( ) IS NOT INITIAL OR NOT column_dimensions IS INITIAL. - " cols node - lo_element = lo_document->create_simple_element( name = lc_xml_node_cols - parent = lo_document ). - " This code have to be enhanced in order to manage also column style properties - " Now it is an out/out - IF NOT column_dimensions IS INITIAL. - LOOP AT column_dimensions ASSIGNING <column_dimension>. - " col node - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_col - parent = lo_document ). - lv_value = <column_dimension>-column_dimension->get_column_index( ). - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = lc_xml_attr_min - value = lv_value ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_max - value = lv_value ). - " Width - IF <column_dimension>-column_dimension->get_width( ) < 0. - lo_element_2->set_attribute_ns( name = lc_xml_attr_width - value = lc_xml_attr_defaultwidth ). - ELSE. - lv_value = <column_dimension>-column_dimension->get_width( ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_width - value = lv_value ). - ENDIF. - " Column visibility - IF <column_dimension>-column_dimension->get_visible( ) = abap_false. - lo_element_2->set_attribute_ns( name = lc_xml_attr_hidden - value = lc_xml_attr_true ). - ENDIF. - " Auto size? - IF <column_dimension>-column_dimension->get_auto_size( ) = abap_true. - lo_element_2->set_attribute_ns( name = lc_xml_attr_bestfit - value = lc_xml_attr_true ). - ENDIF. - " Custom width? - IF default_col_dimension IS BOUND. - IF <column_dimension>-column_dimension->get_width( ) - <> default_col_dimension->get_width( ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_customwidth - value = lc_xml_attr_true ). - - ENDIF. - ELSE. - lo_element_2->set_attribute_ns( name = lc_xml_attr_customwidth - value = lc_xml_attr_true ). - ENDIF. - " Collapsed - IF <column_dimension>-column_dimension->get_collapsed( ) = abap_true. - lo_element_2->set_attribute_ns( name = lc_xml_attr_collapsed - value = lc_xml_attr_true ). - ENDIF. - " outlineLevel - IF <column_dimension>-column_dimension->get_outline_level( ) > 0. - lv_value = <column_dimension>-column_dimension->get_outline_level( ). - - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = lc_xml_attr_outlinelevel - value = lv_value ). - ENDIF. - " Style -* lv_value = <column_dimension>-column_dimension->get_xf_index( ). "del issue #157 - set column style - lv_style_guid = <column_dimension>-column_dimension->get_column_style_guid( ). "ins issue #157 - set column style -* lv_value = me->excel->get_style_index_in_styles( lv_style_guid ). "del issue #237 - CLEAR ls_style_mapping. - READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = lv_style_guid. -* lv_style_index = ls_style_mapping-style. "del issue #295 -* IF lv_style_index > 0. "ins issue #237 - del issue #295 -* lv_value = lv_style_index - 1. "ins issue #237 - del issue #295 - IF sy-subrc = 0. "ins issue #295 - lv_value = ls_style_mapping-style. "ins issue #295 - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. "ins issue #237 - - lo_element->append_child( new_child = lo_element_2 ). " col node - ENDLOOP. -* ELSE. "del issue #157 - set sheet style ( add missing columns -* IF io_worksheet->zif_excel_sheet_properties~get_style( ) IS NOT INITIAL. "del issue #157 - set sheet style ( add missing columns -* Begin of insertion issue #157 - set sheet style ( add missing columns - ENDIF. -* Always pass through this coding - IF io_worksheet->zif_excel_sheet_properties~get_style( ) IS NOT INITIAL. - DATA: lts_sorted_columns TYPE SORTED TABLE OF zexcel_cell_column WITH UNIQUE KEY table_line. - TYPES: BEGIN OF ty_missing_columns, - first_column TYPE zexcel_cell_column, - last_column TYPE zexcel_cell_column, - END OF ty_missing_columns. - DATA: t_missing_columns TYPE STANDARD TABLE OF ty_missing_columns WITH NON-UNIQUE DEFAULT KEY, - missing_column LIKE LINE OF t_missing_columns. - -* First collect columns that were already handled before. The rest has to be inserted now - LOOP AT column_dimensions ASSIGNING <column_dimension>. - lv_column = zcl_excel_common=>convert_column2int( <column_dimension>-column ). - INSERT lv_column INTO TABLE lts_sorted_columns. - ENDLOOP. - -* Now find all columns that were missing so far - missing_column-first_column = 1. - LOOP AT lts_sorted_columns INTO lv_column. - IF lv_column > missing_column-first_column. - missing_column-last_column = lv_column - 1. - APPEND missing_column TO t_missing_columns. - ENDIF. - missing_column-first_column = lv_column + 1. - ENDLOOP. - missing_column-last_column = zcl_excel_common=>c_excel_sheet_max_col. - APPEND missing_column TO t_missing_columns. -* Now apply stylesetting ( and other defaults - I copy it from above. Whoever programmed that seems to know what to do :o) - LOOP AT t_missing_columns INTO missing_column. -* End of insertion issue #157 - set column style - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_col - parent = lo_document ). -* lv_value = zcl_excel_common=>c_excel_sheet_min_col."del issue #157 - set sheet style ( add missing columns - lv_value = missing_column-first_column. "ins issue #157 - set sheet style ( add missing columns - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_min - value = lv_value ). -* lv_value = zcl_excel_common=>c_excel_sheet_max_col."del issue #157 - set sheet style ( add missing columns - lv_value = missing_column-last_column. "ins issue #157 - set sheet style ( add missing columns - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_max - value = lv_value ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_width - value = lc_xml_attr_defaultwidth ). - lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). - READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = lv_style_guid. - lv_value = ls_style_mapping-style. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). " col node - ENDLOOP. "ins issue #157 - set sheet style ( add missing columns - - ENDIF. -*--------------------------------------------------------------------* -* issue #367 add feature hide columns from -*--------------------------------------------------------------------* - IF io_worksheet->zif_excel_sheet_properties~hide_columns_from IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_col - parent = lo_document ). - lv_value = zcl_excel_common=>convert_column2int( io_worksheet->zif_excel_sheet_properties~hide_columns_from ). - CONDENSE lv_value NO-GAPS. - lo_element_2->set_attribute_ns( name = lc_xml_attr_min - value = lv_value ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_max - value = '16384' ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_hidden - value = '1' ). - lo_element->append_child( new_child = lo_element_2 ). " col node - ENDIF. - - lo_element_root->append_child( new_child = lo_element ). " cols node - ENDIF. - -*--------------------------------------------------------------------* -* Sheet content - use own method to create this -*--------------------------------------------------------------------* - lo_element = create_xl_sheet_sheet_data( io_worksheet = io_worksheet - io_document = lo_document - it_column_dimensions = column_dimensions ) . -* " sheetData node -* lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetdata -* parent = lo_document ). -* " Get column count -* col_count = io_worksheet->get_highest_column( ). -* " Get autofilter -** lv_guid = io_worksheet->get_guid( ) . - lo_autofilters = excel->get_autofilters_reference( ). - lo_autofilter = lo_autofilters->get( io_worksheet = io_worksheet ) . -* IF lo_autofilter IS BOUND. -* lt_values = lo_autofilter->get_values( ) . -* ls_area = lo_autofilter->get_filter_area( ) . -* l_autofilter_hidden = abap_true. " First defautl is not showing -* ENDIF. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 1 - start -**--------------------------------------------------------------------* -** Build table to hold all table-areas attached to this sheet -* lo_iterator = io_worksheet->get_tables_iterator( ). -* WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. -* lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). -* ls_table_area-left = zcl_excel_common=>convert_column2int( lo_table->settings-top_left_column ). -* ls_table_area-right = lo_table->get_right_column_integer( ). -* ls_table_area-top = lo_table->settings-top_left_row. -* ls_table_area-bottom = lo_table->get_bottom_row_integer( ). -* INSERT ls_table_area INTO TABLE lt_table_areas. -* ENDWHILE. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 1 - end -**--------------------------------------------------------------------* -** We have problems when the first rows or trailing rows are not set but we have rowinformation -** to solve this we add dummycontent into first and last line that will not be set -** Set first line if necessary -* READ TABLE io_worksheet->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = 1. -* IF sy-subrc <> 0. -* ls_sheet_content_empty-cell_row = 1. -* ls_sheet_content_empty-cell_column = 1. -* ls_sheet_content_empty-cell_value = lc_dummy_cell_content. -* INSERT ls_sheet_content_empty INTO TABLE io_worksheet->sheet_content. -* ENDIF. -** Set last line if necessary -** Last row with cell content -* lv_last_row = io_worksheet->get_highest_row( ). -** Last line with row-information set directly ( like line height, hidden-status ... ) -* lts_row_dimensions = io_worksheet->get_row_dimensions( ). -* SORT lts_row_dimensions BY row DESCENDING. -* READ TABLE lts_row_dimensions INDEX 1 ASSIGNING <row_dimension>. -* IF sy-subrc = 0 AND <row_dimension>-row > lv_last_row. -* lv_last_row = <row_dimension>-row. -* ENDIF. -** Last line with row-information set indirectly by row outline -* lts_row_outlines = io_worksheet->get_row_outlines( ). -* LOOP AT lts_row_outlines ASSIGNING <ls_row_outline>. -* IF <ls_row_outline>-collapsed = 'X'. -* lv_current_row = <ls_row_outline>-row_to + 1. " collapsed-status may be set on following row -* ELSE. -* lv_current_row = <ls_row_outline>-row_to. " collapsed-status may be set on following row -* ENDIF. -* IF lv_current_row > lv_last_row. -* lv_last_row = lv_current_row. -* ENDIF. -* ENDLOOP. -* READ TABLE io_worksheet->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = lv_last_row. -* IF sy-subrc <> 0. -* ls_sheet_content_empty-cell_row = lv_last_row. -* ls_sheet_content_empty-cell_column = 1. -* ls_sheet_content_empty-cell_value = lc_dummy_cell_content. -* INSERT ls_sheet_content_empty INTO TABLE io_worksheet->sheet_content. -* ENDIF. -* -* CLEAR ls_sheet_content. -* LOOP AT io_worksheet->sheet_content INTO ls_sheet_content. -* IF lt_values IS INITIAL. " no values attached to autofilter " issue #368 autofilter filtering too much -* CLEAR l_autofilter_hidden. -* ELSE. -* READ TABLE lt_values INTO ls_values WITH KEY column = ls_last_row-cell_column. -* IF sy-subrc = 0 AND ls_values-value = ls_last_row-cell_value. -* CLEAR l_autofilter_hidden. -* ENDIF. -* ENDIF. -* CLEAR ls_style_mapping. -** Create row element -** issues #346,#154, #195 - problems when we have information in row_dimension but no cell content in that row -** Get next line that may have to be added. If we have empty lines this is the next line after previous cell content -** Otherwise it is the line of the current cell content -* lv_current_row = ls_last_row-cell_row + 1. -* IF lv_current_row > ls_sheet_content-cell_row. -* lv_current_row = ls_sheet_content-cell_row. -* ENDIF. -** Fill in empty lines if necessary - assign an emtpy sheet content -* lv_next_row = lv_current_row. -* WHILE lv_next_row <= ls_sheet_content-cell_row. -* lv_current_row = lv_next_row. -* lv_next_row = lv_current_row + 1. -* IF lv_current_row = ls_sheet_content-cell_row. " cell value found in this row -* ASSIGN ls_sheet_content TO <ls_sheet_content>. -* ELSE. -** Check if empty row is really necessary - this is basically the case when we have information in row_dimension -* lo_row_dim_empty = io_worksheet->get_row_dimension( lv_current_row ). -* CHECK lo_row_dim_empty->get_row_height( ) >= 0 OR -* lo_row_dim_empty->get_collapsed( io_worksheet ) = abap_true OR -* lo_row_dim_empty->get_outline_level( io_worksheet ) > 0 OR -* lo_row_dim_empty->get_xf_index( ) <> 0. -* " Dummyentry A1 -* ls_sheet_content_empty-cell_row = lv_current_row. -* ls_sheet_content_empty-cell_column = 1. -* ASSIGN ls_sheet_content_empty TO <ls_sheet_content>. -* ENDIF. -* -* IF ls_last_row-cell_row NE <ls_sheet_content>-cell_row. -* IF lo_autofilter IS BOUND. -* IF ls_area-row_start >= ls_last_row-cell_row OR " One less for header -* ls_area-row_end < ls_last_row-cell_row . -* CLEAR l_autofilter_hidden. -* ENDIF. -* ELSE. -* CLEAR l_autofilter_hidden. -* ENDIF. -* IF ls_last_row-cell_row IS NOT INITIAL. -* " Row visibility of previos row. -* IF row_dimension->get_visible( io_worksheet ) = abap_false OR -* l_autofilter_hidden = abap_true. -* lo_element_2->set_attribute_ns( name = 'hidden' value = 'true'). -* ENDIF. -* lo_element->append_child( new_child = lo_element_2 ). " row node -* ENDIF. -* " Add new row -* lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_row -* parent = lo_document ). -* " r -* lv_value = <ls_sheet_content>-cell_row. -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* -* lo_element_2->set_attribute_ns( name = lc_xml_attr_r -* value = lv_value ). -* " Spans -* lv_value = col_count. -* CONCATENATE '1:' lv_value INTO lv_value. -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* lo_element_2->set_attribute_ns( name = lc_xml_attr_spans -* value = lv_value ). -* row_dimension = io_worksheet->get_row_dimension( <ls_sheet_content>-cell_row ). -* " Do we need the row dimension attributes? -* IF row_dimension->get_row_height( ) >= 0 OR -* row_dimension->get_collapsed( io_worksheet ) = abap_true OR -* row_dimension->get_outline_level( io_worksheet ) > 0 OR -* row_dimension->get_xf_index( ) <> 0 OR -* l_autofilter_hidden = abap_true. -* " Row dimensions -* IF row_dimension->get_row_height( ) >= 0. -* lo_element_2->set_attribute_ns( name = 'customHeight' value = '1'). -* lv_value = row_dimension->get_row_height( ). -* lo_element_2->set_attribute_ns( name = 'ht' value = lv_value ). -* ENDIF. -* " Collapsed -* IF row_dimension->get_collapsed( io_worksheet ) = abap_true. -* lo_element_2->set_attribute_ns( name = 'collapsed' value = 'true'). -* ENDIF. -* " Outline level -* IF row_dimension->get_outline_level( io_worksheet ) > 0. -* lv_value = row_dimension->get_outline_level( io_worksheet ). -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* lo_element_2->set_attribute_ns( name = 'outlineLevel' value = lv_value ). -* ENDIF. -* " Style -* IF row_dimension->get_xf_index( ) <> 0. -* lv_value = row_dimension->get_xf_index( ). -* lo_element_2->set_attribute_ns( name = 's' value = lv_value ). -* lo_element_2->set_attribute_ns( name = 'customFormat' value = '1'). -* ENDIF. -* ENDIF. -* IF lt_values IS INITIAL. " no values attached to autofilter " issue #368 autofilter filtering too much -* CLEAR l_autofilter_hidden. -* ELSE. -* l_autofilter_hidden = abap_true. " First default is not showing -* ENDIF. -* ELSE. -* -* ENDIF. -* ENDWHILE. -* -* lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_c -* parent = lo_document ). -* -* lo_element_3->set_attribute_ns( name = lc_xml_attr_r -* value = <ls_sheet_content>-cell_coords ). -* -** begin of change issue #157 - allow column cellstyle -** if no cellstyle is set, look into column, then into sheet -* IF <ls_sheet_content>-cell_style IS NOT INITIAL. -* lv_style_guid = <ls_sheet_content>-cell_style. -* ELSE. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 2 - start -**--------------------------------------------------------------------* -** Check if cell in any of the table areas -* LOOP AT lt_table_areas TRANSPORTING NO FIELDS WHERE top <= <ls_sheet_content>-cell_row -* AND bottom >= <ls_sheet_content>-cell_row -* AND left <= <ls_sheet_content>-cell_column -* AND right >= <ls_sheet_content>-cell_column. -* EXIT. -* ENDLOOP. -* IF sy-subrc = 0. -* CLEAR lv_style_guid. " No style --> EXCEL will use built-in-styles as declared in the tables-section -* ELSE. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 2 - end -**--------------------------------------------------------------------* -* lv_column_p = zcl_excel_common=>convert_column2alpha( <ls_sheet_content>-cell_column ). -* READ TABLE column_dimensions WITH KEY column = lv_column_p ASSIGNING <column_dimension>. -* IF sy-subrc = 0. -* lv_style_guid = <column_dimension>-column_dimension->get_column_style_guid( ). -* IF lv_style_guid IS INITIAL. -* lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). -* ENDIF. -* ELSE. -* lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). -* ENDIF. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 3 - start -**--------------------------------------------------------------------* -* ENDIF. -**--------------------------------------------------------------------* -** issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 3 - end -**--------------------------------------------------------------------* -* ENDIF. -** IF <ls_sheet_content>-cell_style IS NOT INITIAL. -** READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = <ls_sheet_content>-cell_style. -* IF lv_style_guid IS NOT INITIAL. -* READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = lv_style_guid. -** end of change issue #157 - allow column cellstyles -* lv_value = ls_style_mapping-style. -* SHIFT lv_value RIGHT DELETING TRAILING space. -* SHIFT lv_value LEFT DELETING LEADING space. -* lo_element_3->set_attribute_ns( name = lc_xml_attr_s -* value = lv_value ). -* ENDIF. -* -* " For cells with formula ignore the value - Excel will calculate it -* IF <ls_sheet_content>-cell_formula IS NOT INITIAL. -* " fomula node -* lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_f -* parent = lo_document ). -* lv_value = <ls_sheet_content>-cell_formula. -* CONDENSE lv_value. -* lo_element_4->set_value( value = lv_value ). -* lo_element_3->append_child( new_child = lo_element_4 ). " fomula node -* ELSEIF <ls_sheet_content>-cell_value IS NOT INITIAL "cell can have just style or formula -* AND <ls_sheet_content>-cell_value <> lc_dummy_cell_content. -* IF <ls_sheet_content>-data_type IS NOT INITIAL. -* IF <ls_sheet_content>-data_type EQ 's_leading_blanks'. -* lo_element_3->set_attribute_ns( name = lc_xml_attr_t -* value = 's' ). -* ELSE. -* lo_element_3->set_attribute_ns( name = lc_xml_attr_t -* value = <ls_sheet_content>-data_type ). -* ENDIF. -* ENDIF. -* -* " value node -* lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_v -* parent = lo_document ). -* -* IF <ls_sheet_content>-data_type EQ 's' OR <ls_sheet_content>-data_type EQ 's_leading_blanks'. -* lv_value = me->get_shared_string_index( <ls_sheet_content>-cell_value ). -* CONDENSE lv_value. -* lo_element_4->set_value( value = lv_value ). -* ELSE. -* lv_value = <ls_sheet_content>-cell_value. -* CONDENSE lv_value. -* lo_element_4->set_value( value = lv_value ). -* ENDIF. -* -* lo_element_3->append_child( new_child = lo_element_4 ). " value node -* ENDIF. -* -* lo_element_2->append_child( new_child = lo_element_3 ). " column node -* ls_last_row = <ls_sheet_content>. -* ENDLOOP. -* IF sy-subrc = 0. -* READ TABLE lt_values INTO ls_values WITH KEY column = ls_last_row-cell_column. -* IF sy-subrc = 0 AND ls_values-value = ls_last_row-cell_value. -* CLEAR l_autofilter_hidden. -* ENDIF. -* IF lo_autofilter IS BOUND. -* IF ls_area-row_start >= ls_last_row-cell_row OR " One less for header -* ls_area-row_end < ls_last_row-cell_row . -* CLEAR l_autofilter_hidden. -* ENDIF. -* ELSE. -* CLEAR l_autofilter_hidden. -* ENDIF. -* " Row visibility of previos row. -* IF row_dimension->get_visible( ) = abap_false OR -* l_autofilter_hidden = abap_true. -* lo_element_2->set_attribute_ns( name = 'hidden' value = 'true'). -* ENDIF. -* lo_element->append_child( new_child = lo_element_2 ). " row node -* ENDIF. -* DELETE io_worksheet->sheet_content WHERE cell_value = lc_dummy_cell_content. " Get rid of dummyentries - - lo_element_root->append_child( new_child = lo_element ). " sheetData node - - IF lo_autofilter IS BOUND. -* Create node autofilter - lo_element = lo_document->create_simple_element( name = lc_xml_node_autofilter - parent = lo_document ). - lv_ref = lo_autofilter->get_filter_range( ) . - CONDENSE lv_ref NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_ref - value = lv_ref ). - lt_values = lo_autofilter->get_values( ) . - IF lt_values IS NOT INITIAL. -* If we filter we need to set the filter mode to 1. - lo_element_2 = lo_document->find_from_name( name = lc_xml_node_sheetpr ). - lo_element_2->set_attribute_ns( name = lc_xml_attr_filtermode - value = '1' ). -* Create node filtercolumn - CLEAR lv_column. - LOOP AT lt_values INTO ls_values. - IF ls_values-column <> lv_column. - IF lv_column IS NOT INITIAL. - lo_element_2->append_child( new_child = lo_element_3 ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_filtercolumn - parent = lo_element ). - lv_column = ls_values-column - lo_autofilter->filter_area-col_start. - lv_value = lv_column. - CONDENSE lv_value NO-GAPS. - lo_element_2->set_attribute_ns( name = lc_xml_attr_colid - value = lv_value ). - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_filters - parent = lo_element_2 ). - lv_column = ls_values-column. - ENDIF. - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_filter - parent = lo_element_3 ). - lo_element_4->set_attribute_ns( name = lc_xml_attr_val - value = ls_values-value ). - lo_element_3->append_child( new_child = lo_element_4 ). " value node - ENDLOOP. - lo_element_2->append_child( new_child = lo_element_3 ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - IF io_worksheet->zif_excel_sheet_protection~protected EQ abap_true. - " sheetProtection node - lo_element = lo_document->create_simple_element( name = lc_xml_node_sheetprotection - parent = lo_document ). - MOVE io_worksheet->zif_excel_sheet_protection~password TO lv_value. - IF lv_value IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_password - value = lv_value ). - ENDIF. - lv_value = io_worksheet->zif_excel_sheet_protection~auto_filter. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_autofilter - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~delete_columns. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_deletecolumns - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~delete_rows. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_deleterows - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~format_cells. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_formatcells - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~format_columns. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_formatcolumns - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~format_rows. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_formatrows - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~insert_columns. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_insertcolumns - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~insert_hyperlinks. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_inserthyperlinks - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~insert_rows. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_insertrows - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~objects. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_objects - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~pivot_tables. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_pivottables - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~scenarios. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_scenarios - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~select_locked_cells. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_selectlockedcells - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~select_unlocked_cells. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_selectunlockedcell - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~sheet. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_sheet - value = lv_value ). - lv_value = io_worksheet->zif_excel_sheet_protection~sort. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_sort - value = lv_value ). - - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - " Merged cells - lt_range_merge = io_worksheet->get_merge( ). - IF lt_range_merge IS NOT INITIAL. - lo_element = lo_document->create_simple_element( name = lc_xml_node_mergecells - parent = lo_document ). - DESCRIBE TABLE lt_range_merge LINES merge_count. - lv_value = merge_count. - CONDENSE lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - LOOP AT lt_range_merge ASSIGNING <fs_range_merge>. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_mergecell - parent = lo_document ). - - lo_element_2->set_attribute_ns( name = lc_xml_attr_ref - value = <fs_range_merge> ). - lo_element->append_child( new_child = lo_element_2 ). - lo_element_root->append_child( new_child = lo_element ). - io_worksheet->delete_merge( ). - ENDLOOP. - ENDIF. - - " Conditional formatting node - lo_iterator = io_worksheet->get_cond_styles_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_style_conditional ?= lo_iterator->if_object_collection_iterator~get_next( ). - IF lo_style_conditional->rule IS INITIAL. - CONTINUE. - ENDIF. - lo_element = lo_document->create_simple_element( name = lc_xml_node_condformatting - parent = lo_document ). - lv_value = lo_style_conditional->get_dimension_range( ) . - lo_element->set_attribute_ns( name = lc_xml_attr_sqref - value = lv_value ). - - " cfRule node - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_cfrule - parent = lo_document ). - lv_value = lo_style_conditional->rule. - lo_element_2->set_attribute_ns( name = lc_xml_attr_type - value = lv_value ). - lv_value = lo_style_conditional->priority. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = lc_xml_attr_priority - value = lv_value ). - - CASE lo_style_conditional->rule. - " Start >> Databar by Albert Lladanosa - WHEN zcl_excel_style_conditional=>c_rule_databar. - - ls_databar = lo_style_conditional->mode_databar. - - CLEAR lt_cfvo. - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_databar - parent = lo_document ). - - MOVE ls_databar-cfvo1_value TO ls_cfvo-value. - MOVE ls_databar-cfvo1_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - - MOVE ls_databar-cfvo2_value TO ls_cfvo-value. - MOVE ls_databar-cfvo2_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - - LOOP AT lt_cfvo INTO ls_cfvo. - " cfvo node - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_cfvo - parent = lo_document ). - lv_value = ls_cfvo-type. - lo_element_4->set_attribute_ns( name = lc_xml_attr_type - value = lv_value ). - lv_value = ls_cfvo-value. - lo_element_4->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_3->append_child( new_child = lo_element_4 ). " cfvo node - ENDLOOP. - - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_color - parent = lo_document ). - lv_value = ls_databar-colorrgb. - lo_element_4->set_attribute_ns( name = lc_xml_attr_tabcolor_rgb - value = lv_value ). - - lo_element_3->append_child( new_child = lo_element_4 ). " color node - - lo_element_2->append_child( new_child = lo_element_3 ). " databar node - " End << Databar by Albert Lladanosa - - WHEN zcl_excel_style_conditional=>c_rule_colorscale. - - ls_colorscale = lo_style_conditional->mode_colorscale. - - CLEAR: lt_cfvo, lt_colors. - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_colorscale - parent = lo_document ). - - MOVE ls_colorscale-cfvo1_value TO ls_cfvo-value. - MOVE ls_colorscale-cfvo1_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - - MOVE ls_colorscale-cfvo2_value TO ls_cfvo-value. - MOVE ls_colorscale-cfvo2_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - - MOVE ls_colorscale-cfvo3_value TO ls_cfvo-value. - MOVE ls_colorscale-cfvo3_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - - APPEND ls_colorscale-colorrgb1 TO lt_colors. - APPEND ls_colorscale-colorrgb2 TO lt_colors. - APPEND ls_colorscale-colorrgb3 TO lt_colors. - - LOOP AT lt_cfvo INTO ls_cfvo. - - IF ls_cfvo IS INITIAL. - CONTINUE. - ENDIF. - - " cfvo node - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_cfvo - parent = lo_document ). - lv_value = ls_cfvo-type. - lo_element_4->set_attribute_ns( name = lc_xml_attr_type - value = lv_value ). - lv_value = ls_cfvo-value. - lo_element_4->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_3->append_child( new_child = lo_element_4 ). " cfvo node - ENDLOOP. - LOOP AT lt_colors INTO ls_colors. - - IF ls_colors IS INITIAL. - CONTINUE. - ENDIF. - - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_color - parent = lo_document ). - lv_value = ls_colors-colorrgb. - lo_element_4->set_attribute_ns( name = lc_xml_attr_tabcolor_rgb - value = lv_value ). - - lo_element_3->append_child( new_child = lo_element_4 ). " color node - ENDLOOP. - - lo_element_2->append_child( new_child = lo_element_3 ). " databar node - - WHEN zcl_excel_style_conditional=>c_rule_iconset. - - ls_iconset = lo_style_conditional->mode_iconset. - - CLEAR lt_cfvo. - " iconset node - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_iconset - parent = lo_document ). - IF ls_iconset-iconset NE zcl_excel_style_conditional=>c_iconset_3trafficlights. - lv_value = ls_iconset-iconset. - lo_element_3->set_attribute_ns( name = lc_xml_attr_iconset - value = lv_value ). - ENDIF. - - " Set the showValue attribute - lv_value = ls_iconset-showvalue. - lo_element_3->set_attribute_ns( name = lc_xml_attr_showvalue - value = lv_value ). - - CASE ls_iconset-iconset. - WHEN zcl_excel_style_conditional=>c_iconset_3trafficlights2 OR - zcl_excel_style_conditional=>c_iconset_3arrows OR - zcl_excel_style_conditional=>c_iconset_3arrowsgray OR - zcl_excel_style_conditional=>c_iconset_3flags OR - zcl_excel_style_conditional=>c_iconset_3signs OR - zcl_excel_style_conditional=>c_iconset_3symbols OR - zcl_excel_style_conditional=>c_iconset_3symbols2 OR - zcl_excel_style_conditional=>c_iconset_3trafficlights OR - zcl_excel_style_conditional=>c_iconset_3trafficlights2. - MOVE ls_iconset-cfvo1_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo1_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo2_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo2_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo3_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo3_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - WHEN zcl_excel_style_conditional=>c_iconset_4arrows OR - zcl_excel_style_conditional=>c_iconset_4arrowsgray OR - zcl_excel_style_conditional=>c_iconset_4rating OR - zcl_excel_style_conditional=>c_iconset_4redtoblack OR - zcl_excel_style_conditional=>c_iconset_4trafficlights. - MOVE ls_iconset-cfvo1_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo1_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo2_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo2_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo3_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo3_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo4_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo4_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - WHEN zcl_excel_style_conditional=>c_iconset_5arrows OR - zcl_excel_style_conditional=>c_iconset_5arrowsgray OR - zcl_excel_style_conditional=>c_iconset_5quarters OR - zcl_excel_style_conditional=>c_iconset_5rating. - MOVE ls_iconset-cfvo1_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo1_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo2_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo2_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo3_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo3_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo4_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo4_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - MOVE ls_iconset-cfvo5_value TO ls_cfvo-value. - MOVE ls_iconset-cfvo5_type TO ls_cfvo-type. - APPEND ls_cfvo TO lt_cfvo. - WHEN OTHERS. - CLEAR lt_cfvo. - ENDCASE. - - LOOP AT lt_cfvo INTO ls_cfvo. - " cfvo node - lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_cfvo - parent = lo_document ). - lv_value = ls_cfvo-type. - lo_element_4->set_attribute_ns( name = lc_xml_attr_type - value = lv_value ). - lv_value = ls_cfvo-value. - lo_element_4->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_3->append_child( new_child = lo_element_4 ). " cfvo node - ENDLOOP. - - - lo_element_2->append_child( new_child = lo_element_3 ). " iconset node - - WHEN zcl_excel_style_conditional=>c_rule_cellis. - ls_cellis = lo_style_conditional->mode_cellis. - READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_cellis-cell_style. - lv_value = ls_style_cond_mapping-dxf. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid - value = lv_value ). - lv_value = ls_cellis-operator. - lo_element_2->set_attribute_ns( name = lc_xml_attr_operator - value = lv_value ). - " formula node - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_formula - parent = lo_document ). - lv_value = ls_cellis-formula. - lo_element_3->set_value( value = lv_value ). - lo_element_2->append_child( new_child = lo_element_3 ). " formula node - IF ls_cellis-formula2 IS NOT INITIAL. - lv_value = ls_cellis-formula2. - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_formula - parent = lo_document ). - lo_element_3->set_value( value = lv_value ). - lo_element_2->append_child( new_child = lo_element_3 ). " 2nd formula node - ENDIF. - - WHEN zcl_excel_style_conditional=>c_rule_expression. - ls_expression = lo_style_conditional->mode_expression. - READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_expression-cell_style. - lv_value = ls_style_cond_mapping-dxf. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid - value = lv_value ). - " formula node - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_formula - parent = lo_document ). - lv_value = ls_expression-formula. - lo_element_3->set_value( value = lv_value ). - lo_element_2->append_child( new_child = lo_element_3 ). " formula node - -* begin of ins issue #366 - missing conditional rules: top10 - WHEN zcl_excel_style_conditional=>c_rule_top10. - ls_conditional_top10 = lo_style_conditional->mode_top10. - READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_conditional_top10-cell_style. - lv_value = ls_style_cond_mapping-dxf. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid - value = lv_value ). - lv_value = ls_conditional_top10-topxx_count. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = 'rank' - value = lv_value ). - IF ls_conditional_top10-bottom = 'X'. - lo_element_2->set_attribute_ns( name = 'bottom' - value = '1' ). - ENDIF. - IF ls_conditional_top10-percent = 'X'. - lo_element_2->set_attribute_ns( name = 'percent' - value ='1' ). - ENDIF. - - WHEN zcl_excel_style_conditional=>c_rule_above_average. - ls_conditional_above_avg = lo_style_conditional->mode_above_average. - READ TABLE me->styles_cond_mapping INTO ls_style_cond_mapping WITH KEY guid = ls_conditional_above_avg-cell_style. - lv_value = ls_style_cond_mapping-dxf. - CONDENSE lv_value. - lo_element_2->set_attribute_ns( name = lc_xml_attr_dxfid - value = lv_value ). - - IF ls_conditional_above_avg-above_average IS INITIAL. " = below average - lo_element_2->set_attribute_ns( name = 'aboveAverage' - value = '0' ). - ENDIF. - IF ls_conditional_above_avg-equal_average = 'X'. " = equal average also - lo_element_2->set_attribute_ns( name = 'equalAverage' - value = '1' ). - ENDIF. - IF ls_conditional_above_avg-standard_deviation <> 0. " standard deviation instead of value - lv_value = ls_conditional_above_avg-standard_deviation. - lo_element_2->set_attribute_ns( name = 'stdDev' - value = lv_value ). - ENDIF. - -* end of ins issue #366 - missing conditional rules: top10 - - ENDCASE. - - lo_element->append_child( new_child = lo_element_2 ). " cfRule node - - lo_element_root->append_child( new_child = lo_element ). " Conditional formatting node - ENDWHILE. - - IF io_worksheet->get_data_validations_size( ) GT 0. - " dataValidations node - lo_element = lo_document->create_simple_element( name = lc_xml_node_datavalidations - parent = lo_document ). - " Conditional formatting node - lo_iterator = io_worksheet->get_data_validations_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_data_validation ?= lo_iterator->if_object_collection_iterator~get_next( ). - " dataValidation node - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_datavalidation - parent = lo_document ). - lv_value = lo_data_validation->type. - lo_element_2->set_attribute_ns( name = lc_xml_attr_type - value = lv_value ). - IF NOT lo_data_validation->operator IS INITIAL. - lv_value = lo_data_validation->operator. - lo_element_2->set_attribute_ns( name = lc_xml_attr_operator - value = lv_value ). - ENDIF. - IF lo_data_validation->allowblank EQ abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_allowblank - value = lv_value ). - IF lo_data_validation->showinputmessage EQ abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showinputmessage - value = lv_value ). - IF lo_data_validation->showerrormessage EQ abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showerrormessage - value = lv_value ). - IF lo_data_validation->showdropdown EQ abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_showdropdown - value = lv_value ). - IF NOT lo_data_validation->errortitle IS INITIAL. - lv_value = lo_data_validation->errortitle. - lo_element_2->set_attribute_ns( name = lc_xml_attr_errortitle - value = lv_value ). - ENDIF. - IF NOT lo_data_validation->error IS INITIAL. - lv_value = lo_data_validation->error. - lo_element_2->set_attribute_ns( name = lc_xml_attr_error - value = lv_value ). - ENDIF. - IF NOT lo_data_validation->prompttitle IS INITIAL. - lv_value = lo_data_validation->prompttitle. - lo_element_2->set_attribute_ns( name = lc_xml_attr_prompttitle - value = lv_value ). - ENDIF. - IF NOT lo_data_validation->prompt IS INITIAL. - lv_value = lo_data_validation->prompt. - lo_element_2->set_attribute_ns( name = lc_xml_attr_prompt - value = lv_value ). - ENDIF. - lv_cell_row_s = lo_data_validation->cell_row. - CONDENSE lv_cell_row_s. - CONCATENATE lo_data_validation->cell_column lv_cell_row_s INTO lv_value. - IF lo_data_validation->cell_row_to IS NOT INITIAL. - lv_cell_row_s = lo_data_validation->cell_row_to. - CONDENSE lv_cell_row_s. - CONCATENATE lv_value ':' lo_data_validation->cell_column_to lv_cell_row_s INTO lv_value. - ENDIF. - lo_element_2->set_attribute_ns( name = lc_xml_attr_sqref - value = lv_value ). - " formula1 node - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_formula1 - parent = lo_document ). - lv_value = lo_data_validation->formula1. - lo_element_3->set_value( value = lv_value ). - - lo_element_2->append_child( new_child = lo_element_3 ). " formula1 node - " formula2 node - IF NOT lo_data_validation->formula2 IS INITIAL. - lo_element_3 = lo_document->create_simple_element( name = lc_xml_node_formula2 - parent = lo_document ). - lv_value = lo_data_validation->formula2. - lo_element_3->set_value( value = lv_value ). - - lo_element_2->append_child( new_child = lo_element_3 ). " formula2 node - ENDIF. - - lo_element->append_child( new_child = lo_element_2 ). " dataValidation node - ENDWHILE. - lo_element_root->append_child( new_child = lo_element ). " dataValidations node - ENDIF. - - " Hyperlinks - DATA: lv_hyperlinks_count TYPE i, - lo_link TYPE REF TO zcl_excel_hyperlink. - - lv_hyperlinks_count = io_worksheet->get_hyperlinks_size( ). - IF lv_hyperlinks_count > 0. - lo_element = lo_document->create_simple_element( name = 'hyperlinks' - parent = lo_document ). - - lo_iterator = io_worksheet->get_hyperlinks_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_link ?= lo_iterator->if_object_collection_iterator~get_next( ). - - lo_element_2 = lo_document->create_simple_element( name = 'hyperlink' - parent = lo_element ). - - lv_value = lo_link->get_ref( ). - lo_element_2->set_attribute_ns( name = 'ref' - value = lv_value ). - - IF lo_link->is_internal( ) = abap_true. - lv_value = lo_link->get_url( ). - lo_element_2->set_attribute_ns( name = 'location' - value = lv_value ). - ELSE. - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - - lo_element_2->set_attribute_ns( name = 'r:id' - value = lv_value ). - - ENDIF. - - lo_element->append_child( new_child = lo_element_2 ). - ENDWHILE. - - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - - " PrintOptions - IF io_worksheet->print_gridlines = abap_true OR - io_worksheet->sheet_setup->vertical_centered = abap_true OR - io_worksheet->sheet_setup->horizontal_centered = abap_true. - lo_element = lo_document->create_simple_element( name = 'printOptions' - parent = lo_document ). - - IF io_worksheet->print_gridlines = abap_true. - lo_element->set_attribute_ns( name = lc_xml_attr_gridlines - value = 'true' ). - ENDIF. - - IF io_worksheet->sheet_setup->horizontal_centered = abap_true. - lo_element->set_attribute_ns( name = 'horizontalCentered' - value = 'true' ). - ENDIF. - - IF io_worksheet->sheet_setup->vertical_centered = abap_true. - lo_element->set_attribute_ns( name = 'verticalCentered' - value = 'true' ). - ENDIF. - - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - " pageMargins node - lo_element = lo_document->create_simple_element( name = lc_xml_node_pagemargins - parent = lo_document ). - - lv_value = io_worksheet->sheet_setup->margin_left. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_left - value = lv_value ). - lv_value = io_worksheet->sheet_setup->margin_right. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_right - value = lv_value ). - lv_value = io_worksheet->sheet_setup->margin_top. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_top - value = lv_value ). - lv_value = io_worksheet->sheet_setup->margin_bottom. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_bottom - value = lv_value ). - lv_value = io_worksheet->sheet_setup->margin_header. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_header - value = lv_value ). - lv_value = io_worksheet->sheet_setup->margin_footer. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_footer - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). " pageMargins node - -* pageSetup node - lo_element = lo_document->create_simple_element( name = lc_xml_node_pagesetup - parent = lo_document ). - - IF io_worksheet->sheet_setup->black_and_white IS NOT INITIAL. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_blackandwhite - value = `1` ). - ENDIF. - - IF io_worksheet->sheet_setup->cell_comments IS NOT INITIAL. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_cellcomments - value = io_worksheet->sheet_setup->cell_comments ). - ENDIF. - - IF io_worksheet->sheet_setup->copies IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->copies. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_copies - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->draft IS NOT INITIAL. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_draft - value = `1` ). - ENDIF. - - IF io_worksheet->sheet_setup->errors IS NOT INITIAL. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_errors - value = io_worksheet->sheet_setup->errors ). - ENDIF. - - IF io_worksheet->sheet_setup->first_page_number IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->first_page_number. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_firstpagenumber - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->fit_to_page IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->fit_to_height. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_fittoheight - value = lv_value ). - lv_value = io_worksheet->sheet_setup->fit_to_width. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_fittowidth - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->horizontal_dpi IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->horizontal_dpi. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_horizontaldpi - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->orientation IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->orientation. - lo_element->set_attribute_ns( name = lc_xml_attr_orientation - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->page_order IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_pageorder - value = io_worksheet->sheet_setup->page_order ). - ENDIF. - - IF io_worksheet->sheet_setup->paper_height IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->paper_height. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_paperheight - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->paper_size IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->paper_size. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_papersize - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->paper_width IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->paper_width. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_paperwidth - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->scale IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->scale. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_scale - value = lv_value ). - ENDIF. - - IF io_worksheet->sheet_setup->use_first_page_num IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_usefirstpagenumber - value = `1` ). - ENDIF. - - IF io_worksheet->sheet_setup->use_printer_defaults IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_useprinterdefaults - value = `1` ). - ENDIF. - - IF io_worksheet->sheet_setup->vertical_dpi IS NOT INITIAL. - lv_value = io_worksheet->sheet_setup->vertical_dpi. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_verticaldpi - value = lv_value ). - ENDIF. - - lo_element_root->append_child( new_child = lo_element ). " pageSetup node - -* { headerFooter necessary? > - IF io_worksheet->sheet_setup->odd_header IS NOT INITIAL - OR io_worksheet->sheet_setup->odd_footer IS NOT INITIAL - OR io_worksheet->sheet_setup->diff_oddeven_headerfooter = abap_true. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_headerfooter - parent = lo_document ). - - " Different header/footer for odd/even pages? - IF io_worksheet->sheet_setup->diff_oddeven_headerfooter = abap_true. - lo_element->set_attribute_ns( name = lc_xml_attr_differentoddeven - value = '1' ). - ENDIF. - - " OddHeader - CLEAR: lv_value. - io_worksheet->sheet_setup->get_header_footer_string( IMPORTING ep_odd_header = lv_value ) . - IF lv_value IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_oddheader - parent = lo_document ). - lo_element_2->set_value( value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - - " OddFooter - CLEAR: lv_value. - io_worksheet->sheet_setup->get_header_footer_string( IMPORTING ep_odd_footer = lv_value ) . - IF lv_value IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_oddfooter - parent = lo_document ). - lo_element_2->set_value( value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - - " evenHeader - CLEAR: lv_value. - io_worksheet->sheet_setup->get_header_footer_string( IMPORTING ep_even_header = lv_value ) . - IF lv_value IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_evenheader - parent = lo_document ). - lo_element_2->set_value( value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - - " evenFooter - CLEAR: lv_value. - io_worksheet->sheet_setup->get_header_footer_string( IMPORTING ep_even_footer = lv_value ) . - IF lv_value IS NOT INITIAL. - lo_element_2 = lo_document->create_simple_element( name = lc_xml_node_evenfooter - parent = lo_document ). - lo_element_2->set_value( value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). - ENDIF. - - - lo_element_root->append_child( new_child = lo_element ). " headerFooter - - ENDIF. - -* issue #377 pagebreaks - TRY. - create_xl_sheet_pagebreaks( io_document = lo_document - io_parent = lo_element_root - io_worksheet = io_worksheet ) . - CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify - ENDTRY. - -* drawing - DATA: lo_drawings TYPE REF TO zcl_excel_drawings. - - lo_drawings = io_worksheet->get_drawings( ). - IF lo_drawings->is_empty( ) = abap_false. - lo_element = lo_document->create_simple_element( name = lc_xml_node_drawing - parent = lo_document ). - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - lo_element->set_attribute( name = 'r:id' - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - -* tables - DATA lv_table_count TYPE i. - - lv_table_count = io_worksheet->get_tables_size( ). - IF lv_table_count > 0. - lo_element = lo_document->create_simple_element( name = 'tableParts' - parent = lo_document ). - lv_value = lv_table_count. - CONDENSE lv_value. - lo_element->set_attribute_ns( name = 'count' - value = lv_value ). - - lo_iterator = io_worksheet->get_tables_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - lo_element_2 = lo_document->create_simple_element( name = 'tablePart' - parent = lo_element ). - lo_element_2->set_attribute_ns( name = 'r:id' - value = lv_value ). - lo_element->append_child( new_child = lo_element_2 ). - - ENDWHILE. - - lo_element_root->append_child( new_child = lo_element ). - - ENDIF. - - - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - -* REPLACE FIRST OCCURRENCE OF me->mv_sheet_data_xstring_dummy IN ep_content WITH me->mv_sheet_data_xstring IN BYTE MODE. - -ENDMETHOD. - - - - - - - METHOD create_xl_sheet_pagebreaks. - DATA: lo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks, - lt_pagebreaks TYPE zcl_excel_worksheet_pagebreaks=>tt_pagebreak_at, - lt_rows TYPE HASHED TABLE OF int4 WITH UNIQUE KEY table_line, - lt_columns TYPE HASHED TABLE OF int4 WITH UNIQUE KEY table_line, - - lo_node_rowbreaks TYPE REF TO if_ixml_element, - lo_node_colbreaks TYPE REF TO if_ixml_element, - lo_node_break TYPE REF TO if_ixml_element, - - lv_value TYPE string. - - - FIELD-SYMBOLS: <ls_pagebreak> LIKE LINE OF lt_pagebreaks. - - lo_pagebreaks = io_worksheet->get_pagebreaks( ). - CHECK lo_pagebreaks IS BOUND. - - lt_pagebreaks = lo_pagebreaks->get_all_pagebreaks( ). - CHECK lt_pagebreaks IS NOT INITIAL. " No need to proceed if don't have any pagebreaks. - - lo_node_rowbreaks = io_document->create_simple_element( name = 'rowBreaks' - parent = io_document ). - - lo_node_colbreaks = io_document->create_simple_element( name = 'colBreaks' - parent = io_document ). - - - LOOP AT lt_pagebreaks ASSIGNING <ls_pagebreak>. - -* Count how many rows and columns need to be broken - INSERT <ls_pagebreak>-cell_row INTO TABLE lt_rows. - IF sy-subrc = 0. " New - lv_value = <ls_pagebreak>-cell_row. - CONDENSE lv_value. - - lo_node_break = io_document->create_simple_element( name = 'brk' - parent = io_document ). - lo_node_break->set_attribute( name = 'id' value = lv_value ). - lo_node_break->set_attribute( name = 'man' value = '1' ). " Manual break - lo_node_break->set_attribute( name = 'max' value = '16383' ). " Max columns - - lo_node_rowbreaks->append_child( new_child = lo_node_break ). - ENDIF. - - INSERT <ls_pagebreak>-cell_column INTO TABLE lt_columns. - IF sy-subrc = 0. " New - lv_value = <ls_pagebreak>-cell_column. - CONDENSE lv_value. - - lo_node_break = io_document->create_simple_element( name = 'brk' - parent = io_document ). - lo_node_break->set_attribute( name = 'id' value = lv_value ). - lo_node_break->set_attribute( name = 'man' value = '1' ). " Manual break - lo_node_break->set_attribute( name = 'max' value = '1048575' ). " Max rows - - lo_node_colbreaks->append_child( new_child = lo_node_break ). - ENDIF. - - - ENDLOOP. - - lv_value = lines( lt_rows ). - CONDENSE lv_value. - lo_node_rowbreaks->set_attribute( name = 'count' value = lv_value ). - lo_node_rowbreaks->set_attribute( name = 'manualBreakCount' value = lv_value ). - - lv_value = lines( lt_rows ). - CONDENSE lv_value. - lo_node_colbreaks->set_attribute( name = 'count' value = lv_value ). - lo_node_colbreaks->set_attribute( name = 'manualBreakCount' value = lv_value ). - - - - - io_parent->append_child( new_child = lo_node_rowbreaks ). - io_parent->append_child( new_child = lo_node_colbreaks ). - -ENDMETHOD. - - - - - - METHOD create_xl_sheet_rels. - - -** Constant node name - DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'Id', - lc_xml_attr_type TYPE string VALUE 'Type', - lc_xml_attr_target TYPE string VALUE 'Target', - lc_xml_attr_target_mode TYPE string VALUE 'TargetMode', - lc_xml_val_external TYPE string VALUE 'External', - " Node namespace - lc_xml_node_rels_ns TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships', - lc_xml_node_rid_table_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table', - lc_xml_node_rid_printer_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings', - lc_xml_node_rid_drawing_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', - lc_xml_node_rid_link_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_table TYPE REF TO zcl_excel_table, - lo_link TYPE REF TO zcl_excel_hyperlink. - - DATA: lv_value TYPE string, - lv_relation_id TYPE i, - lv_index_str TYPE string. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_relationships - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_rels_ns ). - -********************************************************************** -* STEP 4: Create subnodes - - " Add sheet Relationship nodes here - lv_relation_id = 0. - lo_iterator = io_worksheet->get_hyperlinks_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_link ?= lo_iterator->if_object_collection_iterator~get_next( ). - CHECK lo_link->is_internal( ) = abap_false. " issue #340 - don't put internal links here - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_link_tp ). - - lv_value = lo_link->get_url( ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_target_mode - value = lc_xml_val_external ). - lo_element_root->append_child( new_child = lo_element ). - ENDWHILE. - -* drawing - DATA: lo_drawings TYPE REF TO zcl_excel_drawings. - - lo_drawings = io_worksheet->get_drawings( ). - IF lo_drawings->is_empty( ) = abap_false. - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_drawing_tp ). - - lv_index_str = iv_drawing_index. - CONDENSE lv_index_str NO-GAPS. - MOVE me->c_xl_drawings TO lv_value. - REPLACE 'xl' WITH '..' INTO lv_value. - REPLACE '#' WITH lv_index_str INTO lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - lo_iterator = io_worksheet->get_tables_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). - ADD 1 TO lv_relation_id. - - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_value ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_table_tp ). - - lv_value = lo_table->get_name( ). - CONCATENATE '../tables/' lv_value '.xml' INTO lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDWHILE. - -* IF io_worksheet->get_print_settings( )->is_empty( ) = abap_false. -* ADD 1 TO lv_relation_id. -* lv_value = lv_relation_id. -* CONDENSE lv_value. -* CONCATENATE 'rId' lv_value INTO lv_value. -* -* lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship -* parent = lo_document ). -* lo_element->set_attribute_ns( name = lc_xml_attr_id -* value = lv_value ). -* lo_element->set_attribute_ns( name = lc_xml_attr_type -* value = lc_xml_node_rid_printer_tp ). -* -* lv_index_str = iv_printer_index. -* CONDENSE lv_index_str NO-GAPS. -* MOVE me->c_xl_printersettings TO lv_value. -* REPLACE 'xl' WITH '..' INTO lv_value. -* REPLACE '#' WITH lv_index_str INTO lv_value. -* lo_element->set_attribute_ns( name = lc_xml_attr_target -* value = lv_value ). -* -* lo_element_root->append_child( new_child = lo_element ). -* ENDIF. - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - - - - - METHOD create_xl_sheet_sheet_data. - - TYPES: BEGIN OF lty_table_area, - left TYPE i, - right TYPE i, - top TYPE i, - bottom TYPE i, - END OF lty_table_area. - - CONSTANTS: lc_dummy_cell_content TYPE zexcel_s_cell_data-cell_value VALUE '})~~~ This is a dummy value for ABAP2XLSX and you should never find this in a real excelsheet Ihope'. - - CONSTANTS: lc_xml_node_sheetdata TYPE string VALUE 'sheetData', " SheetData tag - lc_xml_node_row TYPE string VALUE 'row', " Row tag - lc_xml_attr_r TYPE string VALUE 'r', " Cell: row-attribute - lc_xml_attr_spans TYPE string VALUE 'spans', " Cell: spans-attribute - lc_xml_node_c TYPE string VALUE 'c', " Cell tag - lc_xml_node_v TYPE string VALUE 'v', " Cell: value - lc_xml_node_f TYPE string VALUE 'f', " Cell: formula - lc_xml_attr_s TYPE string VALUE 's', " Cell: style - lc_xml_attr_t TYPE string VALUE 't'. " Cell: type - - DATA: col_count TYPE int4, - lo_autofilters TYPE REF TO zcl_excel_autofilters, - lo_autofilter TYPE REF TO zcl_excel_autofilter, - l_autofilter_hidden TYPE flag, - lt_values TYPE zexcel_t_autofilter_values, - ls_values TYPE zexcel_s_autofilter_values, - ls_area TYPE zexcel_s_autofilter_area, - - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_table TYPE REF TO zcl_excel_table, - lt_table_areas TYPE SORTED TABLE OF lty_table_area WITH NON-UNIQUE KEY left right top bottom, - ls_table_area LIKE LINE OF lt_table_areas, - - ls_sheet_content LIKE LINE OF io_worksheet->sheet_content, - ls_sheet_content_empty LIKE LINE OF io_worksheet->sheet_content, - lv_current_row TYPE i, - lv_next_row TYPE i, - lv_last_row TYPE i, - - lts_row_dimensions TYPE zexcel_t_worksheet_rowdimensio, - lo_row_dim_empty TYPE REF TO zcl_excel_worksheet_rowdimensi, - row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, - lts_row_outlines TYPE zcl_excel_worksheet=>mty_ts_outlines_row, - - ls_last_row TYPE zexcel_s_cell_data, - ls_style_mapping TYPE zexcel_s_styles_mapping, - - lo_element_2 TYPE REF TO if_ixml_element, - lo_element_3 TYPE REF TO if_ixml_element, - lo_element_4 TYPE REF TO if_ixml_element, - - lv_value TYPE string, - lv_style_guid TYPE zexcel_cell_style, - lv_column_p TYPE zexcel_cell_column_alpha, - - xxx. - - FIELD-SYMBOLS: <ls_sheet_content> TYPE zexcel_s_cell_data, - <column_dimension> TYPE zexcel_s_worksheet_columndime, - <row_dimension> TYPE zexcel_s_worksheet_rowdimensio, - <ls_row_outline> LIKE LINE OF lts_row_outlines. - - - DATA: lv_xstring_partial TYPE xstring, - lv_xstring TYPE xstring. - - " sheetData node - rv_ixml_sheet_data_root = io_document->create_simple_element( name = lc_xml_node_sheetdata - parent = io_document ). - me->mv_sheet_data_xstring_dummy = render_ixml_element_no_header( rv_ixml_sheet_data_root ). - - " Get column count - col_count = io_worksheet->get_highest_column( ). - " Get autofilter -*lv_guid = io_worksheet->get_guid( ) . - lo_autofilters = excel->get_autofilters_reference( ). - lo_autofilter = lo_autofilters->get( io_worksheet = io_worksheet ) . - IF lo_autofilter IS BOUND. - lt_values = lo_autofilter->get_values( ) . - ls_area = lo_autofilter->get_filter_area( ) . - l_autofilter_hidden = abap_true. " First defautl is not showing - ENDIF. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 1 - start -*--------------------------------------------------------------------* -*Build table to hold all table-areas attached to this sheet - lo_iterator = io_worksheet->get_tables_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). - ls_table_area-left = zcl_excel_common=>convert_column2int( lo_table->settings-top_left_column ). - ls_table_area-right = lo_table->get_right_column_integer( ). - ls_table_area-top = lo_table->settings-top_left_row. - ls_table_area-bottom = lo_table->get_bottom_row_integer( ). - INSERT ls_table_area INTO TABLE lt_table_areas. - ENDWHILE. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 1 - end -*--------------------------------------------------------------------* -*We have problems when the first rows or trailing rows are not set but we have rowinformation -*to solve this we add dummycontent into first and last line that will not be set -*Set first line if necessary - READ TABLE io_worksheet->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = 1. - IF sy-subrc <> 0. - ls_sheet_content_empty-cell_row = 1. - ls_sheet_content_empty-cell_column = 1. - ls_sheet_content_empty-cell_value = lc_dummy_cell_content. - INSERT ls_sheet_content_empty INTO TABLE io_worksheet->sheet_content. - ENDIF. -*Set last line if necessary -*Last row with cell content - lv_last_row = io_worksheet->get_highest_row( ). -*Last line with row-information set directly ( like line height, hidden-status ... ) - lts_row_dimensions = io_worksheet->get_row_dimensions( ). - SORT lts_row_dimensions BY row DESCENDING. - READ TABLE lts_row_dimensions INDEX 1 ASSIGNING <row_dimension>. - IF sy-subrc = 0 AND <row_dimension>-row > lv_last_row. - lv_last_row = <row_dimension>-row. - ENDIF. -*Last line with row-information set indirectly by row outline - lts_row_outlines = io_worksheet->get_row_outlines( ). - LOOP AT lts_row_outlines ASSIGNING <ls_row_outline>. - IF <ls_row_outline>-collapsed = 'X'. - lv_current_row = <ls_row_outline>-row_to + 1. " collapsed-status may be set on following row - ELSE. - lv_current_row = <ls_row_outline>-row_to. " collapsed-status may be set on following row - ENDIF. - IF lv_current_row > lv_last_row. - lv_last_row = lv_current_row. - ENDIF. - ENDLOOP. - READ TABLE io_worksheet->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = lv_last_row. - IF sy-subrc <> 0. - ls_sheet_content_empty-cell_row = lv_last_row. - ls_sheet_content_empty-cell_column = 1. - ls_sheet_content_empty-cell_value = lc_dummy_cell_content. - INSERT ls_sheet_content_empty INTO TABLE io_worksheet->sheet_content. - ENDIF. - - CLEAR ls_sheet_content. - LOOP AT io_worksheet->sheet_content INTO ls_sheet_content. - IF lt_values IS INITIAL. " no values attached to autofilter " issue #368 autofilter filtering too much - CLEAR l_autofilter_hidden. - ELSE. - READ TABLE lt_values INTO ls_values WITH KEY column = ls_last_row-cell_column. - IF sy-subrc = 0 AND ls_values-value = ls_last_row-cell_value. - CLEAR l_autofilter_hidden. - ENDIF. - ENDIF. - CLEAR ls_style_mapping. -*Create row element -*issues #346,#154, #195 - problems when we have information in row_dimension but no cell content in that row -*Get next line that may have to be added. If we have empty lines this is the next line after previous cell content -*Otherwise it is the line of the current cell content - lv_current_row = ls_last_row-cell_row + 1. - IF lv_current_row > ls_sheet_content-cell_row. - lv_current_row = ls_sheet_content-cell_row. - ENDIF. -*Fill in empty lines if necessary - assign an emtpy sheet content - lv_next_row = lv_current_row. - WHILE lv_next_row <= ls_sheet_content-cell_row. - lv_current_row = lv_next_row. - lv_next_row = lv_current_row + 1. - IF lv_current_row = ls_sheet_content-cell_row. " cell value found in this row - ASSIGN ls_sheet_content TO <ls_sheet_content>. - ELSE. -*Check if empty row is really necessary - this is basically the case when we have information in row_dimension - lo_row_dim_empty = io_worksheet->get_row_dimension( lv_current_row ). - CHECK lo_row_dim_empty->get_row_height( ) >= 0 OR - lo_row_dim_empty->get_collapsed( io_worksheet ) = abap_true OR - lo_row_dim_empty->get_outline_level( io_worksheet ) > 0 OR - lo_row_dim_empty->get_xf_index( ) <> 0. - " Dummyentry A1 - ls_sheet_content_empty-cell_row = lv_current_row. - ls_sheet_content_empty-cell_column = 1. - ASSIGN ls_sheet_content_empty TO <ls_sheet_content>. - ENDIF. - - IF ls_last_row-cell_row NE <ls_sheet_content>-cell_row. - IF lo_autofilter IS BOUND. - IF ls_area-row_start >= ls_last_row-cell_row OR " One less for header - ls_area-row_end < ls_last_row-cell_row . - CLEAR l_autofilter_hidden. - ENDIF. - ELSE. - CLEAR l_autofilter_hidden. - ENDIF. - IF ls_last_row-cell_row IS NOT INITIAL. - " Row visibility of previos row. - IF row_dimension->get_visible( io_worksheet ) = abap_false OR - l_autofilter_hidden = abap_true. - lo_element_2->set_attribute_ns( name = 'hidden' value = 'true'). - ENDIF. -* lv_xstring_partial = render_ixml_element_no_header( lo_element_2 ). -* CONCATENATE lv_xstring lv_xstring_partial -* INTO lv_xstring IN BYTE MODE. - rv_ixml_sheet_data_root->append_child( new_child = lo_element_2 ). " row node - ENDIF. - " Add new row - lo_element_2 = io_document->create_simple_element( name = lc_xml_node_row - parent = io_document ). - " r - lv_value = <ls_sheet_content>-cell_row. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - - lo_element_2->set_attribute_ns( name = lc_xml_attr_r - value = lv_value ). - " Spans - lv_value = col_count. - CONCATENATE '1:' lv_value INTO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = lc_xml_attr_spans - value = lv_value ). - row_dimension = io_worksheet->get_row_dimension( <ls_sheet_content>-cell_row ). - " Do we need the row dimension attributes? - IF row_dimension->get_row_height( ) >= 0 OR - row_dimension->get_collapsed( io_worksheet ) = abap_true OR - row_dimension->get_outline_level( io_worksheet ) > 0 OR - row_dimension->get_xf_index( ) <> 0 OR - l_autofilter_hidden = abap_true. - " Row dimensions - IF row_dimension->get_row_height( ) >= 0. - lo_element_2->set_attribute_ns( name = 'customHeight' value = '1'). - lv_value = row_dimension->get_row_height( ). - lo_element_2->set_attribute_ns( name = 'ht' value = lv_value ). - ENDIF. - " Collapsed - IF row_dimension->get_collapsed( io_worksheet ) = abap_true. - lo_element_2->set_attribute_ns( name = 'collapsed' value = 'true'). - ENDIF. - " Outline level - IF row_dimension->get_outline_level( io_worksheet ) > 0. - lv_value = row_dimension->get_outline_level( io_worksheet ). - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_2->set_attribute_ns( name = 'outlineLevel' value = lv_value ). - ENDIF. - " Style - IF row_dimension->get_xf_index( ) <> 0. - lv_value = row_dimension->get_xf_index( ). - lo_element_2->set_attribute_ns( name = 's' value = lv_value ). - lo_element_2->set_attribute_ns( name = 'customFormat' value = '1'). - ENDIF. - ENDIF. - IF lt_values IS INITIAL. " no values attached to autofilter " issue #368 autofilter filtering too much - CLEAR l_autofilter_hidden. - ELSE. - l_autofilter_hidden = abap_true. " First default is not showing - ENDIF. - ELSE. - - ENDIF. - ENDWHILE. - - lo_element_3 = io_document->create_simple_element( name = lc_xml_node_c - parent = io_document ). - - lo_element_3->set_attribute_ns( name = lc_xml_attr_r - value = <ls_sheet_content>-cell_coords ). - -*begin of change issue #157 - allow column cellstyle -*if no cellstyle is set, look into column, then into sheet - IF <ls_sheet_content>-cell_style IS NOT INITIAL. - lv_style_guid = <ls_sheet_content>-cell_style. - ELSE. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 2 - start -*--------------------------------------------------------------------* -*Check if cell in any of the table areas - LOOP AT lt_table_areas TRANSPORTING NO FIELDS WHERE top <= <ls_sheet_content>-cell_row - AND bottom >= <ls_sheet_content>-cell_row - AND left <= <ls_sheet_content>-cell_column - AND right >= <ls_sheet_content>-cell_column. - EXIT. - ENDLOOP. - IF sy-subrc = 0. - CLEAR lv_style_guid. " No style --> EXCEL will use built-in-styles as declared in the tables-section - ELSE. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 2 - end -*--------------------------------------------------------------------* - lv_column_p = zcl_excel_common=>convert_column2alpha( <ls_sheet_content>-cell_column ). - READ TABLE it_column_dimensions WITH KEY column = lv_column_p ASSIGNING <column_dimension>. - IF sy-subrc = 0. - lv_style_guid = <column_dimension>-column_dimension->get_column_style_guid( ). - IF lv_style_guid IS INITIAL. - lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). - ENDIF. - ELSE. - lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). - ENDIF. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 3 - start -*--------------------------------------------------------------------* - ENDIF. -*--------------------------------------------------------------------* -*issue #220 - If cell in tables-area don't use default from row or column or sheet - Coding 3 - end -*--------------------------------------------------------------------* - ENDIF. -* IF <ls_sheet_content>-cell_style IS NOT INITIAL. -* READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = <ls_sheet_content>-cell_style. - IF lv_style_guid IS NOT INITIAL. - READ TABLE styles_mapping INTO ls_style_mapping WITH KEY guid = lv_style_guid. -*end of change issue #157 - allow column cellstyles - lv_value = ls_style_mapping-style. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_3->set_attribute_ns( name = lc_xml_attr_s - value = lv_value ). - ENDIF. - - " For cells with formula ignore the value - Excel will calculate it - IF <ls_sheet_content>-cell_formula IS NOT INITIAL. - " fomula node - lo_element_4 = io_document->create_simple_element( name = lc_xml_node_f - parent = io_document ). - lv_value = <ls_sheet_content>-cell_formula. - CONDENSE lv_value. - lo_element_4->set_value( value = lv_value ). - lo_element_3->append_child( new_child = lo_element_4 ). " fomula node - ELSEIF <ls_sheet_content>-cell_value IS NOT INITIAL "cell can have just style or formula - AND <ls_sheet_content>-cell_value <> lc_dummy_cell_content. - IF <ls_sheet_content>-data_type IS NOT INITIAL. - IF <ls_sheet_content>-data_type EQ 's_leading_blanks'. - lo_element_3->set_attribute_ns( name = lc_xml_attr_t - value = 's' ). - ELSE. - lo_element_3->set_attribute_ns( name = lc_xml_attr_t - value = <ls_sheet_content>-data_type ). - ENDIF. - ENDIF. - - " value node - lo_element_4 = io_document->create_simple_element( name = lc_xml_node_v - parent = io_document ). - - IF <ls_sheet_content>-data_type EQ 's' OR <ls_sheet_content>-data_type EQ 's_leading_blanks'. - lv_value = me->get_shared_string_index( <ls_sheet_content>-cell_value ). - CONDENSE lv_value. - lo_element_4->set_value( value = lv_value ). - ELSE. - lv_value = <ls_sheet_content>-cell_value. - CONDENSE lv_value. - lo_element_4->set_value( value = lv_value ). - ENDIF. - - lo_element_3->append_child( new_child = lo_element_4 ). " value node - ENDIF. - - lo_element_2->append_child( new_child = lo_element_3 ). " column node - ls_last_row = <ls_sheet_content>. - ENDLOOP. - IF sy-subrc = 0. - READ TABLE lt_values INTO ls_values WITH KEY column = ls_last_row-cell_column. - IF sy-subrc = 0 AND ls_values-value = ls_last_row-cell_value. - CLEAR l_autofilter_hidden. - ENDIF. - IF lo_autofilter IS BOUND. - IF ls_area-row_start >= ls_last_row-cell_row OR " One less for header - ls_area-row_end < ls_last_row-cell_row . - CLEAR l_autofilter_hidden. - ENDIF. - ELSE. - CLEAR l_autofilter_hidden. - ENDIF. - " Row visibility of previos row. - IF row_dimension->get_visible( ) = abap_false OR - l_autofilter_hidden = abap_true. - lo_element_2->set_attribute_ns( name = 'hidden' value = 'true'). - ENDIF. -* lv_xstring_partial = render_ixml_element_no_header( lo_element_2 ). -* CONCATENATE lv_xstring lv_xstring_partial -* INTO lv_xstring IN BYTE MODE. - rv_ixml_sheet_data_root->append_child( new_child = lo_element_2 ). " row node - ENDIF. - DELETE io_worksheet->sheet_content WHERE cell_value = lc_dummy_cell_content. " Get rid of dummyentries - -* -* -* me->mv_sheet_data_xstring = render_ixml_element_no_header( rv_ixml_sheet_data_root ). -* -* -** Für den Dummystringersatz jetzt alles zurück auf Anfang -* rv_ixml_sheet_data_root = io_document->create_simple_element( name = lc_xml_node_sheetdata -* parent = io_document ). -* me->mv_sheet_data_xstring_dummy = render_ixml_element_no_header( rv_ixml_sheet_data_root ). -* -* DATA: lv_sheetdata_tag_start TYPE xstring, -* lv_sheetdata_tag_end TYPE xstring. -* -* lv_sheetdata_tag_start = cl_bcs_convert=>string_to_xstring( '<sheetData>' ). -* lv_sheetdata_tag_end = cl_bcs_convert=>string_to_xstring( '</sheetData>' ). -* CONCATENATE lv_sheetdata_tag_start lv_xstring lv_sheetdata_tag_end -* INTO lv_xstring IN BYTE MODE. -* me->mv_sheet_data_xstring = lv_xstring. - -ENDMETHOD. - - - - METHOD create_xl_styles. -*--------------------------------------------------------------------* -* ToDos: -* 2do§1 dxfs-cellstyles are used in conditional formats: -* CellIs, Expression, top10 ( forthcoming above average as well ) -* create own method to write dsfx-cellstyle to be reuseable by all these -*--------------------------------------------------------------------* - - -** Constant node name - CONSTANTS: lc_xml_node_stylesheet TYPE string VALUE 'styleSheet', - " font - lc_xml_node_fonts TYPE string VALUE 'fonts', - lc_xml_node_font TYPE string VALUE 'font', - lc_xml_node_b TYPE string VALUE 'b', "bold - lc_xml_node_i TYPE string VALUE 'i', "italic - lc_xml_node_u TYPE string VALUE 'u', "underline - lc_xml_node_strike TYPE string VALUE 'strike', "strikethrough - lc_xml_node_sz TYPE string VALUE 'sz', - lc_xml_node_color TYPE string VALUE 'color', - lc_xml_node_name TYPE string VALUE 'name', - lc_xml_node_family TYPE string VALUE 'family', - lc_xml_node_scheme TYPE string VALUE 'scheme', - " fill - lc_xml_node_fills TYPE string VALUE 'fills', - lc_xml_node_fill TYPE string VALUE 'fill', - lc_xml_node_patternfill TYPE string VALUE 'patternFill', - lc_xml_node_fgcolor TYPE string VALUE 'fgColor', - lc_xml_node_bgcolor TYPE string VALUE 'bgColor', - lc_xml_node_gradientfill TYPE string VALUE 'gradientFill', - lc_xml_node_stop TYPE string VALUE 'stop', - " borders - lc_xml_node_borders TYPE string VALUE 'borders', - lc_xml_node_border TYPE string VALUE 'border', - lc_xml_node_left TYPE string VALUE 'left', - lc_xml_node_right TYPE string VALUE 'right', - lc_xml_node_top TYPE string VALUE 'top', - lc_xml_node_bottom TYPE string VALUE 'bottom', - lc_xml_node_diagonal TYPE string VALUE 'diagonal', - " numfmt - lc_xml_node_numfmts TYPE string VALUE 'numFmts', - lc_xml_node_numfmt TYPE string VALUE 'numFmt', - " Styles - lc_xml_node_cellstylexfs TYPE string VALUE 'cellStyleXfs', - lc_xml_node_xf TYPE string VALUE 'xf', - lc_xml_node_cellxfs TYPE string VALUE 'cellXfs', - lc_xml_node_cellstyles TYPE string VALUE 'cellStyles', - lc_xml_node_cellstyle TYPE string VALUE 'cellStyle', - lc_xml_node_dxfs TYPE string VALUE 'dxfs', - lc_xml_node_dxf TYPE string VALUE 'dxf', - lc_xml_node_tablestyles TYPE string VALUE 'tableStyles', - " Colors - lc_xml_node_colors TYPE string VALUE 'colors', - lc_xml_node_indexedcolors TYPE string VALUE 'indexedColors', - lc_xml_node_rgbcolor TYPE string VALUE 'rgbColor', - lc_xml_node_mrucolors TYPE string VALUE 'mruColors', - " Alignment - lc_xml_node_alignment TYPE string VALUE 'alignment', - " Protection - lc_xml_node_protection TYPE string VALUE 'protection', - " Node attributes - lc_xml_attr_count TYPE string VALUE 'count', - lc_xml_attr_val TYPE string VALUE 'val', - lc_xml_attr_theme TYPE string VALUE 'theme', - lc_xml_attr_rgb TYPE string VALUE 'rgb', - lc_xml_attr_indexed TYPE string VALUE 'indexed', - lc_xml_attr_tint TYPE string VALUE 'tint', - lc_xml_attr_style TYPE string VALUE 'style', - lc_xml_attr_position TYPE string VALUE 'position', - lc_xml_attr_degree TYPE string VALUE 'degree', - lc_xml_attr_patterntype TYPE string VALUE 'patternType', - lc_xml_attr_numfmtid TYPE string VALUE 'numFmtId', - lc_xml_attr_fontid TYPE string VALUE 'fontId', - lc_xml_attr_fillid TYPE string VALUE 'fillId', - lc_xml_attr_borderid TYPE string VALUE 'borderId', - lc_xml_attr_xfid TYPE string VALUE 'xfId', - lc_xml_attr_applynumberformat TYPE string VALUE 'applyNumberFormat', - lc_xml_attr_applyprotection TYPE string VALUE 'applyProtection', - lc_xml_attr_applyfont TYPE string VALUE 'applyFont', - lc_xml_attr_applyfill TYPE string VALUE 'applyFill', - lc_xml_attr_applyborder TYPE string VALUE 'applyBorder', - lc_xml_attr_name TYPE string VALUE 'name', - lc_xml_attr_builtinid TYPE string VALUE 'builtinId', - lc_xml_attr_defaulttablestyle TYPE string VALUE 'defaultTableStyle', - lc_xml_attr_defaultpivotstyle TYPE string VALUE 'defaultPivotStyle', - lc_xml_attr_applyalignment TYPE string VALUE 'applyAlignment', - lc_xml_attr_horizontal TYPE string VALUE 'horizontal', - lc_xml_attr_formatcode TYPE string VALUE 'formatCode', - lc_xml_attr_vertical TYPE string VALUE 'vertical', - lc_xml_attr_wraptext TYPE string VALUE 'wrapText', - lc_xml_attr_textrotation TYPE string VALUE 'textRotation', - lc_xml_attr_shrinktofit TYPE string VALUE 'shrinkToFit', - lc_xml_attr_indent TYPE string VALUE 'indent', - lc_xml_attr_locked TYPE string VALUE 'locked', - lc_xml_attr_hidden TYPE string VALUE 'hidden', - lc_xml_attr_diagonalup TYPE string VALUE 'diagonalUp', - lc_xml_attr_diagonaldown TYPE string VALUE 'diagonalDown', - " Node namespace - lc_xml_node_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', - lc_xml_attr_type TYPE string VALUE 'type', - lc_xml_attr_bottom TYPE string VALUE 'bottom', - lc_xml_attr_top TYPE string VALUE 'top', - lc_xml_attr_right TYPE string VALUE 'right', - lc_xml_attr_left TYPE string VALUE 'left'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element_fonts TYPE REF TO if_ixml_element, - lo_element_font TYPE REF TO if_ixml_element, - lo_element_fills TYPE REF TO if_ixml_element, - lo_element_fill TYPE REF TO if_ixml_element, - lo_element_borders TYPE REF TO if_ixml_element, - lo_element_border TYPE REF TO if_ixml_element, - lo_element_numfmts TYPE REF TO if_ixml_element, - lo_element_numfmt TYPE REF TO if_ixml_element, - lo_element_cellxfs TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_sub_element TYPE REF TO if_ixml_element, - lo_sub_element_2 TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_iterator2 TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_style_conditional TYPE REF TO zcl_excel_style_conditional, - lo_style TYPE REF TO zcl_excel_style. - - - DATA: lt_fonts TYPE zexcel_t_style_font, - ls_font TYPE zexcel_s_style_font, - lt_fills TYPE zexcel_t_style_fill, - ls_fill TYPE zexcel_s_style_fill, - lt_borders TYPE zexcel_t_style_border, - ls_border TYPE zexcel_s_style_border, - lt_numfmts TYPE zexcel_t_style_numfmt, - ls_numfmt TYPE zexcel_s_style_numfmt, - lt_protections TYPE zexcel_t_style_protection, - ls_protection TYPE zexcel_s_style_protection, - lt_alignments TYPE zexcel_t_style_alignment, - ls_alignment TYPE zexcel_s_style_alignment, - lt_cellxfs TYPE zexcel_t_cellxfs, - ls_cellxfs TYPE zexcel_s_cellxfs, - ls_styles_mapping TYPE zexcel_s_styles_mapping, - ls_style_cond_mapping TYPE zexcel_s_styles_cond_mapping, - ls_cellis TYPE zexcel_conditional_cellis, - ls_expression TYPE zexcel_conditional_expression, - ls_conditional_top10 TYPE zexcel_conditional_top10, - - lt_colors TYPE zexcel_t_style_color_argb, - ls_color LIKE LINE OF lt_colors. - - DATA: lv_value TYPE string, - lv_dfx_count TYPE i, - lv_fonts_count TYPE i, - lv_fills_count TYPE i, - lv_borders_count TYPE i, - lv_cellxfs_count TYPE i, - lv_index TYPE i, - lv_align_flag TYPE c. - - TYPES: BEGIN OF ts_built_in_format, - num_format TYPE zexcel_number_format, - id TYPE sytabix, - END OF ts_built_in_format. - - DATA: lt_built_in_num_formats TYPE HASHED TABLE OF ts_built_in_format WITH UNIQUE KEY num_format, - ls_built_in_num_format LIKE LINE OF lt_built_in_num_formats. - FIELD-SYMBOLS: <ls_built_in_format> LIKE LINE OF lt_built_in_num_formats, - <ls_reader_built_in> LIKE LINE OF zcl_excel_style_number_format=>mt_built_in_num_formats. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -*********************************************************************** -* STEP 3: Create main node relationships - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_stylesheet - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_ns ). - -********************************************************************** -* STEP 4: Create subnodes - - lo_element_fonts = lo_document->create_simple_element( name = lc_xml_node_fonts - parent = lo_document ). - - lo_element_fills = lo_document->create_simple_element( name = lc_xml_node_fills - parent = lo_document ). - - lo_element_borders = lo_document->create_simple_element( name = lc_xml_node_borders - parent = lo_document ). - - lo_element_cellxfs = lo_document->create_simple_element( name = lc_xml_node_cellxfs - parent = lo_document ). - - lo_element_numfmts = lo_document->create_simple_element( name = lc_xml_node_numfmts - parent = lo_document ). - -* Prepare built-in number formats. - LOOP AT zcl_excel_style_number_format=>mt_built_in_num_formats ASSIGNING <ls_reader_built_in>. - ls_built_in_num_format-id = <ls_reader_built_in>-id. - ls_built_in_num_format-num_format = <ls_reader_built_in>-format->format_code. - INSERT ls_built_in_num_format INTO TABLE lt_built_in_num_formats. - ENDLOOP. -* Compress styles - lo_iterator = excel->get_styles_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_style ?= lo_iterator->if_object_collection_iterator~get_next( ). - ls_font = lo_style->font->get_structure( ). - ls_fill = lo_style->fill->get_structure( ). - ls_border = lo_style->borders->get_structure( ). - ls_alignment = lo_style->alignment->get_structure( ). - ls_protection = lo_style->protection->get_structure( ). - ls_numfmt = lo_style->number_format->get_structure( ). - - CLEAR ls_cellxfs. - - -* Compress fonts - READ TABLE lt_fonts FROM ls_font TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-fontid = sy-tabix. - ELSE. - APPEND ls_font TO lt_fonts. - DESCRIBE TABLE lt_fonts LINES ls_cellxfs-fontid. - ENDIF. - SUBTRACT 1 FROM ls_cellxfs-fontid. - -* Compress alignment - READ TABLE lt_alignments FROM ls_alignment TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-alignmentid = sy-tabix. - ELSE. - APPEND ls_alignment TO lt_alignments. - DESCRIBE TABLE lt_alignments LINES ls_cellxfs-alignmentid. - ENDIF. - SUBTRACT 1 FROM ls_cellxfs-alignmentid. - -* Compress fills - READ TABLE lt_fills FROM ls_fill TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-fillid = sy-tabix. - ELSE. - APPEND ls_fill TO lt_fills. - DESCRIBE TABLE lt_fills LINES ls_cellxfs-fillid. - ENDIF. - SUBTRACT 1 FROM ls_cellxfs-fillid. - -* Compress borders - READ TABLE lt_borders FROM ls_border TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-borderid = sy-tabix. - ELSE. - APPEND ls_border TO lt_borders. - DESCRIBE TABLE lt_borders LINES ls_cellxfs-borderid. - ENDIF. - SUBTRACT 1 FROM ls_cellxfs-borderid. - -* Compress protection - IF ls_protection-locked EQ c_on AND ls_protection-hidden EQ c_off. - ls_cellxfs-applyprotection = 0. - ELSE. - READ TABLE lt_protections FROM ls_protection TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-protectionid = sy-tabix. - ELSE. - APPEND ls_protection TO lt_protections. - DESCRIBE TABLE lt_protections LINES ls_cellxfs-protectionid. - ENDIF. - ls_cellxfs-applyprotection = 1. - ENDIF. - SUBTRACT 1 FROM ls_cellxfs-protectionid. - -* Compress number formats - - "----------- - IF ls_numfmt-numfmt NE zcl_excel_style_number_format=>c_format_date_std." and ls_numfmt-NUMFMT ne 'STD_NDEC'. " ALE Changes on going - "--- - IF ls_numfmt IS NOT INITIAL. -* issue #389 - Problem with built-in format ( those are not being taken account of ) -* There are some internal number formats built-in into EXCEL -* Use these instead of duplicating the entries here, since they seem to be language-dependant and adjust to user settings in excel - READ TABLE lt_built_in_num_formats ASSIGNING <ls_built_in_format> WITH TABLE KEY num_format = ls_numfmt-numfmt. - IF sy-subrc = 0. - ls_cellxfs-numfmtid = <ls_built_in_format>-id. - ELSE. - READ TABLE lt_numfmts FROM ls_numfmt TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_cellxfs-numfmtid = sy-tabix. - ELSE. - APPEND ls_numfmt TO lt_numfmts. - DESCRIBE TABLE lt_numfmts LINES ls_cellxfs-numfmtid. - ENDIF. - ADD zcl_excel_common=>c_excel_numfmt_offset TO ls_cellxfs-numfmtid. " Add OXML offset for custom styles - ENDIF. - ls_cellxfs-applynumberformat = 1. - ELSE. - ls_cellxfs-applynumberformat = 0. - ENDIF. - "----------- " ALE changes on going - ELSE. - ls_cellxfs-applynumberformat = 1. - IF ls_numfmt-numfmt EQ zcl_excel_style_number_format=>c_format_date_std. - ls_cellxfs-numfmtid = 14. -* elseif ls_numfmt-NUMFMT eq 'STD_NDEC'. -* ls_cellxfs-numfmtid = 2. - ENDIF. - ENDIF. - "--- - - IF ls_cellxfs-fontid NE 0. - ls_cellxfs-applyfont = 1. - ELSE. - ls_cellxfs-applyfont = 0. - ENDIF. - IF ls_cellxfs-alignmentid NE 0. - ls_cellxfs-applyalignment = 1. - ELSE. - ls_cellxfs-applyalignment = 0. - ENDIF. - IF ls_cellxfs-fillid NE 0. - ls_cellxfs-applyfill = 1. - ELSE. - ls_cellxfs-applyfill = 0. - ENDIF. - IF ls_cellxfs-borderid NE 0. - ls_cellxfs-applyborder = 1. - ELSE. - ls_cellxfs-applyborder = 0. - ENDIF. - -* Remap styles - READ TABLE lt_cellxfs FROM ls_cellxfs TRANSPORTING NO FIELDS. - IF sy-subrc EQ 0. - ls_styles_mapping-style = sy-tabix. - ELSE. - APPEND ls_cellxfs TO lt_cellxfs. - DESCRIBE TABLE lt_cellxfs LINES ls_styles_mapping-style. - ENDIF. - SUBTRACT 1 FROM ls_styles_mapping-style. - ls_styles_mapping-guid = lo_style->get_guid( ). - APPEND ls_styles_mapping TO me->styles_mapping. - ENDWHILE. - - " create numfmt elements - LOOP AT lt_numfmts INTO ls_numfmt. - lo_element_numfmt = lo_document->create_simple_element( name = lc_xml_node_numfmt - parent = lo_document ). - lv_value = sy-tabix + zcl_excel_common=>c_excel_numfmt_offset. - CONDENSE lv_value. - lo_element_numfmt->set_attribute_ns( name = lc_xml_attr_numfmtid - value = lv_value ). - lv_value = ls_numfmt-numfmt. -* REPLACE ALL OCCURRENCES OF '.' IN lv_value WITH '\.'. - lo_element_numfmt->set_attribute_ns( name = lc_xml_attr_formatcode - value = lv_value ). - lo_element_numfmts->append_child( new_child = lo_element_numfmt ). - ENDLOOP. - - " create font elements - LOOP AT lt_fonts INTO ls_font. - lo_element_font = lo_document->create_simple_element( name = lc_xml_node_font - parent = lo_document ). - IF ls_font-bold EQ abap_true. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_b - parent = lo_document ). - lo_element_font->append_child( new_child = lo_sub_element ). - ENDIF. - IF ls_font-italic EQ abap_true. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_i - parent = lo_document ). - lo_element_font->append_child( new_child = lo_sub_element ). - ENDIF. - IF ls_font-underline EQ abap_true. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_u - parent = lo_document ). - lv_value = ls_font-underline_mode. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element ). - ENDIF. - IF ls_font-strikethrough EQ abap_true. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_strike - parent = lo_document ). - lo_element_font->append_child( new_child = lo_sub_element ). - ENDIF. - "size - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_sz - parent = lo_document ). - lv_value = ls_font-size. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element ). - "color - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_element_font - is_color = ls_font-color ). - - "name - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_name - parent = lo_document ). - lv_value = ls_font-name. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element ). - "family - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_family - parent = lo_document ). - lv_value = ls_font-family. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element ). - "scheme - IF ls_font-scheme IS NOT INITIAL. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_scheme - parent = lo_document ). - lv_value = ls_font-scheme. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_val - value = lv_value ). - lo_element_font->append_child( new_child = lo_sub_element ). - ENDIF. - lo_element_fonts->append_child( new_child = lo_element_font ). - ENDLOOP. - - " create fill elements - LOOP AT lt_fills INTO ls_fill. - lo_element_fill = lo_document->create_simple_element( name = lc_xml_node_fill - parent = lo_document ). - - IF ls_fill-gradtype IS NOT INITIAL. - "gradient - - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_gradientfill - parent = lo_document ). - IF ls_fill-gradtype-degree IS NOT INITIAL. - lv_value = ls_fill-gradtype-degree. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_degree value = lv_value ). - ENDIF. - IF ls_fill-gradtype-type IS NOT INITIAL. - lv_value = ls_fill-gradtype-type. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_type value = lv_value ). - ENDIF. - IF ls_fill-gradtype-bottom IS NOT INITIAL. - lv_value = ls_fill-gradtype-bottom. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_bottom value = lv_value ). - ENDIF. - IF ls_fill-gradtype-top IS NOT INITIAL. - lv_value = ls_fill-gradtype-top. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_top value = lv_value ). - ENDIF. - IF ls_fill-gradtype-right IS NOT INITIAL. - lv_value = ls_fill-gradtype-right. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_right value = lv_value ). - ENDIF. - IF ls_fill-gradtype-left IS NOT INITIAL. - lv_value = ls_fill-gradtype-left. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_left value = lv_value ). - ENDIF. - - IF ls_fill-gradtype-position3 IS NOT INITIAL. - "create <stop> elements for gradients, we can have 2 or 3 stops in each gradient - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_stop - parent = lo_sub_element ). - lv_value = ls_fill-gradtype-position1. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_position value = lv_value ). - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element_2 - is_color = ls_fill-bgcolor - iv_color_elem_name = lc_xml_node_color ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_stop - parent = lo_sub_element ). - - lv_value = ls_fill-gradtype-position2. - - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_position - value = lv_value ). - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element_2 - is_color = ls_fill-fgcolor - iv_color_elem_name = lc_xml_node_color ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_stop - parent = lo_sub_element ). - - lv_value = ls_fill-gradtype-position3. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_position - value = lv_value ). - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element_2 - is_color = ls_fill-bgcolor - iv_color_elem_name = lc_xml_node_color ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - - ELSE. - "create <stop> elements for gradients, we can have 2 or 3 stops in each gradient - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_stop - parent = lo_sub_element ). - lv_value = ls_fill-gradtype-position1. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_position value = lv_value ). - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element_2 - is_color = ls_fill-bgcolor - iv_color_elem_name = lc_xml_node_color ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_stop - parent = lo_sub_element ). - - lv_value = ls_fill-gradtype-position2. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_position - value = lv_value ). - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element_2 - is_color = ls_fill-fgcolor - iv_color_elem_name = lc_xml_node_color ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - ENDIF. - - - - - ELSE. - "pattern - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_patternfill - parent = lo_document ). - lv_value = ls_fill-filltype. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_patterntype - value = lv_value ). - " fgcolor - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_fill-fgcolor - iv_color_elem_name = lc_xml_node_fgcolor ). - - IF ls_fill-fgcolor-rgb IS INITIAL AND - ls_fill-fgcolor-indexed EQ zcl_excel_style_color=>c_indexed_not_set AND - ls_fill-fgcolor-theme EQ zcl_excel_style_color=>c_theme_not_set AND - ls_fill-fgcolor-tint IS INITIAL AND ls_fill-bgcolor-indexed EQ zcl_excel_style_color=>c_indexed_sys_foreground. - - " bgcolor - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_fill-bgcolor - iv_color_elem_name = lc_xml_node_bgcolor ). - - ENDIF. - ENDIF. - - lo_element_fill->append_child( new_child = lo_sub_element )."pattern - lo_element_fills->append_child( new_child = lo_element_fill ). - ENDLOOP. - - " create border elements - LOOP AT lt_borders INTO ls_border. - lo_element_border = lo_document->create_simple_element( name = lc_xml_node_border - parent = lo_document ). - - IF ls_border-diagonalup IS NOT INITIAL. - lv_value = ls_border-diagonalup. - CONDENSE lv_value. - lo_element_border->set_attribute_ns( name = lc_xml_attr_diagonalup - value = lv_value ). - ENDIF. - - IF ls_border-diagonaldown IS NOT INITIAL. - lv_value = ls_border-diagonaldown. - CONDENSE lv_value. - lo_element_border->set_attribute_ns( name = lc_xml_attr_diagonaldown - value = lv_value ). - ENDIF. - - "left - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_left - parent = lo_document ). - IF ls_border-left_style IS NOT INITIAL. - lv_value = ls_border-left_style. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_border-left_color ). - - lo_element_border->append_child( new_child = lo_sub_element ). - - "right - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_right - parent = lo_document ). - IF ls_border-right_style IS NOT INITIAL. - lv_value = ls_border-right_style. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_border-right_color ). - - lo_element_border->append_child( new_child = lo_sub_element ). - - "top - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_top - parent = lo_document ). - IF ls_border-top_style IS NOT INITIAL. - lv_value = ls_border-top_style. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_border-top_color ). - - lo_element_border->append_child( new_child = lo_sub_element ). - - "bottom - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_bottom - parent = lo_document ). - IF ls_border-bottom_style IS NOT INITIAL. - lv_value = ls_border-bottom_style. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_border-bottom_color ). - - lo_element_border->append_child( new_child = lo_sub_element ). - - "diagonal - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_diagonal - parent = lo_document ). - IF ls_border-diagonal_style IS NOT INITIAL. - lv_value = ls_border-diagonal_style. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_style - value = lv_value ). - ENDIF. - - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_sub_element - is_color = ls_border-diagonal_color ). - - lo_element_border->append_child( new_child = lo_sub_element ). - lo_element_borders->append_child( new_child = lo_element_border ). - ENDLOOP. - - " update attribute "count" - DESCRIBE TABLE lt_fonts LINES lv_fonts_count. - MOVE lv_fonts_count TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_fonts->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - DESCRIBE TABLE lt_fills LINES lv_fills_count. - MOVE lv_fills_count TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_fills->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - DESCRIBE TABLE lt_borders LINES lv_borders_count. - MOVE lv_borders_count TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_borders->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - DESCRIBE TABLE lt_cellxfs LINES lv_cellxfs_count. - MOVE lv_cellxfs_count TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element_cellxfs->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - - " Append to root node - lo_element_root->append_child( new_child = lo_element_numfmts ). - lo_element_root->append_child( new_child = lo_element_fonts ). - lo_element_root->append_child( new_child = lo_element_fills ). - lo_element_root->append_child( new_child = lo_element_borders ). - - " cellstylexfs node - lo_element = lo_document->create_simple_element( name = lc_xml_node_cellstylexfs - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_count - value = '1' ). - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_xf - parent = lo_document ). - - lo_sub_element->set_attribute_ns( name = lc_xml_attr_numfmtid - value = c_off ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_fontid - value = c_off ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_fillid - value = c_off ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_borderid - value = c_off ). - - lo_element->append_child( new_child = lo_sub_element ). - lo_element_root->append_child( new_child = lo_element ). - - LOOP AT lt_cellxfs INTO ls_cellxfs. - lo_element = lo_document->create_simple_element( name = lc_xml_node_xf - parent = lo_document ). - MOVE ls_cellxfs-numfmtid TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_numfmtid - value = lv_value ). - MOVE ls_cellxfs-fontid TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_fontid - value = lv_value ). - MOVE ls_cellxfs-fillid TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_fillid - value = lv_value ). - MOVE ls_cellxfs-borderid TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_borderid - value = lv_value ). - MOVE ls_cellxfs-xfid TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_xfid - value = lv_value ). - IF ls_cellxfs-applynumberformat EQ 1. - MOVE ls_cellxfs-applynumberformat TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_applynumberformat - value = lv_value ). - ENDIF. - IF ls_cellxfs-applyfont EQ 1. - MOVE ls_cellxfs-applyfont TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_applyfont - value = lv_value ). - ENDIF. - IF ls_cellxfs-applyfill EQ 1. - MOVE ls_cellxfs-applyfill TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_applyfill - value = lv_value ). - ENDIF. - IF ls_cellxfs-applyborder EQ 1. - MOVE ls_cellxfs-applyborder TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_applyborder - value = lv_value ). - ENDIF. - IF ls_cellxfs-applyalignment EQ 1. " depends on each style not for all the sheet - MOVE ls_cellxfs-applyalignment TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_element->set_attribute_ns( name = lc_xml_attr_applyalignment - value = lv_value ). - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_alignment - parent = lo_document ). - ADD 1 TO ls_cellxfs-alignmentid. "Table index starts from 1 - READ TABLE lt_alignments INTO ls_alignment INDEX ls_cellxfs-alignmentid. - SUBTRACT 1 FROM ls_cellxfs-alignmentid. - IF ls_alignment-horizontal IS NOT INITIAL. - MOVE ls_alignment-horizontal TO lv_value. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_horizontal - value = lv_value ). - ENDIF. - IF ls_alignment-vertical IS NOT INITIAL. - MOVE ls_alignment-vertical TO lv_value. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_vertical - value = lv_value ). - ENDIF. - IF ls_alignment-wraptext EQ abap_true. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_wraptext - value = c_on ). - ENDIF. - IF ls_alignment-textrotation IS NOT INITIAL. - MOVE ls_alignment-textrotation TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_textrotation - value = lv_value ). - ENDIF. - IF ls_alignment-shrinktofit EQ abap_true. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_shrinktofit - value = c_on ). - ENDIF. - IF ls_alignment-indent IS NOT INITIAL. - MOVE ls_alignment-indent TO lv_value. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_indent - value = lv_value ). - ENDIF. - - lo_element->append_child( new_child = lo_sub_element_2 ). - ENDIF. - IF ls_cellxfs-applyprotection EQ 1. - MOVE ls_cellxfs-applyprotection TO lv_value. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_applyprotection - value = lv_value ). - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_protection - parent = lo_document ). - ADD 1 TO ls_cellxfs-protectionid. "Table index starts from 1 - READ TABLE lt_protections INTO ls_protection INDEX ls_cellxfs-protectionid. - SUBTRACT 1 FROM ls_cellxfs-protectionid. - IF ls_protection-locked IS NOT INITIAL. - MOVE ls_protection-locked TO lv_value. - CONDENSE lv_value. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_locked - value = lv_value ). - ENDIF. - IF ls_protection-hidden IS NOT INITIAL. - MOVE ls_protection-hidden TO lv_value. - CONDENSE lv_value. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_hidden - value = lv_value ). - ENDIF. - lo_element->append_child( new_child = lo_sub_element_2 ). - ENDIF. - lo_element_cellxfs->append_child( new_child = lo_element ). - ENDLOOP. - - lo_element_root->append_child( new_child = lo_element_cellxfs ). - - " cellStyles node - lo_element = lo_document->create_simple_element( name = lc_xml_node_cellstyles - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_count - value = '1' ). - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_cellstyle - parent = lo_document ). - - lo_sub_element->set_attribute_ns( name = lc_xml_attr_name - value = 'Normal' ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_xfid - value = c_off ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_builtinid - value = c_off ). - - lo_element->append_child( new_child = lo_sub_element ). - lo_element_root->append_child( new_child = lo_element ). - - " dxfs node - lo_element = lo_document->create_simple_element( name = lc_xml_node_dxfs - parent = lo_document ). - - lo_iterator = me->excel->get_worksheets_iterator( ). - " get sheets - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - " Conditional formatting styles into exch sheet - lo_iterator2 = lo_worksheet->get_cond_styles_iterator( ). - WHILE lo_iterator2->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_style_conditional ?= lo_iterator2->if_object_collection_iterator~get_next( ). - CASE lo_style_conditional->rule. -* begin of change issue #366 - missing conditional rules: top10, move dfx-styles to own method - WHEN zcl_excel_style_conditional=>c_rule_cellis. - me->create_dxf_style( EXPORTING - iv_cell_style = lo_style_conditional->mode_cellis-cell_style - io_dxf_element = lo_element - io_ixml_document = lo_document - it_cellxfs = lt_cellxfs - it_fonts = lt_fonts - it_fills = lt_fills - CHANGING - cv_dfx_count = lv_dfx_count ). - - WHEN zcl_excel_style_conditional=>c_rule_expression. - me->create_dxf_style( EXPORTING - iv_cell_style = lo_style_conditional->mode_expression-cell_style - io_dxf_element = lo_element - io_ixml_document = lo_document - it_cellxfs = lt_cellxfs - it_fonts = lt_fonts - it_fills = lt_fills - CHANGING - cv_dfx_count = lv_dfx_count ). - - - - WHEN zcl_excel_style_conditional=>c_rule_top10. - me->create_dxf_style( EXPORTING - iv_cell_style = lo_style_conditional->mode_top10-cell_style - io_dxf_element = lo_element - io_ixml_document = lo_document - it_cellxfs = lt_cellxfs - it_fonts = lt_fonts - it_fills = lt_fills - CHANGING - cv_dfx_count = lv_dfx_count ). - - WHEN zcl_excel_style_conditional=>c_rule_above_average. - me->create_dxf_style( EXPORTING - iv_cell_style = lo_style_conditional->mode_above_average-cell_style - io_dxf_element = lo_element - io_ixml_document = lo_document - it_cellxfs = lt_cellxfs - it_fonts = lt_fonts - it_fills = lt_fills - CHANGING - cv_dfx_count = lv_dfx_count ). -* begin of change issue #366 - missing conditional rules: top10, move dfx-styles to own method - - WHEN OTHERS. - CONTINUE. - ENDCASE. - ENDWHILE. - ENDWHILE. - - lv_value = lv_dfx_count. - CONDENSE lv_value. - lo_element->set_attribute_ns( name = lc_xml_attr_count - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - - " tableStyles node - lo_element = lo_document->create_simple_element( name = lc_xml_node_tablestyles - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_count - value = '0' ). - lo_element->set_attribute_ns( name = lc_xml_attr_defaulttablestyle - value = zcl_excel_table=>builtinstyle_medium9 ). - lo_element->set_attribute_ns( name = lc_xml_attr_defaultpivotstyle - value = zcl_excel_table=>builtinstyle_pivot_light16 ). - lo_element_root->append_child( new_child = lo_element ). - - "write legacy color palette in case any indexed color was changed - IF excel->legacy_palette->is_modified( ) = abap_true. - lo_element = lo_document->create_simple_element( name = lc_xml_node_colors - parent = lo_document ). - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_indexedcolors - parent = lo_document ). - lo_element->append_child( new_child = lo_sub_element ). - - lt_colors = excel->legacy_palette->get_colors( ). - LOOP AT lt_colors INTO ls_color. - lo_sub_element_2 = lo_document->create_simple_element( name = lc_xml_node_rgbcolor - parent = lo_document ). - lv_value = ls_color. - lo_sub_element_2->set_attribute_ns( name = lc_xml_attr_rgb - value = lv_value ). - lo_sub_element->append_child( new_child = lo_sub_element_2 ). - ENDLOOP. - - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - - - - - METHOD create_xl_styles_color_node. - DATA: lo_sub_element TYPE REF TO if_ixml_element, - lv_value TYPE string. - - CONSTANTS: lc_xml_attr_theme TYPE string VALUE 'theme', - lc_xml_attr_rgb TYPE string VALUE 'rgb', - lc_xml_attr_indexed TYPE string VALUE 'indexed', - lc_xml_attr_tint TYPE string VALUE 'tint'. - - "add node only if at least one attribute is set - CHECK is_color-rgb IS NOT INITIAL OR - is_color-indexed <> zcl_excel_style_color=>c_indexed_not_set OR - is_color-theme <> zcl_excel_style_color=>c_theme_not_set OR - is_color-tint IS NOT INITIAL. - - lo_sub_element = io_document->create_simple_element( - name = iv_color_elem_name - parent = io_parent ). - - IF is_color-rgb IS NOT INITIAL. - lv_value = is_color-rgb. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_rgb - value = lv_value ). - ENDIF. - - IF is_color-indexed <> zcl_excel_style_color=>c_indexed_not_set. - lv_value = zcl_excel_common=>number_to_excel_string( is_color-indexed ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_indexed - value = lv_value ). - ENDIF. - - IF is_color-theme <> zcl_excel_style_color=>c_theme_not_set. - lv_value = zcl_excel_common=>number_to_excel_string( is_color-theme ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_theme - value = lv_value ). - ENDIF. - - IF is_color-tint IS NOT INITIAL. - lv_value = zcl_excel_common=>number_to_excel_string( is_color-tint ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_tint - value = lv_value ). - ENDIF. - - io_parent->append_child( new_child = lo_sub_element ). -ENDMETHOD. - - - - - METHOD create_xl_table. - - DATA: lc_xml_node_table TYPE string VALUE 'table', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'id', - lc_xml_attr_name TYPE string VALUE 'name', - lc_xml_attr_display_name TYPE string VALUE 'displayName', - lc_xml_attr_ref TYPE string VALUE 'ref', - lc_xml_attr_totals TYPE string VALUE 'totalsRowShown', - " Node namespace - lc_xml_node_table_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', - " Node id - lc_xml_node_ridx_id TYPE string VALUE 'rId#'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_element2 TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - - lv_table_name TYPE string, - lv_id TYPE i, - lv_match TYPE i, - lv_syindex TYPE char3, - lv_ref TYPE string, - lv_value TYPE string, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lv_num_columns TYPE i, - ls_fieldcat TYPE zexcel_s_fieldcatalog. - - -********************************************************************** -* STEP 1: Create xml - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node table - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_table - parent = lo_document ). - - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_table_ns ). - - lv_id = io_table->get_id( ). - lv_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_id ). - lo_element_root->set_attribute_ns( name = lc_xml_attr_id - value = lv_value ). - - FIND ALL OCCURRENCES OF REGEX '[^_a-zA-Z0-9]' IN io_table->settings-table_name IGNORING CASE MATCH COUNT lv_match. - IF io_table->settings-table_name IS NOT INITIAL AND lv_match EQ 0. - lv_table_name = io_table->settings-table_name. - ELSE. - lv_table_name = io_table->get_name( ). - ENDIF. - lo_element_root->set_attribute_ns( name = lc_xml_attr_name - value = lv_table_name ). - - lo_element_root->set_attribute_ns( name = lc_xml_attr_display_name - value = lv_table_name ). - - lv_ref = io_table->get_reference( ). - lo_element_root->set_attribute_ns( name = lc_xml_attr_ref - value = lv_ref ). - IF io_table->has_totals( ) = abap_true. - lo_element_root->set_attribute_ns( name = 'totalsRowCount' - value = '1' ). - ELSE. - lo_element_root->set_attribute_ns( name = lc_xml_attr_totals - value = '0' ). - ENDIF. - -********************************************************************** -* STEP 4: Create subnodes - - " autoFilter - IF io_table->settings-nofilters EQ abap_false. - lo_element = lo_document->create_simple_element( name = 'autoFilter' - parent = lo_document ). - - lv_ref = io_table->get_reference( ip_include_totals_row = abap_false ). - lo_element->set_attribute_ns( name = 'ref' - value = lv_ref ). - - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - "columns - lo_element = lo_document->create_simple_element( name = 'tableColumns' - parent = lo_document ). - -* lo_columns = io_table->get_columns( ). - LOOP AT io_table->fieldcat INTO ls_fieldcat WHERE dynpfld = abap_true. - ADD 1 TO lv_num_columns. - ENDLOOP. - - lv_value = lv_num_columns. - CONDENSE lv_value. - lo_element->set_attribute_ns( name = 'count' - value = lv_value ). - - lo_element_root->append_child( new_child = lo_element ). - - LOOP AT io_table->fieldcat INTO ls_fieldcat WHERE dynpfld = abap_true. - lo_element2 = lo_document->create_simple_element_ns( name = 'tableColumn' - parent = lo_element ). - - lv_value = ls_fieldcat-position. - SHIFT lv_value LEFT DELETING LEADING '0'. - lo_element2->set_attribute_ns( name = 'id' - value = lv_value ). - lv_value = ls_fieldcat-scrtext_l. - lo_element2->set_attribute_ns( name = 'name' - value = lv_value ). - - IF ls_fieldcat-totals_function IS NOT INITIAL. - lo_element2->set_attribute_ns( name = 'totalsRowFunction' - value = ls_fieldcat-totals_function ). - ENDIF. - - lo_element->append_child( new_child = lo_element2 ). - ENDLOOP. - - - lo_element = lo_document->create_simple_element( name = 'tableStyleInfo' - parent = lo_element_root ). - - lo_element->set_attribute_ns( name = 'name' - value = io_table->settings-table_style ). - - lo_element->set_attribute_ns( name = 'showFirstColumn' - value = '0' ). - - lo_element->set_attribute_ns( name = 'showLastColumn' - value = '0' ). - - IF io_table->settings-show_row_stripes = abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - - lo_element->set_attribute_ns( name = 'showRowStripes' - value = lv_value ). - - IF io_table->settings-show_column_stripes = abap_true. - lv_value = '1'. - ELSE. - lv_value = '0'. - ENDIF. - - lo_element->set_attribute_ns( name = 'showColumnStripes' - value = lv_value ). - - lo_element_root->append_child( new_child = lo_element ). -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - - method create_xl_theme. - data: lo_theme type ref to zcl_excel_theme. - - excel->get_theme( - importing - eo_theme = lo_theme - ). - if lo_theme is initial. - create object lo_theme. - endif. - ep_content = lo_theme->write_theme( ). - -endmethod. - - - - METHOD create_xl_workbook. -*--------------------------------------------------------------------* -* issue #230 - Pimp my Code -* - Stefan Schmoecker, (done) 2012-11-07 -* - ... -* changes: aligning code -* adding comments to explain what we are trying to achieve -*--------------------------------------------------------------------* -* issue#235 - repeat rows/columns -* - Stefan Schmoecker, 2012-12-01 -* changes: correction of pointer to localSheetId -*--------------------------------------------------------------------* - -** Constant node name - DATA: lc_xml_node_workbook TYPE string VALUE 'workbook', - lc_xml_node_fileversion TYPE string VALUE 'fileVersion', - lc_xml_node_workbookpr TYPE string VALUE 'workbookPr', - lc_xml_node_bookviews TYPE string VALUE 'bookViews', - lc_xml_node_workbookview TYPE string VALUE 'workbookView', - lc_xml_node_sheets TYPE string VALUE 'sheets', - lc_xml_node_sheet TYPE string VALUE 'sheet', - lc_xml_node_calcpr TYPE string VALUE 'calcPr', - lc_xml_node_workbookprotection TYPE string VALUE 'workbookProtection', - lc_xml_node_definednames TYPE string VALUE 'definedNames', - lc_xml_node_definedname TYPE string VALUE 'definedName', - " Node attributes - lc_xml_attr_appname TYPE string VALUE 'appName', - lc_xml_attr_lastedited TYPE string VALUE 'lastEdited', - lc_xml_attr_lowestedited TYPE string VALUE 'lowestEdited', - lc_xml_attr_rupbuild TYPE string VALUE 'rupBuild', - lc_xml_attr_themeversion TYPE string VALUE 'defaultThemeVersion', - lc_xml_attr_xwindow TYPE string VALUE 'xWindow', - lc_xml_attr_ywindow TYPE string VALUE 'yWindow', - lc_xml_attr_windowwidth TYPE string VALUE 'windowWidth', - lc_xml_attr_windowheight TYPE string VALUE 'windowHeight', - lc_xml_attr_activetab TYPE string VALUE 'activeTab', - lc_xml_attr_name TYPE string VALUE 'name', - lc_xml_attr_sheetid TYPE string VALUE 'sheetId', - lc_xml_attr_state TYPE string VALUE 'state', - lc_xml_attr_id TYPE string VALUE 'id', - lc_xml_attr_calcid TYPE string VALUE 'calcId', - lc_xml_attr_lockrevision TYPE string VALUE 'lockRevision', - lc_xml_attr_lockstructure TYPE string VALUE 'lockStructure', - lc_xml_attr_lockwindows TYPE string VALUE 'lockWindows', - lc_xml_attr_revisionspassword TYPE string VALUE 'revisionsPassword', - lc_xml_attr_workbookpassword TYPE string VALUE 'workbookPassword', - lc_xml_attr_hidden TYPE string VALUE 'hidden', - lc_xml_attr_localsheetid TYPE string VALUE 'localSheetId', - " Node namespace - lc_r_ns TYPE string VALUE 'r', - lc_xml_node_ns TYPE string VALUE 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', - lc_xml_node_r_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', - " Node id - lc_xml_node_ridx_id TYPE string VALUE 'rId#'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_element_root TYPE REF TO if_ixml_element, - lo_element TYPE REF TO if_ixml_element, - lo_element_range TYPE REF TO if_ixml_element, - lo_sub_element TYPE REF TO if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer, - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_iterator_range TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_range TYPE REF TO zcl_excel_range, - lo_autofilters TYPE REF TO zcl_excel_autofilters, - lo_autofilter TYPE REF TO zcl_excel_autofilter. - - DATA: lv_xml_node_ridx_id TYPE string, - lv_value TYPE string, - lv_syindex TYPE string, - l_guid TYPE uuid, - lv_active_sheet TYPE zexcel_active_worksheet. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - -********************************************************************** -* STEP 3: Create main node - lo_element_root = lo_document->create_simple_element( name = lc_xml_node_workbook - parent = lo_document ). - lo_element_root->set_attribute_ns( name = 'xmlns' - value = lc_xml_node_ns ). - lo_element_root->set_attribute_ns( name = 'xmlns:r' - value = lc_xml_node_r_ns ). - -********************************************************************** -* STEP 4: Create subnode - " fileVersion node - lo_element = lo_document->create_simple_element( name = lc_xml_node_fileversion - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_appname - value = 'xl' ). - lo_element->set_attribute_ns( name = lc_xml_attr_lastedited - value = '4' ). - lo_element->set_attribute_ns( name = lc_xml_attr_lowestedited - value = '4' ). - lo_element->set_attribute_ns( name = lc_xml_attr_rupbuild - value = '4506' ). - lo_element_root->append_child( new_child = lo_element ). - - " fileVersion node - lo_element = lo_document->create_simple_element( name = lc_xml_node_workbookpr - parent = lo_document ). -* lo_element->set_attribute_ns( name = lc_xml_attr_themeversion -* value = '124226' ). - lo_element_root->append_child( new_child = lo_element ). - - " workbookProtection node - IF me->excel->zif_excel_book_protection~protected EQ abap_true. - lo_element = lo_document->create_simple_element( name = lc_xml_node_workbookprotection - parent = lo_document ). - MOVE me->excel->zif_excel_book_protection~workbookpassword TO lv_value. - IF lv_value IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_workbookpassword - value = lv_value ). - ENDIF. - MOVE me->excel->zif_excel_book_protection~revisionspassword TO lv_value. - IF lv_value IS NOT INITIAL. - lo_element->set_attribute_ns( name = lc_xml_attr_revisionspassword - value = lv_value ). - ENDIF. - MOVE me->excel->zif_excel_book_protection~lockrevision TO lv_value. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_lockrevision - value = lv_value ). - MOVE me->excel->zif_excel_book_protection~lockstructure TO lv_value. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_lockstructure - value = lv_value ). - MOVE me->excel->zif_excel_book_protection~lockwindows TO lv_value. - CONDENSE lv_value NO-GAPS. - lo_element->set_attribute_ns( name = lc_xml_attr_lockwindows - value = lv_value ). - lo_element_root->append_child( new_child = lo_element ). - ENDIF. - - " bookviews node - lo_element = lo_document->create_simple_element( name = lc_xml_node_bookviews - parent = lo_document ). - " bookview node - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_workbookview - parent = lo_document ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_xwindow - value = '120' ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_ywindow - value = '120' ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_windowwidth - value = '19035' ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_windowheight - value = '8445' ). - " Set Active Sheet - lv_active_sheet = excel->get_active_sheet_index( ). -* issue #365 - test if sheet exists - otherwise set active worksheet to 1 - lo_worksheet = excel->get_worksheet_by_index( lv_active_sheet ). - IF lo_worksheet IS NOT BOUND. - lv_active_sheet = 1. - excel->SET_ACTIVE_SHEET_INDEX( lv_active_sheet ). - ENDIF. - IF lv_active_sheet > 1. - lv_active_sheet = lv_active_sheet - 1. - lv_value = lv_active_sheet. - CONDENSE lv_value. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_activetab - value = lv_value ). - ENDIF. - lo_element->append_child( new_child = lo_sub_element )." bookview node - lo_element_root->append_child( new_child = lo_element )." bookviews node - - " sheets node - lo_element = lo_document->create_simple_element( name = lc_xml_node_sheets - parent = lo_document ). - lo_iterator = excel->get_worksheets_iterator( ). - - " ranges node - lo_element_range = lo_document->create_simple_element( name = lc_xml_node_definednames " issue 163 + - parent = lo_document ). " issue 163 + - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - " sheet node - lo_sub_element = lo_document->create_simple_element_ns( name = lc_xml_node_sheet - parent = lo_document ). - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - lv_syindex = sy-index. " question by Stefan Schmöcker 2012-12-02: sy-index seems to do the job - but is it proven to work or purely coincedence - lv_value = lo_worksheet->get_title( ). - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_id WITH lv_syindex. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_name - value = lv_value ). - lo_sub_element->set_attribute_ns( name = lc_xml_attr_sheetid - value = lv_syindex ). - IF lo_worksheet->zif_excel_sheet_properties~hidden EQ zif_excel_sheet_properties=>c_hidden. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_state - value = 'hidden' ). - ELSEIF lo_worksheet->zif_excel_sheet_properties~hidden EQ zif_excel_sheet_properties=>c_veryhidden. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_state - value = 'veryHidden' ). - ENDIF. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_id - prefix = lc_r_ns - value = lv_xml_node_ridx_id ). - lo_element->append_child( new_child = lo_sub_element ). " sheet node - - " issue 163 >>> - lo_iterator_range = lo_worksheet->get_ranges_iterator( ). - -*--------------------------------------------------------------------* -* Defined names sheetlocal: Ranges, Repeat rows and columns -*--------------------------------------------------------------------* - WHILE lo_iterator_range->if_object_collection_iterator~has_next( ) EQ abap_true. - " range node - lo_sub_element = lo_document->create_simple_element_ns( name = lc_xml_node_definedname - parent = lo_document ). - lo_range ?= lo_iterator_range->if_object_collection_iterator~get_next( ). - lv_value = lo_range->name. - - lo_sub_element->set_attribute_ns( name = lc_xml_attr_name - value = lv_value ). - -* lo_sub_element->set_attribute_ns( name = lc_xml_attr_localsheetid "del #235 Repeat rows/cols - EXCEL starts couting from zero -* value = lv_xml_node_ridx_id ). "del #235 Repeat rows/cols - and needs absolute referencing to localSheetId - lv_value = lv_syindex - 1. "ins #235 Repeat rows/cols - CONDENSE lv_value NO-GAPS. "ins #235 Repeat rows/cols - lo_sub_element->set_attribute_ns( name = lc_xml_attr_localsheetid - value = lv_value ). - - lv_value = lo_range->get_value( ). - lo_sub_element->set_value( value = lv_value ). - lo_element_range->append_child( new_child = lo_sub_element ). " range node - - ENDWHILE. - " issue 163 <<< - - ENDWHILE. - lo_element_root->append_child( new_child = lo_element )." sheets node - - -*--------------------------------------------------------------------* -* Defined names workbookgolbal: Ranges -*--------------------------------------------------------------------* -* " ranges node -* lo_element = lo_document->create_simple_element( name = lc_xml_node_definednames " issue 163 - -* parent = lo_document ). " issue 163 - - lo_iterator = excel->get_ranges_iterator( ). - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - " range node - lo_sub_element = lo_document->create_simple_element_ns( name = lc_xml_node_definedname - parent = lo_document ). - lo_range ?= lo_iterator->if_object_collection_iterator~get_next( ). - lv_value = lo_range->name. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_name - value = lv_value ). - lv_value = lo_range->get_value( ). - lo_sub_element->set_value( value = lv_value ). - lo_element_range->append_child( new_child = lo_sub_element ). " range node - - ENDWHILE. - -*--------------------------------------------------------------------* -* Defined names - Autofilters ( also sheetlocal ) -*--------------------------------------------------------------------* - lo_autofilters = excel->get_autofilters_reference( ). - IF lo_autofilters->is_empty( ) = abap_false. - lo_iterator = excel->get_worksheets_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - lv_syindex = sy-index - 1 . - l_guid = lo_worksheet->get_guid( ). - lo_autofilter = lo_autofilters->get( i_sheet_guid = l_guid ) . - IF lo_autofilter IS BOUND. - lo_sub_element = lo_document->create_simple_element_ns( name = lc_xml_node_definedname - parent = lo_document ). - lv_value = lo_autofilters->c_autofilter. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_name - value = lv_value ). - lv_value = lv_syindex. - CONDENSE lv_value NO-GAPS. - lo_sub_element->set_attribute_ns( name = lc_xml_attr_localsheetid - value = lv_value ). - lv_value = '1'. " Always hidden - lo_sub_element->set_attribute_ns( name = lc_xml_attr_hidden - value = lv_value ). - lv_value = lo_autofilter->get_filter_reference( ). - lo_sub_element->set_value( value = lv_value ). - lo_element_range->append_child( new_child = lo_sub_element ). " range node - ENDIF. - - ENDWHILE. - ENDIF. - lo_element_root->append_child( new_child = lo_element_range ). " ranges node - - - " calcPr node - lo_element = lo_document->create_simple_element( name = lc_xml_node_calcpr - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_calcid - value = '125725' ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - - - method FLAG2BOOL. - - - IF ip_flag EQ abap_true. - ep_boolean = 'true'. - ELSE. - ep_boolean = 'false'. - ENDIF. - endmethod. - - - - - METHOD get_shared_string_index. - - - DATA ls_shared_string TYPE zexcel_s_shared_string. - -* READ TABLE shared_strings INTO ls_shared_string WITH KEY string_value = ip_cell_value BINARY SEARCH. - READ TABLE shared_strings INTO ls_shared_string WITH TABLE KEY string_value = ip_cell_value. - ep_index = ls_shared_string-string_no. - -ENDMETHOD. - - - - - METHOD render_ixml_element_no_header. - -* - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, -* lo_element_root type ref to if_ixml_element, -* lo_element type ref to if_ixml_element, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - - DATA: lv_content TYPE string. - DATA: lv_contentx TYPE xstring. - -********************************************************************** -* STEP 1: Create [Content_Types].xml into the root of the ZIP - lo_ixml = cl_ixml=>create( ). - -********************************************************************** -* STEP 2: Set document attributes - lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian - character_set = 'utf-8' ). - lo_document = lo_ixml->create_document( ). - lo_document->set_encoding( lo_encoding ). - lo_document->set_standalone( abap_true ). - lo_document->set_declaration( abap_false ). " NO header!! - - lo_document->append_child( new_child = iv_ixml_element ). - - -********************************************************************** -* STEP 5: Create xstring stream - lo_streamfactory = lo_ixml->create_stream_factory( ). -* lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_ostream = lo_streamfactory->create_ostream_cstring( string = lv_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -* write:/ lv_content. - - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = rv_xstring ). -* lo_ostream = lo_streamfactory->create_ostream_cstring( string = lv_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - - -* rv_xstring = lv_contentx. - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_CSV.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_CSV.slnk deleted file mode 100644 index b882522..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_CSV.slnk +++ /dev/null @@ -1,285 +0,0 @@ - - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - method ZIF_EXCEL_WRITER~WRITE_FILE. - me->excel = io_excel. - ep_file = me->create( ). - endmethod. - - - - method CREATE. - -* .csv format with ; delimiter - - ep_excel = me->CREATE_CSV( ). - - endmethod. - - - - method CREATE_CSV. - - TYPES: BEGIN OF lty_format, - cmpname TYPE SEOCMPNAME, - attvalue TYPE SEOVALUE, - END OF lty_format. - DATA: lt_format TYPE STANDARD TABLE OF lty_format, - ls_format LIKE LINE OF lt_format, - lv_date TYPE DATS, - lv_tmp TYPE string, - lv_time TYPE CHAR08. - - DATA: lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet. - - DATA: lt_cell_data TYPE zexcel_t_cell_data_unsorted, - lv_row TYPE sytabix, - lv_col TYPE sytabix, - lv_string TYPE string, - lc_value TYPE string, - lv_attrname TYPE SEOCMPNAME. - - DATA: ls_numfmt TYPE zexcel_s_style_numfmt, - lo_style TYPE REF TO zcl_excel_style. - - FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data. - -* --- Retrieve supported cell format - REFRESH lt_format. - SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_format - FROM seocompodf - WHERE clsname = 'ZCL_EXCEL_STYLE_NUMBER_FORMAT' - AND typtype = 1 - AND type = 'ZEXCEL_NUMBER_FORMAT'. - -* --- Retrieve SAP date format - CLEAR ls_format. - SELECT ddtext INTO ls_format-attvalue FROM dd07t WHERE domname = 'XUDATFM' - AND ddlanguage = sy-langu. - ls_format-cmpname = 'DATE'. - CONDENSE ls_format-attvalue. - CONCATENATE '''' ls_format-attvalue '''' INTO ls_format-attvalue. - APPEND ls_format TO lt_format. - ENDSELECT. - - - LOOP AT lt_format INTO ls_format. - TRANSLATE ls_format-attvalue TO UPPER CASE. - MODIFY lt_format FROM ls_format. - ENDLOOP. - - -* STEP 1: Collect strings from the first worksheet - lo_iterator = excel->get_worksheets_iterator( ). - data: current_worksheet_title type ZEXCEL_SHEET_TITLE. - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - - IF worksheet_name IS NOT INITIAL. - current_worksheet_title = lo_worksheet->get_title( ). - CHECK current_worksheet_title = worksheet_name. - ELSE. - IF worksheet_index IS INITIAL. - worksheet_index = 1. - ENDIF. - CHECK worksheet_index = sy-index. - ENDIF. - APPEND LINES OF lo_worksheet->sheet_content TO lt_cell_data. - EXIT. " Take first worksheet only - ENDWHILE. - - DELETE lt_cell_data WHERE cell_formula IS NOT INITIAL. " delete formula content - - SORT lt_cell_data BY cell_row - cell_column. - lv_row = 1. - lv_col = 1. - CLEAR lv_string. - LOOP AT lt_cell_data ASSIGNING <fs_sheet_content>. - -* --- Retrieve Cell Style format and data type - CLEAR ls_numfmt. - IF <fs_sheet_content>-data_type IS INITIAL AND <fs_sheet_content>-cell_style IS NOT INITIAL. - lo_iterator = excel->get_styles_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_style ?= lo_iterator->if_object_collection_iterator~get_next( ). - CHECK lo_style->get_guid( ) = <fs_sheet_content>-cell_style. - ls_numfmt = lo_style->number_format->get_structure( ). - EXIT. - ENDWHILE. - ENDIF. - IF <fs_sheet_content>-data_type IS INITIAL AND ls_numfmt IS NOT INITIAL. - " determine data-type - CLEAR lv_attrname. - CONCATENATE '''' ls_numfmt-NUMFMT '''' INTO ls_numfmt-NUMFMT. - TRANSLATE ls_numfmt-numfmt TO UPPER CASE. - READ TABLE lt_format INTO ls_format WITH KEY attvalue = ls_numfmt-NUMFMT. - IF sy-subrc = 0. - lv_attrname = ls_format-cmpname. - ENDIF. - - IF lv_attrname IS NOT INITIAL. - FIND FIRST OCCURRENCE OF 'DATETIME' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 'd'. - ELSE. - FIND FIRST OCCURRENCE OF 'TIME' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 't'. - ELSE. - FIND FIRST OCCURRENCE OF 'DATE' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 'd'. - ELSE. - FIND FIRST OCCURRENCE OF 'CURRENCY' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 'n'. - ELSE. - FIND FIRST OCCURRENCE OF 'NUMBER' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 'n'. - ELSE. - FIND FIRST OCCURRENCE OF 'PERCENTAGE' IN lv_attrname. - IF sy-subrc = 0. - <fs_sheet_content>-data_type = 'n'. - ENDIF. " Purcentage - ENDIF. " Number - ENDIF. " Currency - ENDIF. " Date - ENDIF. " TIME - ENDIF. " DATETIME - ENDIF. " lv_attrname IS NOT INITIAL. - ENDIF. " <fs_sheet_content>-data_type IS INITIAL AND ls_numfmt IS NOT INITIAL. - -* --- Add empty rows - WHILE lv_row < <fs_sheet_content>-cell_row. -* CONCATENATE lv_string cl_abap_char_utilities=>newline INTO lv_string. -* CONCATENATE lv_string cl_abap_char_utilities=>cr_lf INTO lv_string. - CONCATENATE lv_string zcl_excel_writer_csv=>eol INTO lv_string. - lv_row = lv_row + 1. - lv_col = 1. - ENDWHILE. - -* --- Add empty columns - WHILE lv_col < <fs_sheet_content>-cell_column. -* CONCATENATE lv_string ';' INTO lv_string. - CONCATENATE lv_string zcl_excel_writer_csv=>delimiter INTO lv_string. - lv_col = lv_col + 1. - ENDWHILE. - -* ----- Use format to determine the data type and display format. - CASE <fs_sheet_content>-data_type. -* WHEN 'n' OR 'N'. -* lc_value = zcl_excel_common=>excel_number_to_string( ip_value = <fs_sheet_content>-cell_value ). - - WHEN 'd' OR 'D'. - lc_value = zcl_excel_common=>excel_string_to_date( ip_value = <fs_sheet_content>-cell_value ). - TRY. - lv_date = lc_value. - CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL' - EXPORTING - DATE_INTERNAL = lv_date - IMPORTING - DATE_EXTERNAL = lv_tmp - EXCEPTIONS - DATE_INTERNAL_IS_INVALID = 1 - OTHERS = 2 - . - IF SY-SUBRC = 0. - lc_value = lv_tmp. - ENDIF. - - CATCH CX_SY_CONVERSION_NO_NUMBER. - - ENDTRY. - - WHEN 't' OR 'T'. - lc_value = zcl_excel_common=>excel_string_to_time( ip_value = <fs_sheet_content>-cell_value ). - write lc_value to lv_time USING EDIT MASK '__:__:__'. - lc_value = lv_time. - WHEN OTHERS. - lc_value = <fs_sheet_content>-cell_value. - - ENDCASE. - -* REPLACE ALL OCCURRENCES OF '"' in lc_value with '""'. - CONCATENATE zcl_excel_writer_csv=>enclosure zcl_excel_writer_csv=>enclosure INTO lv_tmp. - CONDENSE lv_tmp. - REPLACE ALL OCCURRENCES OF zcl_excel_writer_csv=>enclosure in lc_value with lv_tmp. - -* FIND FIRST OCCURRENCE OF ';' IN lc_value. - FIND FIRST OCCURRENCE OF zcl_excel_writer_csv=>delimiter IN lc_value. - IF sy-subrc = 0. - CONCATENATE lv_string zcl_excel_writer_csv=>enclosure lc_value zcl_excel_writer_csv=>enclosure INTO lv_string. - ELSE. - CONCATENATE lv_string lc_value INTO lv_string. - ENDIF. - - ENDLOOP. " AT lt_cell_data - - CLEAR ep_content. - - CALL FUNCTION 'SCMS_STRING_TO_XSTRING' - EXPORTING - TEXT = lv_string -* MIMETYPE = ' ' -* ENCODING = - IMPORTING - BUFFER = ep_content - EXCEPTIONS - FAILED = 1 - OTHERS = 2 - . - - endmethod. - - - - method SET_ACTIVE_SHEET_INDEX. - CLEAR WORKSHEET_NAME. - WORKSHEET_INDEX = i_active_worksheet. - endmethod. - - - - method SET_ACTIVE_SHEET_INDEX_BY_NAME. - CLEAR WORKSHEET_INDEX. - WORKSHEET_NAME = i_worksheet_name. - endmethod. - - - - method SET_DELIMITER. - delimiter = ip_value. - endmethod. - - - - method SET_ENCLOSURE. - zcl_excel_writer_csv=>enclosure = ip_value. - endmethod. - - - - method SET_ENDOFLINE. - zcl_excel_writer_csv=>eol = ip_value. - endmethod. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_HUGE_FILE.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_HUGE_FILE.slnk deleted file mode 100644 index 759ea0b..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_HUGE_FILE.slnk +++ /dev/null @@ -1,817 +0,0 @@ - - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - METHOD create_xl_sharedstrings. -* -* Redefinition using simple transformation instead of CL_IXML -* -** Constant node name - - TYPES: - BEGIN OF ts_root, - count TYPE string, - unique_count TYPE string, - END OF ts_root. - - DATA: - lv_last_allowed_char TYPE char1, - lv_invalid TYPE string. - - DATA: - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_worksheet TYPE REF TO zcl_excel_worksheet. - - DATA: - ls_root TYPE ts_root, - lt_cell_data TYPE zexcel_t_cell_data_unsorted, - ls_shared_string TYPE zexcel_s_shared_string, - lv_sytabix TYPE sytabix. - - FIELD-SYMBOLS: - <sheet_content> TYPE zexcel_s_cell_data. - -********************************************************************** -* STEP 0: Build Regex for invalid characters - CASE cl_abap_char_utilities=>charsize. - WHEN 1.lv_last_allowed_char = cl_abap_conv_in_ce=>uccpi( 255 ). " FF in non-Unicode - WHEN 2.lv_last_allowed_char = cl_abap_conv_in_ce=>uccpi( 65533 )." FFFD in Unicode - ENDCASE. - CONCATENATE '[^\n\t\r -' lv_last_allowed_char ']' INTO lv_invalid. - -********************************************************************** -* STEP 1: Collect strings from each worksheet - - lo_iterator = excel->get_worksheets_iterator( ). - - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_worksheet ?= lo_iterator->if_object_collection_iterator~get_next( ). - APPEND LINES OF lo_worksheet->sheet_content TO lt_cell_data. - ENDWHILE. - - DELETE lt_cell_data WHERE cell_formula IS NOT INITIAL " delete formula content - OR data_type NE 's'. " MvC: Only shared strings - - ls_root-count = lines( lt_cell_data ). - CONDENSE ls_root-count. - - SORT lt_cell_data BY cell_value. - DELETE ADJACENT DUPLICATES FROM lt_cell_data COMPARING cell_value. - - ls_root-unique_count = lines( lt_cell_data ). - CONDENSE ls_root-unique_count. - - LOOP AT lt_cell_data ASSIGNING <sheet_content>. - - lv_sytabix = sy-tabix - 1. - MOVE lv_sytabix TO ls_shared_string-string_no. - MOVE <sheet_content>-cell_value TO ls_shared_string-string_value. - REPLACE ALL OCCURRENCES OF REGEX lv_invalid - IN ls_shared_string-string_value WITH ` `. - APPEND ls_shared_string TO shared_strings. - - ENDLOOP. - -********************************************************************** -* STEP 2: Create XML - - CALL TRANSFORMATION zexcel_tr_shared_strings - SOURCE root = ls_root - shared_strings = shared_strings - OPTIONS xml_header = 'full' - RESULT XML ep_content. - - -ENDMETHOD. - - - METHOD create_xl_sheet. -* -* Build Sheet#.xml with Simple Transformation ZEXCEL_TR_SHEET -* -* This is an adaption of ZCL_EXCEL_WRITER_2007. -* Not all features are supported, notably the autofilter settings, -* conditional formatting and sheet protection. -* -* Bug reports to marcus.voncube AT deutschebahn.com -* - TYPES: - lty_bool TYPE c LENGTH 5. - - CONSTANTS: - lc_false TYPE lty_bool VALUE 'false', "#EC NEEDED - lc_true TYPE lty_bool VALUE 'true', - lc_zero TYPE c LENGTH 1 VALUE '0', - lc_one TYPE c LENGTH 1 VALUE '1', - lc_default_col_width TYPE float VALUE '9.10'. - - TYPES: - BEGIN OF lty_column, - min TYPE i, - max TYPE i, - width TYPE float, - hidden TYPE lty_bool, - customwidth TYPE lty_bool, - bestfit TYPE lty_bool, - collapsed TYPE lty_bool, - outlinelevel TYPE i, - style TYPE i, - END OF lty_column, - - BEGIN OF lty_row, - row TYPE i, - index TYPE i, - spans TYPE c LENGTH 11, "12345:12345" - hidden TYPE lty_bool, - customheight TYPE lty_bool, - height TYPE float, - collapsed TYPE lty_bool, - outlinelevel TYPE i, - customformat TYPE lty_bool, - style TYPE i, - END OF lty_row, - - BEGIN OF lty_mergecell, - ref TYPE c LENGTH 21, "AAA1234567:BBB1234567" - END OF lty_mergecell, - - BEGIN OF lty_hyperlink, - ref TYPE string, - location TYPE string, - r_id TYPE string, - END OF lty_hyperlink, - - BEGIN OF lty_table, - r_id TYPE string, - END OF lty_table, - - BEGIN OF lty_table_area, - left TYPE i, - right TYPE i, - top TYPE i, - bottom TYPE i, - END OF lty_table_area, - - BEGIN OF ty_missing_columns, - first_column TYPE zexcel_cell_column, - last_column TYPE zexcel_cell_column, - END OF ty_missing_columns. - -* -* Root node for transformation -* - DATA: - BEGIN OF l_worksheet, - dimension TYPE string, - tabcolor TYPE string, - summarybelow TYPE c, - summaryright TYPE c, - fittopage TYPE c, - showzeros TYPE c, - tabselected TYPE c, - zoomscale TYPE i, - zoomscalenormal TYPE i, - zoomscalepageview TYPE i, - zoomscalesheetview TYPE i, - workbookviewid TYPE c, - showgridlines TYPE c, - showrowcolheaders TYPE c, - activepane TYPE string, - state TYPE string, - ysplit TYPE i, - xsplit TYPE i, - topleftcell TYPE c LENGTH 10, - activecell TYPE c LENGTH 10, - customheight TYPE lty_bool, - defaultrowheight TYPE float, - defaultcolwidth TYPE float, - outlinelevelrow TYPE i, - outlinelevelcol TYPE i, - cols TYPE STANDARD TABLE OF lty_column, - rows TYPE STANDARD TABLE OF lty_row, - mergecells_count TYPE i, - mergecells TYPE STANDARD TABLE OF lty_mergecell, - hyperlinks_count TYPE i, - hyperlinks TYPE STANDARD TABLE OF lty_hyperlink, - BEGIN OF printoptions, - gridlines TYPE lty_bool, - horizontalcentered TYPE lty_bool, - verticalcentered TYPE lty_bool, - END OF printoptions, - BEGIN OF pagemargins, - left TYPE zexcel_dec_8_2, - right TYPE zexcel_dec_8_2, - top TYPE zexcel_dec_8_2, - bottom TYPE zexcel_dec_8_2, - header TYPE zexcel_dec_8_2, - footer TYPE zexcel_dec_8_2, - END OF pagemargins, - BEGIN OF pagesetup, - blackandwhite TYPE c, - cellcomments TYPE string, - copies TYPE i, - draft TYPE c, - errors TYPE string, - firstpagenumber TYPE i, - fittopage TYPE c, - fittoheight TYPE i, - fittowidth TYPE i, - horizontaldpi TYPE i, - orientation TYPE string, - pageorder TYPE string, - paperheight TYPE string, - papersize TYPE i, - paperwidth TYPE string, - scale TYPE i, - usefirstpagenumber TYPE c, - useprinterdefaults TYPE c, - verticaldpi TYPE i, - END OF pagesetup, - BEGIN OF headerfooter, - differentoddeven TYPE c, - oddheader TYPE string, - oddfooter TYPE string, - evenheader TYPE string, - evenfooter TYPE string, - END OF headerfooter, - drawings TYPE string, - tables_count TYPE i, - tables TYPE STANDARD TABLE OF lty_table, - END OF l_worksheet. - -* -* Local data -* - DATA: - lo_iterator TYPE REF TO cl_object_collection_iterator, - lo_table TYPE REF TO zcl_excel_table, - row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, - default_col_dimension TYPE REF TO zcl_excel_worksheet_columndime, - default_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, - lv_value TYPE string, - lv_index TYPE i, - lv_spans TYPE string, - lt_range_merge TYPE string_table, - lv_column TYPE zexcel_cell_column, - lv_style_guid TYPE zexcel_cell_style, - ls_last_row TYPE zexcel_s_cell_data, - lv_freeze_cell_row TYPE zexcel_cell_row, - lv_freeze_cell_column TYPE zexcel_cell_column, - lv_freeze_cell_column_alpha TYPE zexcel_cell_column_alpha, - column_dimensions TYPE zexcel_t_worksheet_columndime, - row_dimensions TYPE zexcel_t_worksheet_rowdimensio, - lv_relation_id TYPE i VALUE 0, - outline_level_row TYPE i VALUE 0, - outline_level_col TYPE i VALUE 0, - col_count TYPE int4, - lt_table_areas TYPE SORTED TABLE OF lty_table_area - WITH NON-UNIQUE KEY left right top bottom, - ls_table_area LIKE LINE OF lt_table_areas, - lts_sorted_columns TYPE SORTED TABLE OF zexcel_cell_column - WITH UNIQUE KEY table_line, - t_missing_columns TYPE STANDARD TABLE OF ty_missing_columns - WITH NON-UNIQUE DEFAULT KEY, - missing_column LIKE LINE OF t_missing_columns, - lo_link TYPE REF TO zcl_excel_hyperlink, - lo_drawings TYPE REF TO zcl_excel_drawings. - - FIELD-SYMBOLS: - <sheet_content> TYPE zexcel_s_cell_data, - <range_merge> LIKE LINE OF lt_range_merge, - <column_dimension> TYPE zexcel_s_worksheet_columndime, - <row_dimension> TYPE zexcel_s_worksheet_rowdimensio, - <col> TYPE lty_column, - <row> TYPE lty_row, - <hyperlink> TYPE lty_hyperlink, - <mergecell> TYPE lty_mergecell, - <table> TYPE lty_table. - -********************************************************************** -* STEP 1: Fill root node -* - l_worksheet-tabcolor = io_worksheet->tabcolor-rgb. - l_worksheet-summarybelow = io_worksheet->zif_excel_sheet_properties~summarybelow. - l_worksheet-summaryright = io_worksheet->zif_excel_sheet_properties~summaryright. - - IF io_worksheet->sheet_setup->fit_to_page IS NOT INITIAL. - l_worksheet-fittopage = lc_one. - ENDIF. - - l_worksheet-dimension = io_worksheet->get_dimension_range( ). - - IF io_worksheet->zif_excel_sheet_properties~show_zeros EQ abap_true. - l_worksheet-showzeros = lc_one. - ELSE. - l_worksheet-showzeros = lc_zero. - ENDIF. - - IF iv_active = abap_true - OR io_worksheet->zif_excel_sheet_properties~selected EQ abap_true. - l_worksheet-tabselected = lc_one. - ELSE. - l_worksheet-tabselected = lc_zero. - ENDIF. - - IF io_worksheet->zif_excel_sheet_properties~zoomscale GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale = 10. - ENDIF. - l_worksheet-zoomscale = io_worksheet->zif_excel_sheet_properties~zoomscale. - - IF io_worksheet->zif_excel_sheet_properties~zoomscale_normal NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_normal GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_normal = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_normal LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_normal = 10. - ENDIF. - l_worksheet-zoomscalenormal = io_worksheet->zif_excel_sheet_properties~zoomscale_normal. - ENDIF. - - IF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview = 10. - ENDIF. - l_worksheet-zoomscalepageview = io_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview. - ENDIF. - - IF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview NE 0. - IF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview GT 400. - io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview = 400. - ELSEIF io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview LT 10. - io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview = 10. - ENDIF. - l_worksheet-zoomscalesheetview = io_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview. - ENDIF. - - l_worksheet-workbookviewid = lc_zero. - - IF io_worksheet->show_gridlines = abap_true. - l_worksheet-showgridlines = lc_one. - ELSE. - l_worksheet-showgridlines = lc_zero. - ENDIF. - - IF io_worksheet->show_rowcolheaders = abap_true. - l_worksheet-showrowcolheaders = lc_one. - ELSE. - l_worksheet-showrowcolheaders = lc_zero. - ENDIF. - -* -* Freeze -* - io_worksheet->get_freeze_cell( - IMPORTING ep_row = lv_freeze_cell_row - ep_column = lv_freeze_cell_column ). - - IF lv_freeze_cell_row IS NOT INITIAL AND lv_freeze_cell_column IS NOT INITIAL. - IF lv_freeze_cell_row > 1. - l_worksheet-ysplit = lv_freeze_cell_row - 1. - ENDIF. - - IF lv_freeze_cell_column > 1. - lv_value = lv_freeze_cell_column - 1. - l_worksheet-xsplit = lv_freeze_cell_row - 1. - ENDIF. - - lv_freeze_cell_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column = lv_freeze_cell_column ). - lv_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_freeze_cell_row ). - CONCATENATE lv_freeze_cell_column_alpha lv_value INTO lv_value. - l_worksheet-topleftcell = lv_value. - - l_worksheet-activepane = 'bottomRight'. - l_worksheet-state = 'frozen'. - ENDIF. - - l_worksheet-activecell = io_worksheet->get_active_cell( ). - -* -* Row and column info -* - column_dimensions[] = io_worksheet->get_column_dimensions( ). - row_dimensions[] = io_worksheet->get_row_dimensions( ). - - IF NOT column_dimensions IS INITIAL. - io_worksheet->calculate_column_widths( ). - column_dimensions[] = io_worksheet->get_column_dimensions( ). - ENDIF. - - default_row_dimension = io_worksheet->get_default_row_dimension( ). - IF default_row_dimension IS BOUND. - IF default_row_dimension->get_row_height( ) >= 0. - l_worksheet-customheight = lc_true. - lv_value = default_row_dimension->get_row_height( ). - ELSE. - lv_value = '12.75'. - ENDIF. - ELSE. - lv_value = '12.75'. - ENDIF. - CONDENSE lv_value. - l_worksheet-defaultrowheight = lv_value. - - default_col_dimension = io_worksheet->get_default_column_dimension( ). - IF default_col_dimension IS BOUND. - IF default_col_dimension->get_width( ) >= 0. - l_worksheet-defaultcolwidth = default_col_dimension->get_width( ). - ENDIF. - ENDIF. - - LOOP AT row_dimensions ASSIGNING <row_dimension>. - IF <row_dimension>-row_dimension->get_outline_level( ) > outline_level_row. - l_worksheet-outlinelevelrow = <row_dimension>-row_dimension->get_outline_level( ). - ENDIF. - ENDLOOP. - - LOOP AT column_dimensions ASSIGNING <column_dimension>. - IF <column_dimension>-column_dimension->get_outline_level( ) > outline_level_col. - l_worksheet-outlinelevelcol = <column_dimension>-column_dimension->get_outline_level( ). - ENDIF. - ENDLOOP. - -* -* Set column information (width, style, ...) -* - LOOP AT column_dimensions ASSIGNING <column_dimension>. - APPEND INITIAL LINE TO l_worksheet-cols ASSIGNING <col>. - <col>-min = <col>-max = <column_dimension>-column_dimension->get_column_index( ). - <col>-width = <column_dimension>-column_dimension->get_width( ). - IF <col>-width < 0. - <col>-width = lc_default_col_width. - ENDIF. - IF <column_dimension>-column_dimension->get_visible( ) = abap_false. - <col>-hidden = lc_true. - ENDIF. - IF <column_dimension>-column_dimension->get_auto_size( ) = abap_true. - <col>-bestfit = lc_true. - ENDIF. - IF default_col_dimension IS BOUND. - IF <column_dimension>-column_dimension->get_width( ) - <> default_col_dimension->get_width( ). - <col>-customwidth = lc_true. - ENDIF. - ELSE. - <col>-customwidth = lc_true. - ENDIF. - IF <column_dimension>-column_dimension->get_collapsed( ) = abap_true. - <col>-collapsed = lc_true. - ENDIF. - <col>-outlinelevel = <column_dimension>-column_dimension->get_outline_level( ). - lv_style_guid = <column_dimension>-column_dimension->get_column_style_guid( ). - <col>-style = me->excel->get_style_index_in_styles( lv_style_guid ) - 1. - ENDLOOP. - -* -* Missing columns -* -* First collect columns that were already handled before. -* The rest has to be inserted now. -* - LOOP AT column_dimensions ASSIGNING <column_dimension>. - lv_column = zcl_excel_common=>convert_column2int( <column_dimension>-column ). - INSERT lv_column INTO TABLE lts_sorted_columns. - ENDLOOP. - -* -* Now find all columns that were missing so far -* - missing_column-first_column = 1. - - LOOP AT lts_sorted_columns INTO lv_column. - IF lv_column > missing_column-first_column. - missing_column-last_column = lv_column - 1. - APPEND missing_column TO t_missing_columns. - ENDIF. - missing_column-first_column = lv_column + 1. - ENDLOOP. - - missing_column-last_column = zcl_excel_common=>c_excel_sheet_max_col. - APPEND missing_column TO t_missing_columns. - -* -* Now apply stylesetting and other defaults -* - LOOP AT t_missing_columns INTO missing_column. - APPEND INITIAL LINE TO l_worksheet-cols ASSIGNING <col>. - <col>-min = missing_column-first_column. - <col>-max = missing_column-last_column. - IF default_col_dimension IS BOUND AND default_col_dimension->get_width( ) >= 0. - <col>-width = default_col_dimension->get_width( ). - ELSE. - <col>-width = lc_default_col_width. - ENDIF. - lv_style_guid = io_worksheet->zif_excel_sheet_properties~get_style( ). - <col>-style = me->excel->get_style_index_in_styles( lv_style_guid ) - 1. - ENDLOOP. - -* -* Build table to hold all table-areas attached to this sheet -* - lo_iterator = io_worksheet->get_tables_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). - ls_table_area-left = zcl_excel_common=>convert_column2int( lo_table->settings-top_left_column ). - ls_table_area-right = lo_table->get_right_column_integer( ). - ls_table_area-top = lo_table->settings-top_left_row. - ls_table_area-bottom = lo_table->get_bottom_row_integer( ). - INSERT ls_table_area INTO TABLE lt_table_areas. - ENDWHILE. - -* -* Build sheet data node -* -* Spans is constant amongst all rows -* - col_count = io_worksheet->get_highest_column( ). - lv_spans = col_count. - CONCATENATE '1:' lv_spans INTO lv_spans. - CONDENSE lv_spans. - - LOOP AT io_worksheet->sheet_content ASSIGNING <sheet_content>. - - IF ls_last_row-cell_row NE <sheet_content>-cell_row. -* -* Fill row information. -* Cell data is filled in by callback GET_CELLS called from transformation -* - lv_index = sy-tabix. - APPEND INITIAL LINE TO l_worksheet-rows ASSIGNING <row>. - <row>-row = <sheet_content>-cell_row. - <row>-index = lv_index. - <row>-spans = lv_spans. - -* -* Row dimension attributes -* - row_dimension = io_worksheet->get_row_dimension( <sheet_content>-cell_row ). - IF row_dimension->get_visible( ) = abap_false. - <row>-hidden = lc_true. - ENDIF. - - IF row_dimension->get_row_height( ) >= 0. - <row>-customheight = lc_one. - <row>-height = row_dimension->get_row_height( ). - ENDIF. - -* -* Collapsed -* - IF row_dimension->get_collapsed( ) = abap_true. - <row>-collapsed = lc_true. - ENDIF. - -* -* Outline level -* - <row>-outlinelevel = row_dimension->get_outline_level( ). - -* -* Style -* - <row>-style = row_dimension->get_xf_index( ). - IF <row>-style <> 0. - <row>-customformat = lc_one. - ENDIF. - ENDIF. - - ls_last_row = <sheet_content>. - ENDLOOP. - -* -* Merged cells -* - lt_range_merge = io_worksheet->get_merge( ). - IF lt_range_merge IS NOT INITIAL. - l_worksheet-mergecells_count = lines( lt_range_merge ). - - LOOP AT lt_range_merge ASSIGNING <range_merge>. - APPEND INITIAL LINE TO l_worksheet-mergecells ASSIGNING <mergecell>. - <mergecell>-ref = <range_merge>. - io_worksheet->delete_merge( ). - ENDLOOP. - ENDIF. - -* -* Hyperlinks -* - l_worksheet-hyperlinks_count = io_worksheet->get_hyperlinks_size( ). - IF l_worksheet-hyperlinks_count > 0. - lo_iterator = io_worksheet->get_hyperlinks_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_link ?= lo_iterator->if_object_collection_iterator~get_next( ). - - APPEND INITIAL LINE TO l_worksheet-hyperlinks ASSIGNING <hyperlink>. - <hyperlink>-ref = lo_link->get_ref( ). - IF lo_link->is_internal( ) = abap_true. - <hyperlink>-location = lo_link->get_url( ). - ELSE. - ADD 1 TO lv_relation_id. - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO lv_value. - <hyperlink>-r_id = lv_value. - ENDIF. - ENDWHILE. - ENDIF. - -* -* Print options -* - IF io_worksheet->print_gridlines = abap_true. - l_worksheet-printoptions-gridlines = lc_true. - ENDIF. - - IF io_worksheet->sheet_setup->horizontal_centered = abap_true. - l_worksheet-printoptions-horizontalcentered = lc_true. - ENDIF. - - IF io_worksheet->sheet_setup->vertical_centered = abap_true. - l_worksheet-printoptions-verticalcentered = lc_true. - ENDIF. - -* -* Page margins -* - l_worksheet-pagemargins-left = io_worksheet->sheet_setup->margin_left. - l_worksheet-pagemargins-right = io_worksheet->sheet_setup->margin_right. - l_worksheet-pagemargins-top = io_worksheet->sheet_setup->margin_top. - l_worksheet-pagemargins-bottom = io_worksheet->sheet_setup->margin_bottom. - l_worksheet-pagemargins-header = io_worksheet->sheet_setup->margin_header. - l_worksheet-pagemargins-footer = io_worksheet->sheet_setup->margin_footer. - -* -* Page setup -* - l_worksheet-pagesetup-cellcomments = io_worksheet->sheet_setup->cell_comments. - l_worksheet-pagesetup-copies = io_worksheet->sheet_setup->copies. - l_worksheet-pagesetup-firstpagenumber = io_worksheet->sheet_setup->first_page_number. - l_worksheet-pagesetup-fittopage = io_worksheet->sheet_setup->fit_to_page. - l_worksheet-pagesetup-fittoheight = io_worksheet->sheet_setup->fit_to_height. - l_worksheet-pagesetup-fittowidth = io_worksheet->sheet_setup->fit_to_width. - l_worksheet-pagesetup-horizontaldpi = io_worksheet->sheet_setup->horizontal_dpi. - l_worksheet-pagesetup-orientation = io_worksheet->sheet_setup->orientation. - l_worksheet-pagesetup-pageorder = io_worksheet->sheet_setup->page_order. - l_worksheet-pagesetup-paperheight = io_worksheet->sheet_setup->paper_height. - l_worksheet-pagesetup-papersize = io_worksheet->sheet_setup->paper_size. - l_worksheet-pagesetup-paperwidth = io_worksheet->sheet_setup->paper_width. - l_worksheet-pagesetup-scale = io_worksheet->sheet_setup->scale. - l_worksheet-pagesetup-usefirstpagenumber = io_worksheet->sheet_setup->use_first_page_num. - l_worksheet-pagesetup-verticaldpi = io_worksheet->sheet_setup->vertical_dpi. - - IF io_worksheet->sheet_setup->black_and_white IS NOT INITIAL. - l_worksheet-pagesetup-blackandwhite = lc_one. - ENDIF. - - IF io_worksheet->sheet_setup->draft IS NOT INITIAL. - l_worksheet-pagesetup-draft = lc_one. - ENDIF. - - IF io_worksheet->sheet_setup->errors IS NOT INITIAL. - l_worksheet-pagesetup-errors = io_worksheet->sheet_setup->errors. - ENDIF. - - IF io_worksheet->sheet_setup->use_printer_defaults IS NOT INITIAL. - l_worksheet-pagesetup-useprinterdefaults = lc_one. - ENDIF. - -* -* Header and footer -* - IF io_worksheet->sheet_setup->diff_oddeven_headerfooter = abap_true. - l_worksheet-headerfooter-differentoddeven = lc_one. - ENDIF. - - io_worksheet->sheet_setup->get_header_footer_string( - IMPORTING - ep_odd_header = l_worksheet-headerfooter-oddheader - ep_odd_footer = l_worksheet-headerfooter-oddfooter - ep_even_header = l_worksheet-headerfooter-evenheader - ep_even_footer = l_worksheet-headerfooter-evenfooter ). - -* -* Drawings -* - lo_drawings = io_worksheet->get_drawings( ). - IF lo_drawings->is_empty( ) = abap_false. - ADD 1 TO lv_relation_id. - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO l_worksheet-drawings. - ENDIF. - -* -* Tables -* - l_worksheet-tables_count = io_worksheet->get_tables_size( ). - IF l_worksheet-tables_count > 0. - lo_iterator = io_worksheet->get_tables_iterator( ). - WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. - lo_table ?= lo_iterator->if_object_collection_iterator~get_next( ). - APPEND INITIAL LINE TO l_worksheet-tables ASSIGNING <table>. - ADD 1 TO lv_relation_id. - lv_value = lv_relation_id. - CONDENSE lv_value. - CONCATENATE 'rId' lv_value INTO <table>-r_id. - ENDWHILE. - ENDIF. - -********************************************************************** -* STEP 2: Create XML - - me->worksheet = io_worksheet. "Neccessary for callback GET_CELL - - CALL TRANSFORMATION zexcel_tr_sheet - SOURCE worksheet = l_worksheet - cells = me->cells - writer = me - OPTIONS xml_header = 'full' - RESULT XML ep_content. - -ENDMETHOD. "CREATE_XL_SHEET - - - - - METHOD get_cells. -* -* Callback method from transformation ZEXCEL_TR_SHEET -* -* The method fills the data cells for each row. -* This saves memory if there are many rows. -* - DATA: - lv_cell_style TYPE zexcel_cell_style. - - FIELD-SYMBOLS: - <cell> TYPE ty_cell, - <content> TYPE zexcel_s_cell_data, - <style> TYPE zexcel_s_styles_mapping. - - CLEAR cells. - - LOOP AT worksheet->sheet_content FROM i_index ASSIGNING <content>. - IF <content>-cell_row <> i_row. -* -* End of row -* - EXIT. - ENDIF. - -* -* Determine style index -* - IF lv_cell_style <> <content>-cell_style. - lv_cell_style = <content>-cell_style. - UNASSIGN <style>. - IF lv_cell_style IS NOT INITIAL. - READ TABLE styles_mapping ASSIGNING <style> WITH KEY guid = lv_cell_style. - ENDIF. - ENDIF. -* -* Add a new cell -* - APPEND INITIAL LINE TO cells ASSIGNING <cell>. - <cell>-name = <content>-cell_coords. - <cell>-formula = <content>-cell_formula. - <cell>-type = <content>-data_type. - IF <cell>-type = 's'. - <cell>-value = me->get_shared_string_index( <content>-cell_value ). - ELSE. - <cell>-value = <content>-cell_value. - ENDIF. - IF <style> IS ASSIGNED. - <cell>-style = <style>-style. - ELSE. - <cell>-style = -1. - ENDIF. - - ENDLOOP. - -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk b/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk deleted file mode 100644 index 623baf7..0000000 --- a/ZA2X/CLAS/ZCL_EXCEL_WRITER_XLSM.slnk +++ /dev/null @@ -1,308 +0,0 @@ - - - *"* use this source file for the definition and implementation of -*"* local helper classes, interface definitions and type -*"* declarations - *"* use this source file for any type of declarations (class -*"* definitions, interfaces or type declarations) you need for -*"* components in the private section - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - METHOD add_further_data_to_zip. - - super->add_further_data_to_zip( io_zip = io_zip ). - -* Add vbaProject.bin to zip - io_zip->add( name = me->c_xl_vbaproject - content = me->excel->zif_excel_book_vba_project~vbaproject ). - -ENDMETHOD. - - - METHOD create_content_types. -** Constant node name - DATA: lc_xml_node_workb_ct TYPE string VALUE 'application/vnd.ms-excel.sheet.macroEnabled.main+xml', - lc_xml_node_default TYPE string VALUE 'Default', - " Node attributes - lc_xml_attr_partname TYPE string VALUE 'PartName', - lc_xml_attr_extension TYPE string VALUE 'Extension', - lc_xml_attr_contenttype TYPE string VALUE 'ContentType', - lc_xml_attr_codename TYPE string VALUE 'codeName', - lc_xml_node_workb_pn TYPE string VALUE '/xl/workbook.xml', - lc_xml_node_bin_ext TYPE string VALUE 'bin', - lc_xml_node_bin_ct TYPE string VALUE 'application/vnd.ms-office.vbaProject'. - - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_document_xml TYPE REF TO cl_xml_document, - lo_element_root TYPE REF TO if_ixml_node, - lo_element TYPE REF TO if_ixml_element, - lo_collection TYPE REF TO if_ixml_node_collection, - lo_iterator TYPE REF TO if_ixml_node_iterator, - lo_node TYPE REF TO if_ixml_node, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_subrc TYPE sysubrc, - lv_contenttype TYPE string, - lv_syindex(2) TYPE c. - -********************************************************************** -* STEP 3: Create standard contentType - ep_content = super->create_content_types( ). - -********************************************************************** -* STEP 2: modify XML adding the extension bin definition - - CREATE OBJECT lo_document_xml. - lv_subrc = lo_document_xml->parse_xstring( ep_content ). - - lo_document ?= lo_document_xml->m_document. - lo_element_root = lo_document->if_ixml_node~get_first_child( ). - - " extension node - lo_element = lo_document->create_simple_element( name = lc_xml_node_default - parent = lo_document ). - lo_element->set_attribute_ns( name = lc_xml_attr_extension - value = lc_xml_node_bin_ext ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_bin_ct ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 3: modify XML changing the contentType of node Override /xl/workbook.xml - - lo_collection = lo_document->get_elements_by_tag_name( 'Override' ). - lo_iterator = lo_collection->create_iterator( ). - lo_element ?= lo_iterator->get_next( ). - WHILE lo_element IS BOUND. - lv_contenttype = lo_element->get_attribute_ns( lc_xml_attr_partname ). - IF lv_contenttype EQ lc_xml_node_workb_pn. - lo_element->remove_attribute_ns( lc_xml_attr_contenttype ). - lo_element->set_attribute_ns( name = lc_xml_attr_contenttype - value = lc_xml_node_workb_ct ). - EXIT. - ENDIF. - lo_element ?= lo_iterator->get_next( ). - ENDWHILE. - -********************************************************************** -* STEP 3: Create xstring stream - CLEAR ep_content. - lo_ixml = cl_ixml=>create( ). - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - METHOD create_xl_relationships. - -** Constant node name - DATA: lc_xml_node_relationships TYPE string VALUE 'Relationships', - lc_xml_node_relationship TYPE string VALUE 'Relationship', - " Node attributes - lc_xml_attr_id TYPE string VALUE 'Id', - lc_xml_attr_type TYPE string VALUE 'Type', - lc_xml_attr_target TYPE string VALUE 'Target', - " Node id - lc_xml_node_ridx_id TYPE string VALUE 'rId#', - " Node type - lc_xml_node_rid_vba_tp TYPE string VALUE 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', - " Node target - lc_xml_node_rid_vba_tg TYPE string VALUE 'vbaProject.bin'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_document_xml TYPE REF TO cl_xml_document, - lo_element_root TYPE REF TO if_ixml_node, - lo_element TYPE REF TO if_ixml_element, - lo_node TYPE REF TO if_ixml_node, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_xml_node_ridx_tg TYPE string, - lv_xml_node_ridx_id TYPE string, - lv_size TYPE i, - lv_subrc TYPE sysubrc, - lv_syindex(2) TYPE c. - -********************************************************************** -* STEP 3: Create standard relationship - ep_content = super->create_xl_relationships( ). - -********************************************************************** -* STEP 2: modify XML adding the vbaProject relation - - CREATE OBJECT lo_document_xml. - lv_subrc = lo_document_xml->parse_xstring( ep_content ). - - lo_document ?= lo_document_xml->m_document. - lo_element_root = lo_document->if_ixml_node~get_first_child( ). - - - lv_size = excel->get_worksheets_size( ). - - " Relationship node - lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship - parent = lo_document ). - ADD 4 TO lv_size. - lv_syindex = lv_size. - SHIFT lv_syindex RIGHT DELETING TRAILING space. - SHIFT lv_syindex LEFT DELETING LEADING space. - lv_xml_node_ridx_id = lc_xml_node_ridx_id. - REPLACE ALL OCCURRENCES OF '#' IN lv_xml_node_ridx_id WITH lv_syindex. - lo_element->set_attribute_ns( name = lc_xml_attr_id - value = lv_xml_node_ridx_id ). - lo_element->set_attribute_ns( name = lc_xml_attr_type - value = lc_xml_node_rid_vba_tp ). - lo_element->set_attribute_ns( name = lc_xml_attr_target - value = lc_xml_node_rid_vba_tg ). - lo_element_root->append_child( new_child = lo_element ). - -********************************************************************** -* STEP 3: Create xstring stream - CLEAR ep_content. - lo_ixml = cl_ixml=>create( ). - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). - -ENDMETHOD. - - - METHOD create_xl_sheet. - -** Constant node name - DATA: lc_xml_attr_codename TYPE string VALUE 'codeName'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_document_xml TYPE REF TO cl_xml_document, - lo_element_root TYPE REF TO if_ixml_node, - lo_element TYPE REF TO if_ixml_element, - lo_collection TYPE REF TO if_ixml_node_collection, - lo_iterator TYPE REF TO if_ixml_node_iterator, - lo_node TYPE REF TO if_ixml_node, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_subrc TYPE sysubrc, - lv_syindex(2) TYPE c. - -********************************************************************** -* STEP 3: Create standard relationship - ep_content = super->create_xl_sheet( io_worksheet = io_worksheet - iv_active = iv_active ). - -********************************************************************** -* STEP 2: modify XML adding the vbaProject relation - - CREATE OBJECT lo_document_xml. - lv_subrc = lo_document_xml->parse_xstring( ep_content ). - - lo_document ?= lo_document_xml->m_document. - lo_element_root = lo_document->if_ixml_node~get_first_child( ). - - lo_collection = lo_document->get_elements_by_tag_name( 'sheetPr' ). - lo_iterator = lo_collection->create_iterator( ). - lo_element ?= lo_iterator->get_next( ). - WHILE lo_element IS BOUND. - lo_element->set_attribute_ns( name = lc_xml_attr_codename - value = io_worksheet->zif_excel_sheet_vba_project~codename_pr ). - lo_element ?= lo_iterator->get_next( ). - ENDWHILE. - -********************************************************************** -* STEP 3: Create xstring stream - CLEAR ep_content. - lo_ixml = cl_ixml=>create( ). - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). -ENDMETHOD. - - - METHOD create_xl_workbook. - -** Constant node name - DATA: lc_xml_attr_codename TYPE string VALUE 'codeName'. - - DATA: lo_ixml TYPE REF TO if_ixml, - lo_document TYPE REF TO if_ixml_document, - lo_document_xml TYPE REF TO cl_xml_document, - lo_element_root TYPE REF TO if_ixml_node, - lo_element TYPE REF TO if_ixml_element, - lo_collection TYPE REF TO if_ixml_node_collection, - lo_iterator TYPE REF TO if_ixml_node_iterator, - lo_node TYPE REF TO if_ixml_node, - lo_encoding TYPE REF TO if_ixml_encoding, - lo_streamfactory TYPE REF TO if_ixml_stream_factory, - lo_ostream TYPE REF TO if_ixml_ostream, - lo_renderer TYPE REF TO if_ixml_renderer. - - DATA: lv_subrc TYPE sysubrc, - lv_syindex(2) TYPE c. - -********************************************************************** -* STEP 3: Create standard relationship - ep_content = super->create_xl_workbook( ). - -********************************************************************** -* STEP 2: modify XML adding the vbaProject relation - - CREATE OBJECT lo_document_xml. - lv_subrc = lo_document_xml->parse_xstring( ep_content ). - - lo_document ?= lo_document_xml->m_document. - lo_element_root = lo_document->if_ixml_node~get_first_child( ). - - lo_collection = lo_document->get_elements_by_tag_name( 'fileVersion' ). - lo_iterator = lo_collection->create_iterator( ). - lo_element ?= lo_iterator->get_next( ). - WHILE lo_element IS BOUND. - lo_element->set_attribute_ns( name = lc_xml_attr_codename - value = me->excel->zif_excel_book_vba_project~codename ). - lo_element ?= lo_iterator->get_next( ). - ENDWHILE. - - lo_collection = lo_document->get_elements_by_tag_name( 'workbookPr' ). - lo_iterator = lo_collection->create_iterator( ). - lo_element ?= lo_iterator->get_next( ). - WHILE lo_element IS BOUND. - lo_element->set_attribute_ns( name = lc_xml_attr_codename - value = me->excel->zif_excel_book_vba_project~codename_pr ). - lo_element ?= lo_iterator->get_next( ). - ENDWHILE. - -********************************************************************** -* STEP 3: Create xstring stream - CLEAR ep_content. - lo_ixml = cl_ixml=>create( ). - lo_streamfactory = lo_ixml->create_stream_factory( ). - lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). - lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). - lo_renderer->render( ). -ENDMETHOD. - - diff --git a/ZA2X/CLAS/ZCX_EXCEL.slnk b/ZA2X/CLAS/ZCX_EXCEL.slnk deleted file mode 100644 index 96bd3f6..0000000 --- a/ZA2X/CLAS/ZCX_EXCEL.slnk +++ /dev/null @@ -1,67 +0,0 @@ - - - *"* local class implementation for public class -*"* use this source file for the implementation part of -*"* local helper classes - *"* use this source file for any type declarations (class -*"* definitions, interfaces or data types) you need for method -*"* implementation or private method's signature - *"* use this source file for any macro definitions you need -*"* in the implementation part of the class - - - - - - - - - - - - - method IF_MESSAGE~GET_LONGTEXT. - - IF me->error IS NOT INITIAL - OR me->syst_at_raise IS NOT INITIAL. -*--------------------------------------------------------------------* -* If message was supplied explicitly use this as longtext as well -*--------------------------------------------------------------------* - result = me->get_text( ). - ELSE. -*--------------------------------------------------------------------* -* otherwise use standard method to derive text -*--------------------------------------------------------------------* - super->if_message~get_longtext( EXPORTING - preserve_newlines = preserve_newlines - RECEIVING - result = result ). - ENDIF. - endmethod. - - - method IF_MESSAGE~GET_TEXT. - - IF me->error IS NOT INITIAL. -*--------------------------------------------------------------------* -* If message was supplied explicitly use this -*--------------------------------------------------------------------* - result = me->error . - ELSEIF me->syst_at_raise IS NOT INITIAL. -*--------------------------------------------------------------------* -* If message was supplied by syst create messagetext now -*--------------------------------------------------------------------* - MESSAGE ID syst_at_raise-msgid TYPE syst_at_raise-msgty NUMBER syst_at_raise-msgno - WITH syst_at_raise-msgv1 syst_at_raise-msgv2 syst_at_raise-msgv3 syst_at_raise-msgv4 - INTO result. - ELSE. -*--------------------------------------------------------------------* -* otherwise use standard method to derive text -*--------------------------------------------------------------------* - CALL METHOD super->if_message~get_text - RECEIVING - result = result. - ENDIF. - endmethod. - - diff --git a/ZA2X/DOMA/ZEXCEL_BOOLE01.slnk b/ZA2X/DOMA/ZEXCEL_BOOLE01.slnk deleted file mode 100644 index 84ec899..0000000 --- a/ZA2X/DOMA/ZEXCEL_BOOLE01.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_CELL_PROTECTION.slnk b/ZA2X/DOMA/ZEXCEL_CELL_PROTECTION.slnk deleted file mode 100644 index ad910a1..0000000 --- a/ZA2X/DOMA/ZEXCEL_CELL_PROTECTION.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk b/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk deleted file mode 100644 index 7a91743..0000000 --- a/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_DEC_8_2.slnk b/ZA2X/DOMA/ZEXCEL_DEC_8_2.slnk deleted file mode 100644 index e2457b1..0000000 --- a/ZA2X/DOMA/ZEXCEL_DEC_8_2.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/DOMA/ZEXCEL_DRAWING_ANCHOR.slnk b/ZA2X/DOMA/ZEXCEL_DRAWING_ANCHOR.slnk deleted file mode 100644 index 3256348..0000000 --- a/ZA2X/DOMA/ZEXCEL_DRAWING_ANCHOR.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_DRAWING_TYPE.slnk b/ZA2X/DOMA/ZEXCEL_DRAWING_TYPE.slnk deleted file mode 100644 index 9503e1e..0000000 --- a/ZA2X/DOMA/ZEXCEL_DRAWING_TYPE.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_FORMAT.slnk b/ZA2X/DOMA/ZEXCEL_FORMAT.slnk deleted file mode 100644 index 5b23647..0000000 --- a/ZA2X/DOMA/ZEXCEL_FORMAT.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk b/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk deleted file mode 100644 index 831a53a..0000000 --- a/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/DOMA/ZEXCEL_SHEET_BOOL.slnk b/ZA2X/DOMA/ZEXCEL_SHEET_BOOL.slnk deleted file mode 100644 index f42564e..0000000 --- a/ZA2X/DOMA/ZEXCEL_SHEET_BOOL.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/DTEL/ZEXCEL_ACTIVE_WORKSHEET.slnk b/ZA2X/DTEL/ZEXCEL_ACTIVE_WORKSHEET.slnk deleted file mode 100644 index bce7111..0000000 --- a/ZA2X/DTEL/ZEXCEL_ACTIVE_WORKSHEET.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_AES_PASSWORD.slnk b/ZA2X/DTEL/ZEXCEL_AES_PASSWORD.slnk deleted file mode 100644 index c66e97f..0000000 --- a/ZA2X/DTEL/ZEXCEL_AES_PASSWORD.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_ALIGNMENT.slnk b/ZA2X/DTEL/ZEXCEL_ALIGNMENT.slnk deleted file mode 100644 index 2b7ec9f..0000000 --- a/ZA2X/DTEL/ZEXCEL_ALIGNMENT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_APPLICATION.slnk b/ZA2X/DTEL/ZEXCEL_APPLICATION.slnk deleted file mode 100644 index 6f6379d..0000000 --- a/ZA2X/DTEL/ZEXCEL_APPLICATION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_APPVERSION.slnk b/ZA2X/DTEL/ZEXCEL_APPVERSION.slnk deleted file mode 100644 index 160dce9..0000000 --- a/ZA2X/DTEL/ZEXCEL_APPVERSION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_BOOK_PROTECTION.slnk b/ZA2X/DTEL/ZEXCEL_BOOK_PROTECTION.slnk deleted file mode 100644 index 8381c44..0000000 --- a/ZA2X/DTEL/ZEXCEL_BOOK_PROTECTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_BORDER.slnk b/ZA2X/DTEL/ZEXCEL_BORDER.slnk deleted file mode 100644 index ef5aeea..0000000 --- a/ZA2X/DTEL/ZEXCEL_BORDER.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_BREAK.slnk b/ZA2X/DTEL/ZEXCEL_BREAK.slnk deleted file mode 100644 index 55278e2..0000000 --- a/ZA2X/DTEL/ZEXCEL_BREAK.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CATEGORY.slnk b/ZA2X/DTEL/ZEXCEL_CATEGORY.slnk deleted file mode 100644 index 8116da8..0000000 --- a/ZA2X/DTEL/ZEXCEL_CATEGORY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_COLUMN.slnk b/ZA2X/DTEL/ZEXCEL_CELL_COLUMN.slnk deleted file mode 100644 index b068929..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_COLUMN.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_COLUMN_ALPHA.slnk b/ZA2X/DTEL/ZEXCEL_CELL_COLUMN_ALPHA.slnk deleted file mode 100644 index 6e0fcf2..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_COLUMN_ALPHA.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_COORDS.slnk b/ZA2X/DTEL/ZEXCEL_CELL_COORDS.slnk deleted file mode 100644 index 1805010..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_COORDS.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_DATA_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_CELL_DATA_TYPE.slnk deleted file mode 100644 index 3b80419..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_DATA_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_FORMULA.slnk b/ZA2X/DTEL/ZEXCEL_CELL_FORMULA.slnk deleted file mode 100644 index cca5778..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_FORMULA.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_PROTECTION.slnk b/ZA2X/DTEL/ZEXCEL_CELL_PROTECTION.slnk deleted file mode 100644 index 803b57d..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_PROTECTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_ROW.slnk b/ZA2X/DTEL/ZEXCEL_CELL_ROW.slnk deleted file mode 100644 index 707dafc..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_ROW.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_STYLE.slnk b/ZA2X/DTEL/ZEXCEL_CELL_STYLE.slnk deleted file mode 100644 index 54e7683..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_STYLE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CELL_VALUE.slnk b/ZA2X/DTEL/ZEXCEL_CELL_VALUE.slnk deleted file mode 100644 index 6c20d90..0000000 --- a/ZA2X/DTEL/ZEXCEL_CELL_VALUE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_COLOR.slnk b/ZA2X/DTEL/ZEXCEL_COLOR.slnk deleted file mode 100644 index 624d45b..0000000 --- a/ZA2X/DTEL/ZEXCEL_COLOR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_COMPANY.slnk b/ZA2X/DTEL/ZEXCEL_COMPANY.slnk deleted file mode 100644 index 9ec378e..0000000 --- a/ZA2X/DTEL/ZEXCEL_COMPANY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITIONAL.slnk b/ZA2X/DTEL/ZEXCEL_CONDITIONAL.slnk deleted file mode 100644 index 71687fb..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITIONAL.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_SHOW_VALUE.slnk b/ZA2X/DTEL/ZEXCEL_CONDITIONAL_SHOW_VALUE.slnk deleted file mode 100644 index 556401e..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_SHOW_VALUE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_CONDITIONAL_TYPE.slnk deleted file mode 100644 index 0e3a899..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_VALUE.slnk b/ZA2X/DTEL/ZEXCEL_CONDITIONAL_VALUE.slnk deleted file mode 100644 index 0d4a54e..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITIONAL_VALUE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITION_OPERATOR.slnk b/ZA2X/DTEL/ZEXCEL_CONDITION_OPERATOR.slnk deleted file mode 100644 index e363816..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITION_OPERATOR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITION_RULE.slnk b/ZA2X/DTEL/ZEXCEL_CONDITION_RULE.slnk deleted file mode 100644 index 30766b7..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITION_RULE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONDITION_RULE_ICONSET.slnk b/ZA2X/DTEL/ZEXCEL_CONDITION_RULE_ICONSET.slnk deleted file mode 100644 index 049393f..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONDITION_RULE_ICONSET.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk deleted file mode 100644 index f652647..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk deleted file mode 100644 index 29ab61a..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk deleted file mode 100644 index efe0099..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk deleted file mode 100644 index ad69df5..0000000 --- a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_CREATOR.slnk b/ZA2X/DTEL/ZEXCEL_CREATOR.slnk deleted file mode 100644 index 480d349..0000000 --- a/ZA2X/DTEL/ZEXCEL_CREATOR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DATA_VAL_ERROR_STYLE.slnk b/ZA2X/DTEL/ZEXCEL_DATA_VAL_ERROR_STYLE.slnk deleted file mode 100644 index 59f06ef..0000000 --- a/ZA2X/DTEL/ZEXCEL_DATA_VAL_ERROR_STYLE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DATA_VAL_OPERATOR.slnk b/ZA2X/DTEL/ZEXCEL_DATA_VAL_OPERATOR.slnk deleted file mode 100644 index e595bb1..0000000 --- a/ZA2X/DTEL/ZEXCEL_DATA_VAL_OPERATOR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DATA_VAL_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_DATA_VAL_TYPE.slnk deleted file mode 100644 index dbcc4c0..0000000 --- a/ZA2X/DTEL/ZEXCEL_DATA_VAL_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DEC_8_2.slnk b/ZA2X/DTEL/ZEXCEL_DEC_8_2.slnk deleted file mode 100644 index ec0001f..0000000 --- a/ZA2X/DTEL/ZEXCEL_DEC_8_2.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DESCRIPTION.slnk b/ZA2X/DTEL/ZEXCEL_DESCRIPTION.slnk deleted file mode 100644 index e17e3f1..0000000 --- a/ZA2X/DTEL/ZEXCEL_DESCRIPTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DIAGONAL.slnk b/ZA2X/DTEL/ZEXCEL_DIAGONAL.slnk deleted file mode 100644 index b22f162..0000000 --- a/ZA2X/DTEL/ZEXCEL_DIAGONAL.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DOCSECURITY.slnk b/ZA2X/DTEL/ZEXCEL_DOCSECURITY.slnk deleted file mode 100644 index 84075a3..0000000 --- a/ZA2X/DTEL/ZEXCEL_DOCSECURITY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DRAWING_ANCHOR.slnk b/ZA2X/DTEL/ZEXCEL_DRAWING_ANCHOR.slnk deleted file mode 100644 index ebc1c24..0000000 --- a/ZA2X/DTEL/ZEXCEL_DRAWING_ANCHOR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_DRAWING_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_DRAWING_TYPE.slnk deleted file mode 100644 index e5bcdae..0000000 --- a/ZA2X/DTEL/ZEXCEL_DRAWING_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_EXPORT_DIR.slnk b/ZA2X/DTEL/ZEXCEL_EXPORT_DIR.slnk deleted file mode 100644 index 590f0a2..0000000 --- a/ZA2X/DTEL/ZEXCEL_EXPORT_DIR.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_FILL.slnk b/ZA2X/DTEL/ZEXCEL_FILL.slnk deleted file mode 100644 index 55eadf2..0000000 --- a/ZA2X/DTEL/ZEXCEL_FILL.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_FILL_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_FILL_TYPE.slnk deleted file mode 100644 index fc1e23f..0000000 --- a/ZA2X/DTEL/ZEXCEL_FILL_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_FONT.slnk b/ZA2X/DTEL/ZEXCEL_FONT.slnk deleted file mode 100644 index f8dea36..0000000 --- a/ZA2X/DTEL/ZEXCEL_FONT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_FORMAT.slnk b/ZA2X/DTEL/ZEXCEL_FORMAT.slnk deleted file mode 100644 index bbae5a3..0000000 --- a/ZA2X/DTEL/ZEXCEL_FORMAT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_GRAPH_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_GRAPH_TYPE.slnk deleted file mode 100644 index 217c8b9..0000000 --- a/ZA2X/DTEL/ZEXCEL_GRAPH_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_HIDDEN.slnk b/ZA2X/DTEL/ZEXCEL_HIDDEN.slnk deleted file mode 100644 index 8ac650f..0000000 --- a/ZA2X/DTEL/ZEXCEL_HIDDEN.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_INDENT.slnk b/ZA2X/DTEL/ZEXCEL_INDENT.slnk deleted file mode 100644 index ae47deb..0000000 --- a/ZA2X/DTEL/ZEXCEL_INDENT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_KEYWORDS.slnk b/ZA2X/DTEL/ZEXCEL_KEYWORDS.slnk deleted file mode 100644 index ce515c9..0000000 --- a/ZA2X/DTEL/ZEXCEL_KEYWORDS.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_LOCKED.slnk b/ZA2X/DTEL/ZEXCEL_LOCKED.slnk deleted file mode 100644 index bfd8b85..0000000 --- a/ZA2X/DTEL/ZEXCEL_LOCKED.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_NUMBER_FORMAT.slnk b/ZA2X/DTEL/ZEXCEL_NUMBER_FORMAT.slnk deleted file mode 100644 index 3fd4707..0000000 --- a/ZA2X/DTEL/ZEXCEL_NUMBER_FORMAT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_PANE_STATE.slnk b/ZA2X/DTEL/ZEXCEL_PANE_STATE.slnk deleted file mode 100644 index 9ed77e7..0000000 --- a/ZA2X/DTEL/ZEXCEL_PANE_STATE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_PANE_TYPE.slnk b/ZA2X/DTEL/ZEXCEL_PANE_TYPE.slnk deleted file mode 100644 index 48a7fc8..0000000 --- a/ZA2X/DTEL/ZEXCEL_PANE_TYPE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_PRINT_GRIDLINES.slnk b/ZA2X/DTEL/ZEXCEL_PRINT_GRIDLINES.slnk deleted file mode 100644 index d7cfd87..0000000 --- a/ZA2X/DTEL/ZEXCEL_PRINT_GRIDLINES.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_PROTECTION.slnk b/ZA2X/DTEL/ZEXCEL_PROTECTION.slnk deleted file mode 100644 index eb1e15d..0000000 --- a/ZA2X/DTEL/ZEXCEL_PROTECTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk b/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk deleted file mode 100644 index d0a4e88..0000000 --- a/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_RANGE_GUID.slnk b/ZA2X/DTEL/ZEXCEL_RANGE_GUID.slnk deleted file mode 100644 index 33adc7d..0000000 --- a/ZA2X/DTEL/ZEXCEL_RANGE_GUID.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_RANGE_NAME.slnk b/ZA2X/DTEL/ZEXCEL_RANGE_NAME.slnk deleted file mode 100644 index 5145a39..0000000 --- a/ZA2X/DTEL/ZEXCEL_RANGE_NAME.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_RANGE_VALUE.slnk b/ZA2X/DTEL/ZEXCEL_RANGE_VALUE.slnk deleted file mode 100644 index 6a7c871..0000000 --- a/ZA2X/DTEL/ZEXCEL_RANGE_VALUE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_REVISIONSPASSWORD.slnk b/ZA2X/DTEL/ZEXCEL_REVISIONSPASSWORD.slnk deleted file mode 100644 index 7c83f25..0000000 --- a/ZA2X/DTEL/ZEXCEL_REVISIONSPASSWORD.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_ROTATION.slnk b/ZA2X/DTEL/ZEXCEL_ROTATION.slnk deleted file mode 100644 index 360ef06..0000000 --- a/ZA2X/DTEL/ZEXCEL_ROTATION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SCALECROP.slnk b/ZA2X/DTEL/ZEXCEL_SCALECROP.slnk deleted file mode 100644 index 5afcd45..0000000 --- a/ZA2X/DTEL/ZEXCEL_SCALECROP.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_HIDDEN.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_HIDDEN.slnk deleted file mode 100644 index 6240783..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_HIDDEN.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_ORIENATATION.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_ORIENATATION.slnk deleted file mode 100644 index 2aa0027..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_ORIENATATION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_PAPER_SIZE.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_PAPER_SIZE.slnk deleted file mode 100644 index 77fb60f..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_PAPER_SIZE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION.slnk deleted file mode 100644 index 1302f6b..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION_BOOL.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION_BOOL.slnk deleted file mode 100644 index 65d77d0..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_PROTECTION_BOOL.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_SELECTED.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_SELECTED.slnk deleted file mode 100644 index 6877cce..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_SELECTED.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_SHOWZEROS.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_SHOWZEROS.slnk deleted file mode 100644 index b8fe668..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_SHOWZEROS.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_STATE.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_STATE.slnk deleted file mode 100644 index 37dce2e..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_STATE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_SUMMARY.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_SUMMARY.slnk deleted file mode 100644 index 3b941d9..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_SUMMARY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_TITLE.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_TITLE.slnk deleted file mode 100644 index 9bbc2d6..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_TITLE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHEET_ZOOMSCALE.slnk b/ZA2X/DTEL/ZEXCEL_SHEET_ZOOMSCALE.slnk deleted file mode 100644 index 26ca58f..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHEET_ZOOMSCALE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHOW_GRIDLINES.slnk b/ZA2X/DTEL/ZEXCEL_SHOW_GRIDLINES.slnk deleted file mode 100644 index 420d344..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHOW_GRIDLINES.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SHOW_ROWCOLHEADER.slnk b/ZA2X/DTEL/ZEXCEL_SHOW_ROWCOLHEADER.slnk deleted file mode 100644 index 33f19b6..0000000 --- a/ZA2X/DTEL/ZEXCEL_SHOW_ROWCOLHEADER.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_ARGB.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_ARGB.slnk deleted file mode 100644 index 88b51f5..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_ARGB.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_COMPONENT.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_COMPONENT.slnk deleted file mode 100644 index 39c919f..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_COMPONENT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_INDEXED.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_INDEXED.slnk deleted file mode 100644 index e9e71a8..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_INDEXED.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_THEME.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_THEME.slnk deleted file mode 100644 index bba3c92..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_THEME.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_TINT.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_TINT.slnk deleted file mode 100644 index 1c9cbb9..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_COLOR_TINT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_FAMILY.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FONT_FAMILY.slnk deleted file mode 100644 index e328ef3..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_FAMILY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_NAME.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FONT_NAME.slnk deleted file mode 100644 index 5d5800e..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_NAME.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SCHEME.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SCHEME.slnk deleted file mode 100644 index 961eb58..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SCHEME.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SIZE.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SIZE.slnk deleted file mode 100644 index 0b70a8b..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_SIZE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_UNDERLINE.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FONT_UNDERLINE.slnk deleted file mode 100644 index 8092e1b..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FONT_UNDERLINE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_FORMULA.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_FORMULA.slnk deleted file mode 100644 index 88326de..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_FORMULA.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_STYLE_PRIORITY.slnk b/ZA2X/DTEL/ZEXCEL_STYLE_PRIORITY.slnk deleted file mode 100644 index f40ce4c..0000000 --- a/ZA2X/DTEL/ZEXCEL_STYLE_PRIORITY.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_SUBJECT.slnk b/ZA2X/DTEL/ZEXCEL_SUBJECT.slnk deleted file mode 100644 index c673acc..0000000 --- a/ZA2X/DTEL/ZEXCEL_SUBJECT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_TABLE_STYLE.slnk b/ZA2X/DTEL/ZEXCEL_TABLE_STYLE.slnk deleted file mode 100644 index 6b3fd1e..0000000 --- a/ZA2X/DTEL/ZEXCEL_TABLE_STYLE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_TABLE_TOTALS_FUNCTION.slnk b/ZA2X/DTEL/ZEXCEL_TABLE_TOTALS_FUNCTION.slnk deleted file mode 100644 index ca69cc4..0000000 --- a/ZA2X/DTEL/ZEXCEL_TABLE_TOTALS_FUNCTION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_TEXT_ROTATION.slnk b/ZA2X/DTEL/ZEXCEL_TEXT_ROTATION.slnk deleted file mode 100644 index d4c8c09..0000000 --- a/ZA2X/DTEL/ZEXCEL_TEXT_ROTATION.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_TITLE.slnk b/ZA2X/DTEL/ZEXCEL_TITLE.slnk deleted file mode 100644 index b13188f..0000000 --- a/ZA2X/DTEL/ZEXCEL_TITLE.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_VALIDATION_FORMULA1.slnk b/ZA2X/DTEL/ZEXCEL_VALIDATION_FORMULA1.slnk deleted file mode 100644 index 33743c1..0000000 --- a/ZA2X/DTEL/ZEXCEL_VALIDATION_FORMULA1.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_WORKBOOKPASSWORD.slnk b/ZA2X/DTEL/ZEXCEL_WORKBOOKPASSWORD.slnk deleted file mode 100644 index ecdaaef..0000000 --- a/ZA2X/DTEL/ZEXCEL_WORKBOOKPASSWORD.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/DTEL/ZEXCEL_WORKSHEETS_NAME.slnk b/ZA2X/DTEL/ZEXCEL_WORKSHEETS_NAME.slnk deleted file mode 100644 index 0c7a9da..0000000 --- a/ZA2X/DTEL/ZEXCEL_WORKSHEETS_NAME.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_BOOK_PROPERTIES.slnk b/ZA2X/INTF/ZIF_EXCEL_BOOK_PROPERTIES.slnk deleted file mode 100644 index 7e7c306..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_BOOK_PROPERTIES.slnk +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_BOOK_PROTECTION.slnk b/ZA2X/INTF/ZIF_EXCEL_BOOK_PROTECTION.slnk deleted file mode 100644 index fccc571..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_BOOK_PROTECTION.slnk +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_BOOK_VBA_PROJECT.slnk b/ZA2X/INTF/ZIF_EXCEL_BOOK_VBA_PROJECT.slnk deleted file mode 100644 index cb83101..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_BOOK_VBA_PROJECT.slnk +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk b/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk deleted file mode 100644 index ed5d710..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_CUSTOMUI_ELEMENT.slnk b/ZA2X/INTF/ZIF_EXCEL_CUSTOMUI_ELEMENT.slnk deleted file mode 100644 index 45f3c29..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_CUSTOMUI_ELEMENT.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_READER.slnk b/ZA2X/INTF/ZIF_EXCEL_READER.slnk deleted file mode 100644 index faf8c26..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_READER.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_SHEET_PRINTSETTINGS.slnk b/ZA2X/INTF/ZIF_EXCEL_SHEET_PRINTSETTINGS.slnk deleted file mode 100644 index 550258f..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_SHEET_PRINTSETTINGS.slnk +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROPERTIES.slnk b/ZA2X/INTF/ZIF_EXCEL_SHEET_PROPERTIES.slnk deleted file mode 100644 index 4b62b09..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROPERTIES.slnk +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk b/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk deleted file mode 100644 index d43e226..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_SHEET_VBA_PROJECT.slnk b/ZA2X/INTF/ZIF_EXCEL_SHEET_VBA_PROJECT.slnk deleted file mode 100644 index bbdcb26..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_SHEET_VBA_PROJECT.slnk +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ZA2X/INTF/ZIF_EXCEL_WRITER.slnk b/ZA2X/INTF/ZIF_EXCEL_WRITER.slnk deleted file mode 100644 index 91b2064..0000000 --- a/ZA2X/INTF/ZIF_EXCEL_WRITER.slnk +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ZA2X/MSAG/ZABAP2XLSX.slnk b/ZA2X/MSAG/ZABAP2XLSX.slnk deleted file mode 100644 index 4d06230..0000000 --- a/ZA2X/MSAG/ZABAP2XLSX.slnk +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/PROG/ZABAP2XLSX_DEMO_SHOW.slnk b/ZA2X/PROG/ZABAP2XLSX_DEMO_SHOW.slnk deleted file mode 100644 index dceb904..0000000 --- a/ZA2X/PROG/ZABAP2XLSX_DEMO_SHOW.slnk +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <fc> 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 <fc>. - <fc>-fieldname = 'PROGNAME'. - <fc>-tabname = 'REPOSRC'. - - APPEND INITIAL LINE TO it_fieldcat ASSIGNING <fc>. - <fc>-fieldname = 'SORT'. - <fc>-ref_field = 'PROGNAME'. - <fc>-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:<report> 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 <report>. - -* Check if already switched to new outputoptions - READ REPORT <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 - <report>-sort = <report>-progname. - REPLACE REGEX '(ZDEMO_EXCEL)(\d\d)\s*$' IN <report>-sort WITH '$1\0$2'. " REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN <report>-sort WITH '$1$2'.REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN <report>-sort WITH '$1$2'.REPLACE - - REPLACE REGEX '(ZDEMO_EXCEL)(\d)\s*$' IN <report>-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/ZA2X/PROG/ZANGRY_BIRDS.slnk b/ZA2X/PROG/ZANGRY_BIRDS.slnk deleted file mode 100644 index 61d5216..0000000 --- a/ZA2X/PROG/ZANGRY_BIRDS.slnk +++ /dev/null @@ -1,766 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_CALENDAR.slnk b/ZA2X/PROG/ZDEMO_CALENDAR.slnk deleted file mode 100644 index 36cd541..0000000 --- a/ZA2X/PROG/ZDEMO_CALENDAR.slnk +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <month_name> 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: <img_descr> 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 <month_name>. - CONCATENATE <month_name>-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 <img_descr>. - READ TABLE image_descriptions WITH KEY month_nr = month_nr ASSIGNING <img_descr>. - IF <img_descr> IS ASSIGNED. - value = <img_descr>-descr. - IF p_portr = abap_true. - row = lv_from_row - 3. - ELSE. - row = lv_from_row - 2. - ENDIF. - IF NOT <img_descr>-url IS INITIAL. - hyperlink = zcl_excel_hyperlink=>create_external_link( <img_descr>-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 <img_descr>-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/ZA2X/PROG/ZDEMO_CALENDAR_CLASSES.slnk b/ZA2X/PROG/ZDEMO_CALENDAR_CLASSES.slnk deleted file mode 100644 index 8fadefd..0000000 --- a/ZA2X/PROG/ZDEMO_CALENDAR_CLASSES.slnk +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <day_name> 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 <day_name>. - row = i_from_row. - col_int = from_col_int + <day_name>-wotnr. - col = zcl_excel_common=>convert_column2alpha( col_int ). - value = <day_name>-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: <day_name> 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 <day_name> - WITH KEY wotnr = weekday. - value = <day_name>-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/ZA2X/PROG/ZDEMO_EXCEL.slnk b/ZA2X/PROG/ZDEMO_EXCEL.slnk deleted file mode 100644 index d3eff8d..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL.slnk +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL1.slnk b/ZA2X/PROG/ZDEMO_EXCEL1.slnk deleted file mode 100644 index 54aa21f..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL1.slnk +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL10.slnk b/ZA2X/PROG/ZDEMO_EXCEL10.slnk deleted file mode 100644 index 45477e8..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL10.slnk +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <fs_field_catalog> 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 <fs_field_catalog>. - CASE <fs_field_catalog>-fieldname. - WHEN 'CARRID'. - <fs_field_catalog>-position = 3. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_count. - WHEN 'CONNID'. - <fs_field_catalog>-position = 4. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-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'. - <fs_field_catalog>-position = 2. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'PRICE'. - <fs_field_catalog>-position = 1. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_sum. - <fs_field_catalog>-cond_style = lo_style_conditional2. - WHEN OTHERS. - <fs_field_catalog>-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/ZA2X/PROG/ZDEMO_EXCEL11.slnk b/ZA2X/PROG/ZDEMO_EXCEL11.slnk deleted file mode 100644 index 3d8f7d4..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL11.slnk +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <searchresult_line> 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: <relationship> LIKE LINE OF relationships. -DATA: relationship_centraldata TYPE bapibus1006002_central. -DATA: relationship_addresses TYPE TABLE OF bapibus1006002_addresses. -FIELD-SYMBOLS: <relationship_address> LIKE LINE OF relationship_addresses. - -DATA: lt_download TYPE TABLE OF zexcel_s_org_rel. -FIELD-SYMBOLS: <download> 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 <searchresult_line>. - " Read Details of Organization - CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL' - EXPORTING - businesspartner = <searchresult_line>-partner - IMPORTING - centraldataorganization = centraldataorganization. - " Read Standard Address of Organization - CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL' - EXPORTING - businesspartner = <searchresult_line>-partner - IMPORTING - addressdata = addressdata. - - " Add Organization to Download - APPEND INITIAL LINE TO lt_download ASSIGNING <download>. - " Fill Organization Partner Numbers - CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' - EXPORTING - businesspartner = <searchresult_line>-partner - IMPORTING - businesspartnerout = <download>-org_number - businesspartnerguidout = <download>-org_guid. - - MOVE-CORRESPONDING centraldataorganization TO <download>. - MOVE-CORRESPONDING addressdata TO <download>. - CLEAR: addressdata. - - " Read all Relationships - CLEAR: relationships. - CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET' - EXPORTING - businesspartner = <searchresult_line>-partner - TABLES - relationships = relationships. - DELETE relationships WHERE relationshipcategory <> 'BUR001'. - LOOP AT relationships ASSIGNING <relationship>. - " Read details of Contact person - CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL' - EXPORTING - businesspartner = <relationship>-partner2 - IMPORTING - centraldata = centraldata - centraldataperson = centraldataperson. - " Read details of the Relationship - CALL FUNCTION 'BAPI_BUPR_CONTP_GETDETAIL' - EXPORTING - businesspartner = <relationship>-partner1 - contactperson = <relationship>-partner2 - IMPORTING - centraldata = relationship_centraldata. - " Read relationship address - CLEAR: relationship_addresses. - - CALL FUNCTION 'BAPI_BUPR_CONTP_ADDRESSES_GET' - EXPORTING - businesspartner = <relationship>-partner1 - contactperson = <relationship>-partner2 - TABLES - addresses = relationship_addresses. - - READ TABLE relationship_addresses - ASSIGNING <relationship_address> - WITH KEY standardaddress = 'X'. - - IF <relationship_address> IS ASSIGNED. - " Read Relationship Address - CLEAR addressdata. - CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL' - EXPORTING - businesspartner = <searchresult_line>-partner - addressguid = <relationship_address>-addressguid - IMPORTING - addressdata = addressdata. - - APPEND INITIAL LINE TO lt_download ASSIGNING <download>. - CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' - EXPORTING - businesspartner = <relationship>-partner1 - IMPORTING - businesspartnerout = <download>-org_number - businesspartnerguidout = <download>-org_guid. - - CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS' - EXPORTING - businesspartner = <relationship>-partner2 - IMPORTING - businesspartnerout = <download>-contpers_number - businesspartnerguidout = <download>-contpers_guid. - - MOVE-CORRESPONDING centraldataorganization TO <download>. - MOVE-CORRESPONDING addressdata TO <download>. - MOVE-CORRESPONDING centraldataperson TO <download>. - MOVE-CORRESPONDING relationship_centraldata TO <download>. - - WRITE: / <relationship>-partner1, <relationship>-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: <fs_field_catalog> 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 <fs_field_catalog>. - CASE <fs_field_catalog>-fieldname. - WHEN 'ORG_NUMBER'. - <fs_field_catalog>-position = 1. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'CONTPERS_NUMBER'. - <fs_field_catalog>-position = 2. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'NAME1'. - <fs_field_catalog>-position = 3. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'NAME2'. - <fs_field_catalog>-position = 4. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'STREET'. - <fs_field_catalog>-position = 5. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'HOUSE_NO'. - <fs_field_catalog>-position = 6. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'POSTL_COD1'. - <fs_field_catalog>-position = 7. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'CITY'. - <fs_field_catalog>-position = 8. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'COUNTRYISO'. - <fs_field_catalog>-position = 9. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'FIRSTNAME'. - <fs_field_catalog>-position = 10. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'LASTNAME'. - <fs_field_catalog>-position = 11. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'FUNCTIONNAME'. - <fs_field_catalog>-position = 12. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'DEPARTMENTNAME'. - <fs_field_catalog>-position = 13. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'TEL1_NUMBR'. - <fs_field_catalog>-position = 14. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'TEL1_EXT'. - <fs_field_catalog>-position = 15. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'FAX_NUMBER'. - <fs_field_catalog>-position = 16. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'FAX_EXTENS'. - <fs_field_catalog>-position = 17. - <fs_field_catalog>-dynpfld = abap_true. - WHEN 'E_MAIL'. - <fs_field_catalog>-position = 18. - <fs_field_catalog>-dynpfld = abap_true. - WHEN OTHERS. - <fs_field_catalog>-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 <download>. - row = sy-tabix + 2. - IF NOT <download>-org_number IS INITIAL - AND <download>-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 <download>-org_number IS INITIAL - AND NOT <download>-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 <fs_field_catalog> - WHERE position <> '' AND dynpfld = abap_true. - column = <fs_field_catalog>-position. - column_alpha = zcl_excel_common=>convert_column2alpha( column ). - value = <fs_field_catalog>-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/ZA2X/PROG/ZDEMO_EXCEL12.slnk b/ZA2X/PROG/ZDEMO_EXCEL12.slnk deleted file mode 100644 index 6b174ee..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL12.slnk +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL13.slnk b/ZA2X/PROG/ZDEMO_EXCEL13.slnk deleted file mode 100644 index 9337531..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL13.slnk +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL14.slnk b/ZA2X/PROG/ZDEMO_EXCEL14.slnk deleted file mode 100644 index e7fa87e..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL14.slnk +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL15.slnk b/ZA2X/PROG/ZDEMO_EXCEL15.slnk deleted file mode 100644 index 80eb157..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL15.slnk +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <wa_files> 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 <wa_files>. - <wa_files>-input = '01_HelloWorld.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-input = '02_Styles.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-input = '03_iTab.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-input = '04_Sheets.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-input = '08_Range.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-input = '13_MergedCells.xlsx'. - APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>. - <wa_files>-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 <wa_files>. - CONCATENATE p_path lv_file_separator <wa_files>-input INTO input_file_path. - CONCATENATE p_path lv_file_separator '15_' <wa_files>-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/ZA2X/PROG/ZDEMO_EXCEL16.slnk b/ZA2X/PROG/ZDEMO_EXCEL16.slnk deleted file mode 100644 index bc76e7c..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL16.slnk +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL17.slnk b/ZA2X/PROG/ZDEMO_EXCEL17.slnk deleted file mode 100644 index 0f81f12..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL17.slnk +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL18.slnk b/ZA2X/PROG/ZDEMO_EXCEL18.slnk deleted file mode 100644 index 15f4fbe..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL18.slnk +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL19.slnk b/ZA2X/PROG/ZDEMO_EXCEL19.slnk deleted file mode 100644 index 7980b8c..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL19.slnk +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL2.slnk b/ZA2X/PROG/ZDEMO_EXCEL2.slnk deleted file mode 100644 index 537bad7..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL2.slnk +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL20.slnk b/ZA2X/PROG/ZDEMO_EXCEL20.slnk deleted file mode 100644 index 44515bd..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL20.slnk +++ /dev/null @@ -1,965 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *--------------------------------------------------------------------* -* REPORT ZDEMO_EXCEL20 -* Demo for method zcl_excel_worksheet-bind_alv: -* export data from ALV (CL_GUI_ALV_GRID) object to excel -*--------------------------------------------------------------------* -REPORT zdemo_excel20. - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_handle_events DEFINITION. - PUBLIC SECTION. - METHODS: - on_user_command FOR EVENT added_function OF cl_salv_events - IMPORTING e_salv_function. -ENDCLASS. "lcl_handle_events DEFINITION - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events IMPLEMENTATION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_handle_events IMPLEMENTATION. - METHOD on_user_command. - PERFORM user_command." using e_salv_function text-i08. - ENDMETHOD. "on_user_command -ENDCLASS. "lcl_handle_events IMPLEMENTATION - -*--------------------------------------------------------------------* -* DATA DECLARATION -*--------------------------------------------------------------------* - -DATA: lo_excel TYPE REF TO zcl_excel, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_alv TYPE REF TO cl_gui_alv_grid, - lo_salv TYPE REF TO cl_salv_table, - gr_events TYPE REF TO lcl_handle_events, - lr_events TYPE REF TO cl_salv_events_table, - gt_sbook TYPE TABLE OF sbook, - gt_listheader TYPE slis_t_listheader, - wa_listheader LIKE LINE OF gt_listheader. - -DATA: l_path TYPE string, " local dir - lv_workdir TYPE string, - lv_file_separator TYPE c. - -CONSTANTS: - lv_default_file_name TYPE string VALUE '20_BindAlv.xlsx'. -*--------------------------------------------------------------------* -*START-OF-SELECTION -*--------------------------------------------------------------------* - -START-OF-SELECTION. - -* get data -* ------------------------------------------ - - SELECT * - INTO TABLE gt_sbook[] - FROM sbook "#EC CI_NOWHERE - UP TO 10 ROWS. - -* Display ALV -* ------------------------------------------ - - TRY. - cl_salv_table=>factory( - EXPORTING - list_display = abap_false - IMPORTING - r_salv_table = lo_salv - CHANGING - t_table = gt_sbook[] ). - CATCH cx_salv_msg . - ENDTRY. - - TRY. - lo_salv->set_screen_status( - EXPORTING - report = sy-repid - pfstatus = 'ALV_STATUS' - set_functions = lo_salv->c_functions_all ). - CATCH cx_salv_msg . - ENDTRY. - - lr_events = lo_salv->get_event( ). - CREATE OBJECT gr_events. - SET HANDLER gr_events->on_user_command FOR lr_events. - - lo_salv->display( ). - - -*&---------------------------------------------------------------------* -*& Form USER_COMMAND -*&---------------------------------------------------------------------* -* ALV user command -*--------------------------------------------------------------------* -FORM user_command . - IF sy-ucomm = 'EXCEL'. - -* get save file path - cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ). - cl_gui_cfw=>flush( ). - cl_gui_frontend_services=>directory_browse( - EXPORTING initial_folder = l_path - CHANGING selected_folder = l_path ). - - IF l_path IS INITIAL. - cl_gui_frontend_services=>get_sapgui_workdir( - CHANGING sapworkdir = lv_workdir ). - l_path = lv_workdir. - ENDIF. - - cl_gui_frontend_services=>get_file_separator( - CHANGING file_separator = lv_file_separator ). - - CONCATENATE l_path lv_file_separator lv_default_file_name - INTO l_path. - -* export file to save file path - - PERFORM export_to_excel. - - ENDIF. -ENDFORM. " USER_COMMAND - -*--------------------------------------------------------------------* -* FORM EXPORT_TO_EXCEL -*--------------------------------------------------------------------* -* This subroutine is principal demo session -*--------------------------------------------------------------------* -FORM export_to_excel. - -* create zcl_excel_worksheet object - - CREATE OBJECT lo_excel. - lo_worksheet = lo_excel->get_active_worksheet( ). - -* get ALV object from screen - - CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' - IMPORTING - e_grid = lo_alv. - -* build list header - - wa_listheader-typ = 'H'. - wa_listheader-info = sy-title. - APPEND wa_listheader TO gt_listheader. - - wa_listheader-typ = 'S'. - wa_listheader-info = 'Created by: ABAP2XLSX Group'. - APPEND wa_listheader TO gt_listheader. - - wa_listheader-typ = 'A'. - wa_listheader-info = - 'Project hosting at https://cw.sdn.sap.com/cw/groups/abap2xlsx'. - APPEND wa_listheader TO gt_listheader. - -* write to excel using method Bin_ALV - - lo_worksheet->bind_alv_ole2( - EXPORTING -* I_DOCUMENT_URL = SPACE " excel template -* I_XLS = 'X' " create in xls format? - i_save_path = l_path - io_alv = lo_alv - it_listheader = gt_listheader - i_top = 2 - i_left = 1 -* I_COLUMNS_HEADER = 'X' -* I_COLUMNS_AUTOFIT = 'X' -* I_FORMAT_COL_HEADER = -* I_FORMAT_SUBTOTAL = -* I_FORMAT_TOTAL = - EXCEPTIONS - miss_guide = 1 - ex_transfer_kkblo_error = 2 - fatal_error = 3 - inv_data_range = 4 - dim_mismatch_vkey = 5 - dim_mismatch_sema = 6 - error_in_sema = 7 - OTHERS = 8 - ). - IF sy-subrc <> 0. - MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno - WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. - ENDIF. - -ENDFORM. "EXPORT_TO_EXCEL - diff --git a/ZA2X/PROG/ZDEMO_EXCEL21.slnk b/ZA2X/PROG/ZDEMO_EXCEL21.slnk deleted file mode 100644 index 36be3d7..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL21.slnk +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <color_style> 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 <color_style>. - 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_style>-color = color. - <color_style>-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 <color_style>. - 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_style>-color - ip_style = <color_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. - <color_style>-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 = <color_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/ZA2X/PROG/ZDEMO_EXCEL22.slnk b/ZA2X/PROG/ZDEMO_EXCEL22.slnk deleted file mode 100644 index 9dc62cb..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL22.slnk +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <fs_field_catalog> 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 <fs_field_catalog>. - CASE <fs_field_catalog>-fieldname. - WHEN 'CARRID'. - <fs_field_catalog>-position = 3. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-style = lo_style->get_guid( ). - WHEN 'CONNID'. - <fs_field_catalog>-position = 1. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-style = lo_style->get_guid( ). - WHEN 'FLDATE'. - <fs_field_catalog>-position = 2. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-style = lo_style_date->get_guid( ). - WHEN 'PRICE'. - <fs_field_catalog>-position = 4. - <fs_field_catalog>-dynpfld = abap_true. - <fs_field_catalog>-style = lo_style_editable->get_guid( ). - <fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_sum. - WHEN OTHERS. - <fs_field_catalog>-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/ZA2X/PROG/ZDEMO_EXCEL23.slnk b/ZA2X/PROG/ZDEMO_EXCEL23.slnk deleted file mode 100644 index 1f9492c..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL23.slnk +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL24.slnk b/ZA2X/PROG/ZDEMO_EXCEL24.slnk deleted file mode 100644 index 0cf6427..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL24.slnk +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL25.slnk b/ZA2X/PROG/ZDEMO_EXCEL25.slnk deleted file mode 100644 index 89f1372..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL25.slnk +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL26.slnk b/ZA2X/PROG/ZDEMO_EXCEL26.slnk deleted file mode 100644 index f2b6342..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL26.slnk +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *--------------------------------------------------------------------* -* REPORT ZDEMO_EXCEL26 -* Demo for method zcl_excel_worksheet-bind_object: -* export data from ALV (CL_GUI_ALV_GRID) object or cl_salv_table object -* to Excel. -*--------------------------------------------------------------------* -report zdemo_excel26. - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -class lcl_handle_events definition. - public section. - methods: - on_user_command for event added_function of cl_salv_events - importing e_salv_function. -endclass. "lcl_handle_events DEFINITION - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events IMPLEMENTATION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -class lcl_handle_events implementation. - method on_user_command. - perform user_command." using e_salv_function text-i08. - endmethod. "on_user_command -endclass. "lcl_handle_events IMPLEMENTATION - -*--------------------------------------------------------------------* -* DATA DECLARATION -*--------------------------------------------------------------------* - -data: lo_excel type ref to zcl_excel, - lo_worksheet type ref to zcl_excel_worksheet, - lo_salv type ref to cl_salv_table, - gr_events type ref to lcl_handle_events, - lr_events type ref to cl_salv_events_table, - gt_sbook type table of sbook. - -data: l_path type string, " local dir - lv_workdir type string, - lv_file_separator type c. - -constants: - lv_default_file_name type string value '26_Bind_ALV.xlsx'. -*--------------------------------------------------------------------* -*START-OF-SELECTION -*--------------------------------------------------------------------* - -start-of-selection. - -* get data -* ------------------------------------------ - - select * - into table gt_sbook[] - from sbook "#EC CI_NOWHERE - up to 10 rows. - -* Display ALV -* ------------------------------------------ - - try. - cl_salv_table=>factory( - exporting - list_display = abap_false - importing - r_salv_table = lo_salv - changing - t_table = gt_sbook[] ). - catch cx_salv_msg . - endtry. - - try. - lo_salv->set_screen_status( - exporting - report = sy-repid - pfstatus = 'ALV_STATUS' - set_functions = lo_salv->c_functions_all ). - catch cx_salv_msg . - endtry. - - lr_events = lo_salv->get_event( ). - create object gr_events. - set handler gr_events->on_user_command for lr_events. - - lo_salv->display( ). - - -*&---------------------------------------------------------------------* -*& Form USER_COMMAND -*&---------------------------------------------------------------------* -* ALV user command -*--------------------------------------------------------------------* -form user_command . - if sy-ucomm = 'EXCEL'. - -* get save file path - cl_gui_frontend_services=>get_sapgui_workdir( changing sapworkdir = l_path ). - cl_gui_cfw=>flush( ). - cl_gui_frontend_services=>directory_browse( - exporting initial_folder = l_path - changing selected_folder = l_path ). - - if l_path is initial. - cl_gui_frontend_services=>get_sapgui_workdir( - changing sapworkdir = lv_workdir ). - l_path = lv_workdir. - endif. - - cl_gui_frontend_services=>get_file_separator( - changing file_separator = lv_file_separator ). - - concatenate l_path lv_file_separator lv_default_file_name - into l_path. - -* export file to save file path - perform export_to_excel. - - endif. -endform. " USER_COMMAND - -*--------------------------------------------------------------------* -* FORM EXPORT_TO_EXCEL -*--------------------------------------------------------------------* -* This subroutine is principal demo session -*--------------------------------------------------------------------* -form export_to_excel. - data: lo_converter type ref to zcl_excel_converter. -* create zcl_excel_worksheet object - - create object lo_excel. - lo_worksheet = lo_excel->get_active_worksheet( ). - lo_worksheet->set_title( ip_title = 'Sheet1' ). - -* write to excel using method Bin_object - try. - lo_worksheet->bind_alv( - io_alv = lo_salv - it_table = gt_sbook - i_top = 2 - i_left = 1 - ). - catch zcx_excel . - endtry. - - perform write_file. - -endform. "EXPORT_TO_EXCEL -*&---------------------------------------------------------------------* -*& Form WRITE_FILE -*&---------------------------------------------------------------------* -* text -*----------------------------------------------------------------------* -* --> p1 text -* <-- p2 text -*----------------------------------------------------------------------* -form write_file . - data: lt_file type solix_tab, - l_bytecount type i, - l_file type xstring. - - data: lo_excel_writer type ref to zif_excel_writer. - - data: ls_seoclass type seoclass. - - create object lo_excel_writer type zcl_excel_writer_2007. - l_file = lo_excel_writer->write_file( lo_excel ). - - select single * into ls_seoclass - from seoclass - where clsname = 'CL_BCS_CONVERT'. - - if sy-subrc = 0. - call method (ls_seoclass-clsname)=>xstring_to_solix - exporting - iv_xstring = l_file - receiving - et_solix = lt_file. - - l_bytecount = xstrlen( l_file ). - else. - " Convert to binary - call function 'SCMS_XSTRING_TO_BINARY' - exporting - buffer = l_file - importing - output_length = l_bytecount - tables - binary_tab = lt_file. - endif. - - cl_gui_frontend_services=>gui_download( exporting bin_filesize = l_bytecount - filename = l_path - filetype = 'BIN' - changing data_tab = lt_file ). - -endform. " WRITE_FILE - diff --git a/ZA2X/PROG/ZDEMO_EXCEL27.slnk b/ZA2X/PROG/ZDEMO_EXCEL27.slnk deleted file mode 100644 index 4253b87..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL27.slnk +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL28.slnk b/ZA2X/PROG/ZDEMO_EXCEL28.slnk deleted file mode 100644 index 1bf4781..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL28.slnk +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL29.slnk b/ZA2X/PROG/ZDEMO_EXCEL29.slnk deleted file mode 100644 index 040aeb0..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL29.slnk +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL3.slnk b/ZA2X/PROG/ZDEMO_EXCEL3.slnk deleted file mode 100644 index 4efcf97..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL3.slnk +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <carr> 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 <carr>. - lo_worksheet->set_cell( ip_row = row ip_column = 'A' ip_value = <carr>-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/ZA2X/PROG/ZDEMO_EXCEL30.slnk b/ZA2X/PROG/ZDEMO_EXCEL30.slnk deleted file mode 100644 index 373df9e..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL30.slnk +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL31.slnk b/ZA2X/PROG/ZDEMO_EXCEL31.slnk deleted file mode 100644 index 3852397..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL31.slnk +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL32.slnk b/ZA2X/PROG/ZDEMO_EXCEL32.slnk deleted file mode 100644 index e5ba213..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL32.slnk +++ /dev/null @@ -1,573 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *--------------------------------------------------------------------* -* REPORT ZDEMO_EXCEL32 -* Demo for export options from ALV GRID: -* export data from ALV (CL_GUI_ALV_GRID) object or cl_salv_table object -* to Excel. -*--------------------------------------------------------------------* -REPORT zdemo_excel32. - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events DEFINITION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_handle_events DEFINITION. - PUBLIC SECTION. - METHODS: - on_user_command FOR EVENT added_function OF cl_salv_events - IMPORTING e_salv_function. -ENDCLASS. "lcl_handle_events DEFINITION - -*----------------------------------------------------------------------* -* CLASS lcl_handle_events IMPLEMENTATION -*----------------------------------------------------------------------* -* -*----------------------------------------------------------------------* -CLASS lcl_handle_events IMPLEMENTATION. - METHOD on_user_command. - PERFORM user_command." using e_salv_function text-i08. - ENDMETHOD. "on_user_command -ENDCLASS. "lcl_handle_events IMPLEMENTATION - -*--------------------------------------------------------------------* -* DATA DECLARATION -*--------------------------------------------------------------------* - -DATA: lo_excel TYPE REF TO zcl_excel, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - lo_salv TYPE REF TO cl_salv_table, - gr_events TYPE REF TO lcl_handle_events, - lr_events TYPE REF TO cl_salv_events_table, - gt_sbook TYPE TABLE OF sbook. - -DATA: l_path TYPE string, " local dir - lv_workdir TYPE string, - lv_file_separator TYPE c. - -CONSTANTS: - lv_default_file_name TYPE string VALUE '32_Export_ALV.xlsx', - lv_default_file_name2 TYPE string VALUE '32_Export_Convert.xlsx'. -*--------------------------------------------------------------------* -*START-OF-SELECTION -*--------------------------------------------------------------------* - -START-OF-SELECTION. - -* get data -* ------------------------------------------ - - SELECT * - INTO TABLE gt_sbook[] - FROM sbook "#EC CI_NOWHERE - UP TO 100 ROWS. - -* Display ALV -* ------------------------------------------ - - TRY. - cl_salv_table=>factory( - EXPORTING - list_display = abap_false - IMPORTING - r_salv_table = lo_salv - CHANGING - t_table = gt_sbook[] ). - CATCH cx_salv_msg . - ENDTRY. - - TRY. - lo_salv->set_screen_status( - EXPORTING - report = sy-repid - pfstatus = 'ALV_STATUS' - set_functions = lo_salv->c_functions_all ). - CATCH cx_salv_msg . - ENDTRY. - - lr_events = lo_salv->get_event( ). - CREATE OBJECT gr_events. - SET HANDLER gr_events->on_user_command FOR lr_events. - - lo_salv->display( ). - - -*&---------------------------------------------------------------------* -*& Form USER_COMMAND -*&---------------------------------------------------------------------* -* ALV user command -*--------------------------------------------------------------------* -FORM user_command . - -* get save file path - cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ). - cl_gui_cfw=>flush( ). - cl_gui_frontend_services=>directory_browse( - EXPORTING initial_folder = l_path - CHANGING selected_folder = l_path ). - - IF l_path IS INITIAL. - cl_gui_frontend_services=>get_sapgui_workdir( - CHANGING sapworkdir = lv_workdir ). - l_path = lv_workdir. - ENDIF. - - cl_gui_frontend_services=>get_file_separator( - CHANGING file_separator = lv_file_separator ). - - - -* export file to save file path - CASE sy-ucomm. - WHEN 'EXCELBIND'. - CONCATENATE l_path lv_file_separator lv_default_file_name - INTO l_path. - PERFORM export_to_excel_bind. - - WHEN 'EXCELCONV'. - - CONCATENATE l_path lv_file_separator lv_default_file_name2 - INTO l_path. - PERFORM export_to_excel_conv. - - ENDCASE. -ENDFORM. " USER_COMMAND -*--------------------------------------------------------------------* -* FORM EXPORT_TO_EXCEL_CONV -*--------------------------------------------------------------------* -* This subroutine is principal demo session -*--------------------------------------------------------------------* -FORM export_to_excel_conv. - DATA: lo_converter TYPE REF TO zcl_excel_converter. - - CREATE OBJECT lo_converter. -*TRY. - lo_converter->convert( - EXPORTING - io_alv = lo_salv - it_table = gt_sbook - i_row_int = 2 - i_column_int = 2 -* i_table = -* i_style_table = -* io_worksheet = -* CHANGING -* co_excel = - ). -* CATCH zcx_excel . -*ENDTRY. - lo_converter->write_file( i_path = l_path ). - -ENDFORM. "EXPORT_TO_EXCEL_CONV - -*--------------------------------------------------------------------* -* FORM EXPORT_TO_EXCEL_BIND -*--------------------------------------------------------------------* -* This subroutine is principal demo session -*--------------------------------------------------------------------* -FORM export_to_excel_bind. -* create zcl_excel_worksheet object - CREATE OBJECT lo_excel. - lo_worksheet = lo_excel->get_active_worksheet( ). - lo_worksheet->set_title( ip_title = 'Sheet1' ). - -* write to excel using method Bin_object -*try. - lo_worksheet->bind_alv( - io_alv = lo_salv - it_table = gt_sbook - i_top = 2 - i_left = 1 - ). -* catch zcx_excel . -*endtry. - - - PERFORM write_file. - -ENDFORM. "EXPORT_TO_EXCEL_BIND -*&---------------------------------------------------------------------* -*& Form WRITE_FILE -*&---------------------------------------------------------------------* -* text -*----------------------------------------------------------------------* -* --> p1 text -* <-- p2 text -*----------------------------------------------------------------------* -FORM write_file . - DATA: lt_file TYPE solix_tab, - l_bytecount TYPE i, - l_file TYPE xstring. - - DATA: lo_excel_writer TYPE REF TO zif_excel_writer. - - DATA: ls_seoclass TYPE seoclass. - - CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. - l_file = lo_excel_writer->write_file( lo_excel ). - - SELECT SINGLE * INTO ls_seoclass - FROM seoclass - WHERE clsname = 'CL_BCS_CONVERT'. - - IF sy-subrc = 0. - CALL METHOD (ls_seoclass-clsname)=>xstring_to_solix - EXPORTING - iv_xstring = l_file - RECEIVING - et_solix = lt_file. - - l_bytecount = XSTRLEN( l_file ). - ELSE. - " Convert to binary - CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' - EXPORTING - buffer = l_file - IMPORTING - output_length = l_bytecount - TABLES - binary_tab = lt_file. - ENDIF. - - cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = l_bytecount - filename = l_path - filetype = 'BIN' - CHANGING data_tab = lt_file ). - -ENDFORM. " WRITE_FILE - diff --git a/ZA2X/PROG/ZDEMO_EXCEL33.slnk b/ZA2X/PROG/ZDEMO_EXCEL33.slnk deleted file mode 100644 index 62ab0af..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL33.slnk +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL34.slnk b/ZA2X/PROG/ZDEMO_EXCEL34.slnk deleted file mode 100644 index cea21e9..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL34.slnk +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL35.slnk b/ZA2X/PROG/ZDEMO_EXCEL35.slnk deleted file mode 100644 index cd2ff2c..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL35.slnk +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL36.slnk b/ZA2X/PROG/ZDEMO_EXCEL36.slnk deleted file mode 100644 index 0e1c8da..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL36.slnk +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL37.slnk b/ZA2X/PROG/ZDEMO_EXCEL37.slnk deleted file mode 100644 index 9b24ed1..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL37.slnk +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 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: <ls_implementing_class> LIKE LINE OF lt_implementing_classes, - <ls_value> LIKE LINE OF lt_values. - -*--------------------------------------------------------------------* -* Possible READER-Classes -*--------------------------------------------------------------------* - lv_id = 'LB_READ'. - APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>. - <ls_value>-key = 'Autodetect'(001). - <ls_value>-text = 'Autodetect'(001). - - - PERFORM get_implementing_classds USING 'ZIF_EXCEL_READER' - CHANGING lt_implementing_classes. - CLEAR lt_values. - LOOP AT lt_implementing_classes ASSIGNING <ls_implementing_class>. - - APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>. - <ls_value>-key = <ls_implementing_class>-clsname. - <ls_value>-text = <ls_implementing_class>-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 <ls_value>. - <ls_value>-key = 'Autodetect'(001). - <ls_value>-text = 'Autodetect'(001). - - - PERFORM get_implementing_classds USING 'ZIF_EXCEL_WRITER' - CHANGING lt_implementing_classes. - CLEAR lt_values. - LOOP AT lt_implementing_classes ASSIGNING <ls_implementing_class>. - - APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>. - <ls_value>-key = <ls_implementing_class>-clsname. - <ls_value>-text = <ls_implementing_class>-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: <ls_implementing_class> 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 <ls_implementing_class>. - TRY. - lo_oo_class ?= cl_oo_class=>get_instance( <ls_implementing_class>-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/ZA2X/PROG/ZDEMO_EXCEL38.slnk b/ZA2X/PROG/ZDEMO_EXCEL38.slnk deleted file mode 100644 index bca7ee7..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL38.slnk +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - 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: <icon> LIKE LINE OF lt_icon, - <mimedata> 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 <icon>. - - lv_row = sy-tabix. -*--------------------------------------------------------------------* -* Set name of icon -*--------------------------------------------------------------------* - lo_worksheet->set_cell( ip_row = lv_row - ip_column = 'A' - ip_value = <icon>-name ). -*--------------------------------------------------------------------* -* Check whether the mime-repository holds some icondata for us -*--------------------------------------------------------------------* - -* Get key - SELECT SINGLE objid - INTO <icon>-objid - FROM wwwdata - WHERE text = <icon>-name. - CHECK sy-subrc = 0. " :o( - lo_worksheet->set_cell( ip_row = lv_row - ip_column = 'B' - ip_value = <icon>-objid ). - -* Load mimedata - CLEAR lt_mimedata. - CLEAR ls_wwwdatatab. - ls_wwwdatatab-relid = 'MI' . - ls_wwwdatatab-objid = <icon>-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 <mimedata>. - CONCATENATE lv_xstring <mimedata>-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/ZA2X/PROG/ZDEMO_EXCEL39.slnk b/ZA2X/PROG/ZDEMO_EXCEL39.slnk deleted file mode 100644 index f9e42e3..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL39.slnk +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL4.slnk b/ZA2X/PROG/ZDEMO_EXCEL4.slnk deleted file mode 100644 index 5444b12..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL4.slnk +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL40.slnk b/ZA2X/PROG/ZDEMO_EXCEL40.slnk deleted file mode 100644 index 788ec5e..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL40.slnk +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - 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/ZA2X/PROG/ZDEMO_EXCEL41.slnk b/ZA2X/PROG/ZDEMO_EXCEL41.slnk deleted file mode 100644 index 3e2dd94..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL41.slnk +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - - - - - - - - - - - PROCESS BEFORE OUTPUT. - MODULE STATUS_9000. - -PROCESS AFTER INPUT. - MODULE USER_COMMAND_9000 AT EXIT-COMMAND. - MODULE USER_COMMAND_9000. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REPORT. - -CONSTANTS: gc_save_file_name TYPE string VALUE 'ABAP2XLSX Inheritance.xlsx'. - -*--------------------------------------------------------------------* -* Demo inheritance ZCL_EXCEL1 -* Variation of ZCL_EXCEL that creates numerous sheets -*--------------------------------------------------------------------* -CLASS lcl_my_zcl_excel1 DEFINITION INHERITING FROM zcl_excel. - PUBLIC SECTION. - METHODS: constructor IMPORTING iv_sheetcount TYPE i DEFAULT 5. -ENDCLASS. - -CLASS lcl_my_zcl_excel1 IMPLEMENTATION. - METHOD constructor. - DATA: lv_sheets_to_create TYPE i. - super->constructor( ). - lv_sheets_to_create = iv_sheetcount - 1. " one gets created by standard class - DO lv_sheets_to_create TIMES. - TRY. - me->add_new_worksheet( ). - CATCH zcx_excel. - ENDTRY. - ENDDO. - me->set_active_sheet_index( 1 ). - - ENDMETHOD. -ENDCLASS. - -*--------------------------------------------------------------------* -* Demo inheritance ZCL_EXCEL_WORKSHEET -* Variation of ZCL_EXCEL_WORKSHEET ( and ZCL_EXCEL that calls the new type of worksheet ) -* that sets a fixed title -*--------------------------------------------------------------------* -CLASS lcl_my_zcl_excel2 DEFINITION INHERITING FROM zcl_excel. - PUBLIC SECTION. - METHODS: constructor. -ENDCLASS. - -CLASS lcl_my_zcl_excel_worksheet DEFINITION INHERITING FROM zcl_excel_worksheet. - PUBLIC SECTION. - METHODS: constructor IMPORTING ip_excel TYPE REF TO zcl_excel - ip_title TYPE zexcel_sheet_title OPTIONAL " Will be ignored - keep parameter for demonstration purpose - RAISING zcx_excel. -ENDCLASS. - -CLASS lcl_my_zcl_excel2 IMPLEMENTATION. - METHOD constructor. - - DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet. - - super->constructor( ). - -* To use own worksheet we have to remove the standard worksheet - lo_worksheet = get_active_worksheet( ). - me->worksheets->remove( lo_worksheet ). -* and replace it with own version - CREATE OBJECT lo_worksheet TYPE lcl_my_zcl_excel_worksheet - EXPORTING - ip_excel = me - ip_title = 'This title will be ignored'. - me->worksheets->add( lo_worksheet ). - - ENDMETHOD. -ENDCLASS. - -CLASS lcl_my_zcl_excel_worksheet IMPLEMENTATION. - METHOD constructor. - super->constructor( ip_excel = ip_excel - ip_title = 'Inherited Worksheet' ). - - ENDMETHOD. -ENDCLASS. - -DATA: go_excel1 TYPE REF TO lcl_my_zcl_excel1. -DATA: go_excel2 TYPE REF TO lcl_my_zcl_excel2. - - -SELECTION-SCREEN BEGIN OF BLOCK bli WITH FRAME TITLE text-bli. -PARAMETERS: rbi_1 RADIOBUTTON GROUP rbi DEFAULT 'X' , " Simple inheritance - rbi_2 RADIOBUTTON GROUP rbi. -SELECTION-SCREEN END OF BLOCK bli. - -INCLUDE zdemo_excel_outputopt_incl. - -END-OF-SELECTION. - - CASE 'X'. - - WHEN rbi_1. " Simple inheritance of zcl_excel, object created directly - CREATE OBJECT go_excel1 - EXPORTING - iv_sheetcount = 5. - lcl_output=>output( go_excel1 ). - - WHEN rbi_2. " Inheritance of zcl_excel_worksheet, inheritance of zcl_excel needed to allow this - CREATE OBJECT go_excel2. - lcl_output=>output( go_excel2 ). - - - ENDCASE. - diff --git a/ZA2X/PROG/ZDEMO_EXCEL42.slnk b/ZA2X/PROG/ZDEMO_EXCEL42.slnk deleted file mode 100644 index c85c5fe..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL42.slnk +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL5.slnk b/ZA2X/PROG/ZDEMO_EXCEL5.slnk deleted file mode 100644 index 01124e3..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL5.slnk +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL6.slnk b/ZA2X/PROG/ZDEMO_EXCEL6.slnk deleted file mode 100644 index 987bd22..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL6.slnk +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL7.slnk b/ZA2X/PROG/ZDEMO_EXCEL7.slnk deleted file mode 100644 index 0b2eea4..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL7.slnk +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL8.slnk b/ZA2X/PROG/ZDEMO_EXCEL8.slnk deleted file mode 100644 index 5aa1e84..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL8.slnk +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL9.slnk b/ZA2X/PROG/ZDEMO_EXCEL9.slnk deleted file mode 100644 index ba4fe75..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL9.slnk +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_EXCEL_OUTPUTOPT_INCL.slnk b/ZA2X/PROG/ZDEMO_EXCEL_OUTPUTOPT_INCL.slnk deleted file mode 100644 index b7d62e8..0000000 --- a/ZA2X/PROG/ZDEMO_EXCEL_OUTPUTOPT_INCL.slnk +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - *&---------------------------------------------------------------------* -*& 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: <rawdata> 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 <rawdata>. - - AT LAST. - CHECK bytes_remain >= 0. - TRANSFER <rawdata> TO p_backfn LENGTH bytes_remain. - EXIT. - ENDAT. - - TRANSFER <rawdata> 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/ZA2X/PROG/ZDEMO_TECHED1.slnk b/ZA2X/PROG/ZDEMO_TECHED1.slnk deleted file mode 100644 index ab07833..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED1.slnk +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED10.slnk b/ZA2X/PROG/ZDEMO_TECHED10.slnk deleted file mode 100644 index 35f19c1..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED10.slnk +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED2.slnk b/ZA2X/PROG/ZDEMO_TECHED2.slnk deleted file mode 100644 index 6969aee..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED2.slnk +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED3.slnk b/ZA2X/PROG/ZDEMO_TECHED3.slnk deleted file mode 100644 index c6ff109..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED3.slnk +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED4.slnk b/ZA2X/PROG/ZDEMO_TECHED4.slnk deleted file mode 100644 index 49768ea..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED4.slnk +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED5.slnk b/ZA2X/PROG/ZDEMO_TECHED5.slnk deleted file mode 100644 index ac503b1..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED5.slnk +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED6.slnk b/ZA2X/PROG/ZDEMO_TECHED6.slnk deleted file mode 100644 index 0188e29..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED6.slnk +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED7.slnk b/ZA2X/PROG/ZDEMO_TECHED7.slnk deleted file mode 100644 index e56756c..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED7.slnk +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED8.slnk b/ZA2X/PROG/ZDEMO_TECHED8.slnk deleted file mode 100644 index 9ca54f2..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED8.slnk +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/PROG/ZDEMO_TECHED9.slnk b/ZA2X/PROG/ZDEMO_TECHED9.slnk deleted file mode 100644 index 815fe74..0000000 --- a/ZA2X/PROG/ZDEMO_TECHED9.slnk +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - *&---------------------------------------------------------------------* -*& 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/ZA2X/TABL/ZEXCEL_CONDITIONAL_ABOVE_AVG.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_ABOVE_AVG.slnk deleted file mode 100644 index 56acabe..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_ABOVE_AVG.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_CELLIS.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_CELLIS.slnk deleted file mode 100644 index 94cf2da..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_CELLIS.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_COLORSCALE.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_COLORSCALE.slnk deleted file mode 100644 index 7735815..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_COLORSCALE.slnk +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_DATABAR.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_DATABAR.slnk deleted file mode 100644 index ec5cf20..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_DATABAR.slnk +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_EXPRESSION.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_EXPRESSION.slnk deleted file mode 100644 index 7cbe629..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_EXPRESSION.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_ICONSET.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_ICONSET.slnk deleted file mode 100644 index eaf9a22..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_ICONSET.slnk +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_CONDITIONAL_TOP10.slnk b/ZA2X/TABL/ZEXCEL_CONDITIONAL_TOP10.slnk deleted file mode 100644 index 942e7c7..0000000 --- a/ZA2X/TABL/ZEXCEL_CONDITIONAL_TOP10.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_DRAWING_LOCATION.slnk b/ZA2X/TABL/ZEXCEL_DRAWING_LOCATION.slnk deleted file mode 100644 index 00f2b36..0000000 --- a/ZA2X/TABL/ZEXCEL_DRAWING_LOCATION.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_DRAWING_POSITION.slnk b/ZA2X/TABL/ZEXCEL_DRAWING_POSITION.slnk deleted file mode 100644 index cb4fe41..0000000 --- a/ZA2X/TABL/ZEXCEL_DRAWING_POSITION.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_DRAWING_SIZE.slnk b/ZA2X/TABL/ZEXCEL_DRAWING_SIZE.slnk deleted file mode 100644 index 4ce5b61..0000000 --- a/ZA2X/TABL/ZEXCEL_DRAWING_SIZE.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_PANE.slnk b/ZA2X/TABL/ZEXCEL_PANE.slnk deleted file mode 100644 index 6f9b542..0000000 --- a/ZA2X/TABL/ZEXCEL_PANE.slnk +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_AREA.slnk b/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_AREA.slnk deleted file mode 100644 index 71a6bdc..0000000 --- a/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_AREA.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_VALUES.slnk b/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_VALUES.slnk deleted file mode 100644 index 401332e..0000000 --- a/ZA2X/TABL/ZEXCEL_S_AUTOFILTER_VALUES.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CELLXFS.slnk b/ZA2X/TABL/ZEXCEL_S_CELLXFS.slnk deleted file mode 100644 index 187052a..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CELLXFS.slnk +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CELL_DATA.slnk b/ZA2X/TABL/ZEXCEL_S_CELL_DATA.slnk deleted file mode 100644 index 8f30bb1..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CELL_DATA.slnk +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_COL.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_COL.slnk deleted file mode 100644 index 11a16b2..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONVERTER_COL.slnk +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_FCAT.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_FCAT.slnk deleted file mode 100644 index fbc07ca..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONVERTER_FCAT.slnk +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_FIL.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_FIL.slnk deleted file mode 100644 index 3a69df9..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONVERTER_FIL.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_LAYO.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_LAYO.slnk deleted file mode 100644 index d3719a0..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONVERTER_LAYO.slnk +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk deleted file mode 100644 index f9c9076..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONV_FIELDCATALOG.slnk b/ZA2X/TABL/ZEXCEL_S_CONV_FIELDCATALOG.slnk deleted file mode 100644 index 17e884e..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONV_FIELDCATALOG.slnk +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CONV_SETTINGS.slnk b/ZA2X/TABL/ZEXCEL_S_CONV_SETTINGS.slnk deleted file mode 100644 index a9e14b4..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CONV_SETTINGS.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk deleted file mode 100644 index 5110251..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_ALIGNMENT.slnk +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk deleted file mode 100644 index 42d82e7..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDER.slnk +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk deleted file mode 100644 index b90d45b..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_BORDERS.slnk +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk deleted file mode 100644 index ad54c77..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COLOR.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk deleted file mode 100644 index b8e7830..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_COMPLETE.slnk +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk deleted file mode 100644 index 14a7dee..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FILL.slnk +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk deleted file mode 100644 index c66c107..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_FONT.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_GRADTYPE.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_GRADTYPE.slnk deleted file mode 100644 index 48fa721..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_GRADTYPE.slnk +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk deleted file mode 100644 index 07ec5a1..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_NUMBER_FORMAT.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk deleted file mode 100644 index 2480495..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLEX_PROTECTION.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk deleted file mode 100644 index 1c82487..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_ALIGNMENT.slnk +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk deleted file mode 100644 index 145152a..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDER.slnk +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk deleted file mode 100644 index 9081415..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_BORDERS.slnk +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk deleted file mode 100644 index dd167da..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_COMPLETE.slnk +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk deleted file mode 100644 index b50b642..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FILL.slnk +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk deleted file mode 100644 index 0dc722d..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_FONT.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk deleted file mode 100644 index 8919092..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_NUMBER_FORMAT.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk b/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk deleted file mode 100644 index e486cdc..0000000 --- a/ZA2X/TABL/ZEXCEL_S_CSTYLE_PROTECTION.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_FIELDCATALOG.slnk b/ZA2X/TABL/ZEXCEL_S_FIELDCATALOG.slnk deleted file mode 100644 index 9119d9c..0000000 --- a/ZA2X/TABL/ZEXCEL_S_FIELDCATALOG.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_GRADIENT_TYPE.slnk b/ZA2X/TABL/ZEXCEL_S_GRADIENT_TYPE.slnk deleted file mode 100644 index cd13359..0000000 --- a/ZA2X/TABL/ZEXCEL_S_GRADIENT_TYPE.slnk +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_ORG_REL.slnk b/ZA2X/TABL/ZEXCEL_S_ORG_REL.slnk deleted file mode 100644 index b0bacbf..0000000 --- a/ZA2X/TABL/ZEXCEL_S_ORG_REL.slnk +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_SHARED_STRING.slnk b/ZA2X/TABL/ZEXCEL_S_SHARED_STRING.slnk deleted file mode 100644 index 6de4df5..0000000 --- a/ZA2X/TABL/ZEXCEL_S_SHARED_STRING.slnk +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_SHEET_STYLE.slnk b/ZA2X/TABL/ZEXCEL_S_SHEET_STYLE.slnk deleted file mode 100644 index 8c7b104..0000000 --- a/ZA2X/TABL/ZEXCEL_S_SHEET_STYLE.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk b/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk deleted file mode 100644 index e99b737..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLEMAPPING.slnk +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLES_COND_MAPPING.slnk b/ZA2X/TABL/ZEXCEL_S_STYLES_COND_MAPPING.slnk deleted file mode 100644 index bf47f48..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLES_COND_MAPPING.slnk +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLES_MAPPING.slnk b/ZA2X/TABL/ZEXCEL_S_STYLES_MAPPING.slnk deleted file mode 100644 index 31e7820..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLES_MAPPING.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_ALIGNMENT.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_ALIGNMENT.slnk deleted file mode 100644 index abe4cb0..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_ALIGNMENT.slnk +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_BORDER.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_BORDER.slnk deleted file mode 100644 index eb1fcbc..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_BORDER.slnk +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_COLOR.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_COLOR.slnk deleted file mode 100644 index 806196c..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_COLOR.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_FILL.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_FILL.slnk deleted file mode 100644 index 2dbef07..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_FILL.slnk +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_FONT.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_FONT.slnk deleted file mode 100644 index 3761355..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_FONT.slnk +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_NUMFMT.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_NUMFMT.slnk deleted file mode 100644 index 83c4518..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_NUMFMT.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_STYLE_PROTECTION.slnk b/ZA2X/TABL/ZEXCEL_S_STYLE_PROTECTION.slnk deleted file mode 100644 index 0c442e1..0000000 --- a/ZA2X/TABL/ZEXCEL_S_STYLE_PROTECTION.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_TABCOLOR.slnk b/ZA2X/TABL/ZEXCEL_S_TABCOLOR.slnk deleted file mode 100644 index d947c31..0000000 --- a/ZA2X/TABL/ZEXCEL_S_TABCOLOR.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_TABLE_SETTINGS.slnk b/ZA2X/TABL/ZEXCEL_S_TABLE_SETTINGS.slnk deleted file mode 100644 index 6360c54..0000000 --- a/ZA2X/TABL/ZEXCEL_S_TABLE_SETTINGS.slnk +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_COLUMNDIME.slnk b/ZA2X/TABL/ZEXCEL_S_WORKSHEET_COLUMNDIME.slnk deleted file mode 100644 index 31e3797..0000000 --- a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_COLUMNDIME.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_HEAD_FOOT.slnk b/ZA2X/TABL/ZEXCEL_S_WORKSHEET_HEAD_FOOT.slnk deleted file mode 100644 index 0b56cc4..0000000 --- a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_HEAD_FOOT.slnk +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_ROWDIMENSIO.slnk b/ZA2X/TABL/ZEXCEL_S_WORKSHEET_ROWDIMENSIO.slnk deleted file mode 100644 index 10a9649..0000000 --- a/ZA2X/TABL/ZEXCEL_S_WORKSHEET_ROWDIMENSIO.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_AUTOFILTER_VALUES.slnk b/ZA2X/TTYP/ZEXCEL_T_AUTOFILTER_VALUES.slnk deleted file mode 100644 index 1939dca..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_AUTOFILTER_VALUES.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CELLXFS.slnk b/ZA2X/TTYP/ZEXCEL_T_CELLXFS.slnk deleted file mode 100644 index 87c0dbd..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CELLXFS.slnk +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CELL_DATA.slnk b/ZA2X/TTYP/ZEXCEL_T_CELL_DATA.slnk deleted file mode 100644 index ea6e9a1..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CELL_DATA.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CELL_DATA_UNSORTED.slnk b/ZA2X/TTYP/ZEXCEL_T_CELL_DATA_UNSORTED.slnk deleted file mode 100644 index 8631faf..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CELL_DATA_UNSORTED.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_COL.slnk b/ZA2X/TTYP/ZEXCEL_T_CONVERTER_COL.slnk deleted file mode 100644 index 8f99331..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_COL.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FCAT.slnk b/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FCAT.slnk deleted file mode 100644 index 8eeeb33..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FCAT.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FIL.slnk b/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FIL.slnk deleted file mode 100644 index 12cb2ed..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_FIL.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_LAYO.slnk b/ZA2X/TTYP/ZEXCEL_T_CONVERTER_LAYO.slnk deleted file mode 100644 index f1e8546..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CONVERTER_LAYO.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_CONV_FIELDCATALOG.slnk b/ZA2X/TTYP/ZEXCEL_T_CONV_FIELDCATALOG.slnk deleted file mode 100644 index 1f76496..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_CONV_FIELDCATALOG.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_FIELDCATALOG.slnk b/ZA2X/TTYP/ZEXCEL_T_FIELDCATALOG.slnk deleted file mode 100644 index cd59511..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_FIELDCATALOG.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_SHARED_STRING.slnk b/ZA2X/TTYP/ZEXCEL_T_SHARED_STRING.slnk deleted file mode 100644 index 8de05e2..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_SHARED_STRING.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_SHEET_STYLE.slnk b/ZA2X/TTYP/ZEXCEL_T_SHEET_STYLE.slnk deleted file mode 100644 index b89c1cb..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_SHEET_STYLE.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk deleted file mode 100644 index 77085e1..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING1.slnk +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk deleted file mode 100644 index ca0356b..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLEMAPPING2.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLES_COND_MAPPING.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLES_COND_MAPPING.slnk deleted file mode 100644 index a44c472..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLES_COND_MAPPING.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLES_MAPPING.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLES_MAPPING.slnk deleted file mode 100644 index ed4ce81..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLES_MAPPING.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_ALIGNMENT.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_ALIGNMENT.slnk deleted file mode 100644 index bb9926c..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_ALIGNMENT.slnk +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_BORDER.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_BORDER.slnk deleted file mode 100644 index 6f071e6..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_BORDER.slnk +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_COLOR_ARGB.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_COLOR_ARGB.slnk deleted file mode 100644 index a786c98..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_COLOR_ARGB.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk deleted file mode 100644 index 186f35e..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_FONT.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_FONT.slnk deleted file mode 100644 index 199c26f..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_FONT.slnk +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_NUMFMT.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_NUMFMT.slnk deleted file mode 100644 index c75ba3f..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_NUMFMT.slnk +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_PROTECTION.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_PROTECTION.slnk deleted file mode 100644 index 4b0c7d6..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_PROTECTION.slnk +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_COLUMNDIME.slnk b/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_COLUMNDIME.slnk deleted file mode 100644 index f0f3c92..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_COLUMNDIME.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_ROWDIMENSIO.slnk b/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_ROWDIMENSIO.slnk deleted file mode 100644 index c10b6e6..0000000 --- a/ZA2X/TTYP/ZEXCEL_T_WORKSHEET_ROWDIMENSIO.slnk +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ZA2X/XSLT/ZEXCEL_TR_SHARED_STRINGS.slnk b/ZA2X/XSLT/ZEXCEL_TR_SHARED_STRINGS.slnk deleted file mode 100644 index 4fb6d8e..0000000 --- a/ZA2X/XSLT/ZEXCEL_TR_SHARED_STRINGS.slnk +++ /dev/null @@ -1,24 +0,0 @@ - - - <?sap.transform simple?> -<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"> - - <tt:root name="ROOT"/> - <tt:root name="SHARED_STRINGS"/> - - <tt:template> - <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> - <tt:attribute name="count" value-ref="ROOT.COUNT"/> - <tt:attribute name="uniqueCount" value-ref="ROOT.UNIQUE_COUNT"/> - <tt:loop ref="SHARED_STRINGS"> - <si> - <t> - <tt:value ref="STRING_VALUE"/> - </t> - </si> - </tt:loop> - </sst> - </tt:template> - -</tt:transform> - diff --git a/ZA2X/XSLT/ZEXCEL_TR_SHEET.slnk b/ZA2X/XSLT/ZEXCEL_TR_SHEET.slnk deleted file mode 100644 index 08ca893..0000000 --- a/ZA2X/XSLT/ZEXCEL_TR_SHEET.slnk +++ /dev/null @@ -1,309 +0,0 @@ - - - <?sap.transform simple?> -<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" - xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - - <tt:root name="WORKSHEET"/> - <tt:root name="CELLS"/> - <tt:root name="WRITER"/> - <tt:variable name="owriter" ref-type="ZCL_EXCEL_WRITER_HUGE_FILE"/> - - <tt:template> - <tt:assign ref="WRITER" to-var="owriter"/> - <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" - xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" - mc:Ignorable="x14ac"> - <tt:namespace name="r" /> - <tt:namespace name="mc" /> - <tt:namespace name="x14ac" /> - <sheetPr> - <tt:cond check="not-initial(WORKSHEET.TABCOLOR)"> - <tabColor> - <tt:attribute name="rgb" value-ref="WORKSHEET.TABCOLOR" /> - </tabColor> - </tt:cond> - <outlinePr> - <tt:attribute name="summaryRight" value-ref="WORKSHEET.SUMMARYRIGHT" /> - <tt:attribute name="summaryBelow" value-ref="WORKSHEET.SUMMARYBELOW" /> - </outlinePr> - </sheetPr> - <tt:cond check="not-initial(WORKSHEET.FITTOPAGE)"> - <pageSetupPr> - <tt:attribute name="fitToPage" value-ref="WORKSHEET.FITTOPAGE" /> - </pageSetupPr> - </tt:cond> - <dimension> - <tt:attribute name="ref" value-ref="WORKSHEET.DIMENSION" /> - </dimension> - <sheetViews> - <sheetView> - <tt:attribute name="showZeros" value-ref="WORKSHEET.SHOWZEROS" /> - <tt:attribute name="tabSelected" value-ref="WORKSHEET.TABSELECTED" /> - <tt:attribute name="zoomScale" value-ref="WORKSHEET.ZOOMSCALE" /> - <tt:cond check="WORKSHEET.ZOOMSCALENORMAL != 0"> - <tt:attribute name="zoomScaleNormal" value-ref="WORKSHEET.ZOOMSCALENORMAL" /> - </tt:cond> - <tt:cond check="WORKSHEET.ZOOMSCALEPAGEVIEW != 0"> - <tt:attribute name="zoomScalePageLayoutView" value-ref="WORKSHEET.ZOOMSCALEPAGEVIEW" /> - </tt:cond> - <tt:attribute name="zoomScaleSheetLayoutView" value-ref="WORKSHEET.ZOOMSCALESHEETVIEW" /> - <tt:attribute name="workbookViewId" value-ref="WORKSHEET.WORKBOOKVIEWID" /> - <tt:attribute name="showGridLines" value-ref="WORKSHEET.SHOWGRIDLINES" /> - <tt:attribute name="showRowColHeaders" value-ref="WORKSHEET.SHOWROWCOLHEADERS" /> - <tt:cond check="WORKSHEET.YSPLIT != 0 or WORKSHEET.XSPLIT != 0"> - <pane activePane="bottomRight" state="frozen"> - <tt:cond check="WORKSHEET.YSPLIT != 0"> - <tt:attribute name="ySplit" value-ref="WORKSHEET.YSPLIT" /> - </tt:cond> - <tt:cond check="WORKSHEET.XSPLIT != 0"> - <tt:attribute name="xSplit" value-ref="WORKSHEET.XSPLIT" /> - </tt:cond> - <tt:attribute name="topLeftCell" value-ref="WORKSHEET.TOPLEFTCELL" /> - </pane> - </tt:cond> - <selection> - <tt:attribute name="activeCell" value-ref="WORKSHEET.ACTIVECELL" /> - <tt:attribute name="sqref" value-ref="WORKSHEET.ACTIVECELL" /> - </selection> - </sheetView> - </sheetViews> - <sheetFormatPr> - <tt:attribute name="defaultRowHeight" value-ref="WORKSHEET.DEFAULTROWHEIGHT" /> - <tt:cond check="WORKSHEET.DEFAULTCOLWIDTH != 0"> - <tt:attribute name="defaultColWidth" value-ref="WORKSHEET.DEFAULTCOLWIDTH" /> - </tt:cond> - <tt:attribute name="x14ac:outlineLevelRow" value-ref="WORKSHEET.OUTLINELEVELROW" /> - <tt:attribute name="x14ac:outlineLevelCol" value-ref="WORKSHEET.OUTLINELEVELCOL" /> - </sheetFormatPr> - <cols> - <tt:loop ref="WORKSHEET.COLS"> - <col> - <tt:attribute name="min" value-ref="MIN" /> - <tt:attribute name="max" value-ref="MAX" /> - <tt:attribute name="width" value-ref="WIDTH" /> - <tt:cond check="not-initial(HIDDEN)"> - <tt:attribute name="hidden" value-ref="HIDDEN" /> - </tt:cond> - <tt:cond check="not-initial(CUSTOMWIDTH)"> - <tt:attribute name="customWidth" value-ref="CUSTOMWIDTH" /> - </tt:cond> - <tt:cond check="not-initial(BESTFIT)"> - <tt:attribute name="bestFit" value-ref="BESTFIT" /> - </tt:cond> - <tt:cond check="not-initial(COLLAPSED)"> - <tt:attribute name="collapsed" value-ref="COLLAPSED" /> - </tt:cond> - <tt:cond check="OUTLINELEVEL != 0"> - <tt:attribute name="outlineLevel" value-ref="OUTLINELEVEL" /> - </tt:cond> - <tt:cond check="STYLE >= 0"> - <tt:attribute name="style" value-ref="STYLE" /> - </tt:cond> - </col> - </tt:loop> - </cols> - <sheetData> - <tt:loop ref="WORKSHEET.ROWS"> - <row> - <tt:attribute name="r" value-ref="ROW" /> - <tt:attribute name="spans" value-ref="SPANS" /> - <tt:cond check="not-initial(HIDDEN)"> - <tt:attribute name="hidden" value-ref="HIDDEN" /> - </tt:cond> - <tt:cond check="not-initial(CUSTOMHEIGHT)"> - <tt:attribute name="customHeight" value-ref="CUSTOMHIGHT" /> - <tt:attribute name="ht" value-ref="HIGHT" /> - </tt:cond> - <tt:cond check="not-initial(COLLAPSED)"> - <tt:attribute name="collapsed" value-ref="COLLAPSED" /> - </tt:cond> - <tt:cond check="OUTLINELEVEL != 0"> - <tt:attribute name="outlineLevel" value-ref="OUTLINELEVEL" /> - </tt:cond> - <tt:cond check="STYLE != 0"> - <tt:attribute name="customFormat" value-ref="CUSTOMFORMAT" /> - <tt:attribute name="s" value-ref="STYLE" /> - </tt:cond> - <!-- Aufruf get_cells --> - <tt:call-method s-name="GET_CELLS" var="owriter"> - <tt:with-parameter name="I_ROW" ref="ROW" /> - <tt:with-parameter name="I_INDEX" ref="INDEX" /> - </tt:call-method> - <tt:loop ref=".CELLS"> - <c> - <tt:attribute name="r" value-ref="NAME" /> - <tt:cond check="STYLE >= 0"> - <tt:attribute name="s" value-ref="STYLE" /> - </tt:cond> - <tt:cond check="not-initial(FORMULA)"> - <tt:attribute name="f" value-ref="FORMULA" /> - </tt:cond> - <tt:cond check="not-initial(VALUE) and initial(FORMULA)"> - <tt:attribute name="t" value-ref="TYPE" /> - <tt:cond check="TYPE = 'inlineStr'"> - <is> - <t> - <tt:value ref="VALUE" /> - </t> - </is> - </tt:cond> - <tt:cond check="TYPE != 'inlineStr'"> - <v> - <tt:value ref="VALUE" /> - </v> - </tt:cond> - </tt:cond> - </c> - </tt:loop> - </row> - </tt:loop> - </sheetData> - <tt:cond check="WORKSHEET.MERGECELLS_COUNT != 0"> - <mergeCells> - <tt:attribute name="count" value-ref="WORKSHEET.MERGECELLS_COUNT" /> - <tt:loop ref="WORKSHEET.MERGECELLS"> - <mergeCell> - <tt:attribute name="ref" value-ref="REF" /> - </mergeCell> - </tt:loop> - </mergeCells> - </tt:cond> - <tt:cond check="WORKSHEET.HYPERLINKS_COUNT != 0"> - <hyperlinks> - <tt:loop ref="WORKSHEET.HYPERLINKS"> - <hyperlink> - <tt:attribute name="ref" value-ref="REF" /> - <tt:cond check="not-initial(LOCATION)"> - <tt:attribute name="location" value-ref="LOCATION" /> - </tt:cond> - <tt:cond check="not-initial(R_ID)"> - <tt:attribute name="r:id" value-ref="R_ID" /> - </tt:cond> - </hyperlink> - </tt:loop> - </hyperlinks> - </tt:cond> - <tt:cond check="not-initial(WORKSHEET.PRINTOPTIONS)"> - <printOptions> - <tt:ref name="WORKSHEET.PRINTOPTIONS"> - <tt:cond check="not-initial(GRIDLINES)"> - <tt:attribute name="gridLines" value-ref="GRIDLINES" /> - </tt:cond> - <tt:cond check="not-initial(HORIZONTALCENTERED)"> - <tt:attribute name="horizontalCentered" value-ref="HORIZONTALCENTERED" /> - </tt:cond> - <tt:cond check="not-initial(VERTICALCENTERED)"> - <tt:attribute name="verticalCentered" value-ref="VERTICALCENTERED" /> - </tt:cond> - </tt:ref> - </printOptions> - </tt:cond> - <pageMargins> - <tt:ref name="WORKSHEET.PAGEMARGINS"> - <tt:attribute name="left" value-ref="LEFT" /> - <tt:attribute name="right" value-ref="RIGHT" /> - <tt:attribute name="top" value-ref="TOP" /> - <tt:attribute name="bottom" value-ref="BOTTOM" /> - <tt:attribute name="header" value-ref="HEADER" /> - <tt:attribute name="footer" value-ref="FOOTER" /> - </tt:ref> - </pageMargins> - <pageSetup> - <tt:ref name="WORKSHEET.PAGESETUP"> - <tt:cond check="not-initial(BLACKANDWHITE)"> - <tt:attribute name="blackAndWhite" value-ref="BLACKANDWHITE" /> - </tt:cond> - <tt:cond check="not-initial(CELLCOMMENTS)"> - <tt:attribute name="cellComments" value-ref="CELLCOMMENTS" /> - </tt:cond> - <tt:cond check="COPIES != 0"> - <tt:attribute name="copies" value-ref="COPIES" /> - </tt:cond> - <tt:cond check="not-initial(DRAFT)"> - <tt:attribute name="draft" value-ref="DRAFT" /> - </tt:cond> - <tt:cond check="not-initial(ERRORS)"> - <tt:attribute name="errors" value-ref="ERRORS" /> - </tt:cond> - <tt:cond check="FIRSTPAGENUMBER != 0"> - <tt:attribute name="firstPageNumber" value-ref="FIRSTPAGENUMBER" /> - </tt:cond> - <tt:cond check="not-initial(FITTOPAGE)"> - <tt:attribute name="fitToHeight" value-ref="FITTOHIGHT" /> - <tt:attribute name="fitToWidth" value-ref="FITTOWIDTH" /> - </tt:cond> - <tt:cond check="HORIZONTALDPI != 0"> - <tt:attribute name="horizontalDpi" value-ref="HORIZONTALDPI" /> - </tt:cond> - <tt:cond check="not-initial(ORIENTATION)"> - <tt:attribute name="orientation" value-ref="ORIENTATION" /> - </tt:cond> - <tt:cond check="not-initial(PAGEORDER)"> - <tt:attribute name="pageOrder" value-ref="PAGEORDER" /> - </tt:cond> - <tt:cond check="not-initial(PAPERHEIGHT)"> - <tt:attribute name="paperHeight" value-ref="PAPERHEIGHT" /> - </tt:cond> - <tt:cond check="PAPERSIZE != 0"> - <tt:attribute name="paperSize" value-ref="PAPERSIZE" /> - </tt:cond> - <tt:cond check="not-initial(PAPERWIDTH)"> - <tt:attribute name="paperWidth" value-ref="PAPERWIDTH" /> - </tt:cond> - <tt:cond check="SCALE != 0"> - <tt:attribute name="scale" value-ref="SCALE" /> - </tt:cond> - <tt:cond check="not-initial(USEFIRSTPAGENUMBER)"> - <tt:attribute name="useFirstPageNumber" value-ref="USEFIRSTPAGENUMBER" /> - </tt:cond> - <tt:cond check="not-initial(USEPRINTERDEFAULTS)"> - <tt:attribute name="usePrinterDefaults" value-ref="USEPRINTERDEFAULTS" /> - </tt:cond> - <tt:cond check="VERTICALDPI != 0"> - <tt:attribute name="verticalDpi" value-ref="VERTICALDPI" /> - </tt:cond> - </tt:ref> - </pageSetup> - <tt:cond check="not-initial(WORKSHEET.HEADERFOOTER)"> - <headerFooter> - <tt:ref name="WORKSHEET.HEADERFOOTER"> - <tt:cond check="not-initial(WORKSHEET.HEADERFOOTER)"> - <tt:attribute name="differentOddEven" value-ref="DIFFERENTODDEVEN" /> - </tt:cond> - <oddHeader> - <tt:value ref="ODDHEADER" /> - </oddHeader> - <oddFooter> - <tt:value ref="ODDFOOTER" /> - </oddFooter> - <evenHeader> - <tt:value ref="EVENHEADER" /> - </evenHeader> - <evenFooter> - <tt:value ref="EVENFOOTER" /> - </evenFooter> - </tt:ref> - </headerFooter> - </tt:cond> - <tt:cond check="not-initial(WORKSHEET.DRAWINGS)"> - <drawing> - <tt:attribute name="r:id" value-ref="WORKSHEET.DRAWINGS" /> - </drawing> - </tt:cond> - <tt:cond check="WORKSHEET.TABLES_COUNT != 0"> - <tableParts> - <tt:attribute name="count" value-ref="WORKSHEET.TABLES_COUNT" /> - <tt:loop ref="WORKSHEET.TABLES"> - <tablePart> - <tt:attribute name="r:id" value-ref="R_ID" /> - </tablePart> - </tt:loop> - </tableParts> - </tt:cond> - </worksheet> - </tt:template> -</tt:transform> - diff --git a/build/K902337.TIR b/build/K902337.TIR new file mode 100644 index 0000000..94dd014 --- /dev/null +++ b/build/K902337.TIR @@ -0,0 +1,7 @@ +FEMIA K WIR 1 191 312 0 0 2 0 0 0 330 731 . 0 0 0 0 0 800 +#A +#/1/ A G D - R C T - Z RELE EX. _ _ _ _ _ CLI +TIR f 0000 20170516214711 yukon tiradm +TIR e 0000 20170516214720 yukon tiradm +WIR < 0000 20170516214748 yukon tiradm +TIR E 0000 20170516214748 yukon tiradm diff --git a/build/R902337.TIR b/build/R902337.TIR new file mode 100644 index 0000000..4657b63 Binary files /dev/null and b/build/R902337.TIR differ