diff --git a/src/demos/zdemo_excel26.prog.abap b/src/demos/zdemo_excel26.prog.abap index 041223f..2b830e9 100644 --- a/src/demos/zdemo_excel26.prog.abap +++ b/src/demos/zdemo_excel26.prog.abap @@ -121,7 +121,7 @@ FORM user_command . * export file to save file path TRY. - PERFORM export_to_excel. + PERFORM export_to_excel. CATCH zcx_excel INTO lo_error. lv_message = lo_error->get_text( ). MESSAGE lv_message TYPE 'I' DISPLAY LIKE 'E'. @@ -146,12 +146,12 @@ FORM export_to_excel RAISING zcx_excel. lo_worksheet->set_title( ip_title = 'Sheet1' ). * write to excel using method Bin_object - lo_worksheet->bind_alv( - io_alv = lo_salv - it_table = gt_sbook - i_top = 2 - i_left = 1 - ). + lo_worksheet->bind_alv( + io_alv = lo_salv + it_table = gt_sbook + i_top = 2 + i_left = 1 + ). PERFORM write_file. diff --git a/src/demos/zdemo_excel27.prog.abap b/src/demos/zdemo_excel27.prog.abap index 3fcf7c3..8ffbeb1 100644 --- a/src/demos/zdemo_excel27.prog.abap +++ b/src/demos/zdemo_excel27.prog.abap @@ -64,7 +64,7 @@ START-OF-SELECTION. CREATE OBJECT lo_app. TRY. - lo_app->main( ). + lo_app->main( ). CATCH zcx_excel INTO lo_error. lv_message = lo_error->get_text( ). MESSAGE lv_message TYPE 'I' DISPLAY LIKE 'E'. @@ -75,94 +75,94 @@ CLASS lcl_app IMPLEMENTATION. METHOD main. - DATA: - lo_style_cond TYPE REF TO zcl_excel_style_cond, - lo_style TYPE REF TO zcl_excel_style. + DATA: + lo_style_cond TYPE REF TO zcl_excel_style_cond, + lo_style TYPE REF TO zcl_excel_style. - " Creates active sheet - CREATE OBJECT lo_excel. + " 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_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( ). + 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 = 'Conditional formatting'. - 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' ). + " Get active sheet + lo_worksheet = lo_excel->get_active_worksheet( ). + lv_title = 'Conditional formatting'. + 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_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' ). + " 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_cond = lo_worksheet->add_new_style_cond( ). - lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis. - ls_cellis-formula = '"Anchovy"'. - ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal. - ls_cellis-cell_style = lv_style_1_guid. - lo_style_cond->mode_cellis = ls_cellis. - lo_style_cond->priority = 1. - lo_style_cond->set_range( ip_start_column = 'C' - ip_start_row = 2 - ip_stop_column = 'C' - ip_stop_row = 2 ). + lo_style_cond = lo_worksheet->add_new_style_cond( ). + lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis. + ls_cellis-formula = '"Anchovy"'. + ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal. + ls_cellis-cell_style = lv_style_1_guid. + lo_style_cond->mode_cellis = ls_cellis. + lo_style_cond->priority = 1. + lo_style_cond->set_range( ip_start_column = 'C' + ip_start_row = 2 + ip_stop_column = 'C' + ip_stop_row = 2 ). - lo_style_cond = lo_worksheet->add_new_style_cond( ). - lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis. - ls_cellis-formula = '"Carp"'. - ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal. - ls_cellis-cell_style = lv_style_2_guid. - lo_style_cond->mode_cellis = ls_cellis. - lo_style_cond->priority = 2. - lo_style_cond->set_range( ip_start_column = 'C' - ip_start_row = 2 - ip_stop_column = 'C' - ip_stop_row = 2 ). + lo_style_cond = lo_worksheet->add_new_style_cond( ). + lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis. + ls_cellis-formula = '"Carp"'. + ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal. + ls_cellis-cell_style = lv_style_2_guid. + lo_style_cond->mode_cellis = ls_cellis. + lo_style_cond->priority = 2. + lo_style_cond->set_range( ip_start_column = 'C' + ip_start_row = 2 + ip_stop_column = 'C' + ip_stop_row = 2 ). - " Conditional formatting for all operators - conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ). - conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ). - conditional_formatting_cellis( column = 'D' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_notequal f = '="Anchovy"' f2 = '' numfmt = 'not equal to Anchovy' ). - conditional_formatting_cellis( column = 'E' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_between f = '="B"' f2 = '="CC"' numfmt = 'between B and CC' ). - conditional_formatting_cellis( column = 'F' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthan f = '="Catfish"' f2 = '' numfmt = 'greater than Catfish' ). - conditional_formatting_cellis( column = 'G' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthanorequal f = '="Catfish"' f2 = '' numfmt = 'greater than or equal to Catfish' ). - conditional_formatting_cellis( column = 'H' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthan f = '="Catfish"' f2 = '' numfmt = 'less than Catfish' ). - conditional_formatting_cellis( column = 'I' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthanorequal f = '="Catfish"' f2 = '' numfmt = 'less than or equal to Catfish' ). + " Conditional formatting for all operators + conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ). + conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ). + conditional_formatting_cellis( column = 'D' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_notequal f = '="Anchovy"' f2 = '' numfmt = 'not equal to Anchovy' ). + conditional_formatting_cellis( column = 'E' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_between f = '="B"' f2 = '="CC"' numfmt = 'between B and CC' ). + conditional_formatting_cellis( column = 'F' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthan f = '="Catfish"' f2 = '' numfmt = 'greater than Catfish' ). + conditional_formatting_cellis( column = 'G' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthanorequal f = '="Catfish"' f2 = '' numfmt = 'greater than or equal to Catfish' ). + conditional_formatting_cellis( column = 'H' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthan f = '="Catfish"' f2 = '' numfmt = 'less than Catfish' ). + conditional_formatting_cellis( column = 'I' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthanorequal f = '="Catfish"' f2 = '' numfmt = 'less than or equal to Catfish' ). - " Conditional formatting for all text functions - conditional_formatting_textfun( column = 'C' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_beginswith text = 'A' numfmt = 'begins with A' ). - conditional_formatting_textfun( column = 'D' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_containstext text = 'h' numfmt = 'contains text h' ). - conditional_formatting_textfun( column = 'E' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_endswith text = 'p' numfmt = 'ends with p' ). - conditional_formatting_textfun( column = 'F' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_notcontains text = 'h' numfmt = 'not contains h' ). + " Conditional formatting for all text functions + conditional_formatting_textfun( column = 'C' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_beginswith text = 'A' numfmt = 'begins with A' ). + conditional_formatting_textfun( column = 'D' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_containstext text = 'h' numfmt = 'contains text h' ). + conditional_formatting_textfun( column = 'E' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_endswith text = 'p' numfmt = 'ends with p' ). + conditional_formatting_textfun( column = 'F' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_notcontains text = 'h' numfmt = 'not contains h' ). *** Create output - lcl_output=>output( lo_excel ). + lcl_output=>output( lo_excel ). ENDMETHOD. diff --git a/src/demos/zdemo_excel32.prog.abap b/src/demos/zdemo_excel32.prog.abap index f71499f..555d894 100644 --- a/src/demos/zdemo_excel32.prog.abap +++ b/src/demos/zdemo_excel32.prog.abap @@ -33,20 +33,20 @@ 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: 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'. + 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 *--------------------------------------------------------------------* @@ -101,38 +101,38 @@ FORM user_command . lv_message TYPE string. * 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 ). + 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. + 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 ). + cl_gui_frontend_services=>get_file_separator( + CHANGING file_separator = lv_file_separator ). * export file to save file path TRY. - CASE sy-ucomm. - WHEN 'EXCELBIND'. - CONCATENATE l_path lv_file_separator lv_default_file_name - INTO l_path. - PERFORM export_to_excel_bind. + 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'. + WHEN 'EXCELCONV'. - CONCATENATE l_path lv_file_separator lv_default_file_name2 - INTO l_path. - PERFORM export_to_excel_conv. + CONCATENATE l_path lv_file_separator lv_default_file_name2 + INTO l_path. + PERFORM export_to_excel_conv. - ENDCASE. + ENDCASE. CATCH zcx_excel INTO lo_error. lv_message = lo_error->get_text( ). @@ -225,7 +225,7 @@ FORM write_file RAISING zcx_excel. RECEIVING et_solix = lt_file. - l_bytecount = XSTRLEN( l_file ). + l_bytecount = xstrlen( l_file ). ELSE. " Convert to binary CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' diff --git a/src/demos/zdemo_excel48.prog.abap b/src/demos/zdemo_excel48.prog.abap index 61cf8fa..17924f2 100644 --- a/src/demos/zdemo_excel48.prog.abap +++ b/src/demos/zdemo_excel48.prog.abap @@ -6,15 +6,15 @@ REPORT zdemo_excel48. DATA: - lo_excel TYPE REF TO zcl_excel, - lo_worksheet TYPE REF TO zcl_excel_worksheet, - 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, - lv_value TYPE string, - ls_rtf TYPE zexcel_s_rtf, - lt_rtf TYPE zexcel_t_rtf. + lo_excel TYPE REF TO zcl_excel, + lo_worksheet TYPE REF TO zcl_excel_worksheet, + 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, + lv_value TYPE string, + ls_rtf TYPE zexcel_s_rtf, + lt_rtf TYPE zexcel_t_rtf. CONSTANTS: diff --git a/src/demos/zdemo_excel_fill_template.prog.abap b/src/demos/zdemo_excel_fill_template.prog.abap index fc7ec89..39197c4 100644 --- a/src/demos/zdemo_excel_fill_template.prog.abap +++ b/src/demos/zdemo_excel_fill_template.prog.abap @@ -15,60 +15,60 @@ REPORT zdemo_excel_fill_template. * on the Excel file ZDEMO_EXCEL_TEMPLATE * from SMW0. *================= -TYPES t_number TYPE p length 16 decimals 4. +TYPES t_number TYPE p LENGTH 16 DECIMALS 4. TYPES: - begin of t_TABLE1, - PERSON type string, - SALARY type t_number, - end of t_TABLE1, + BEGIN OF t_table1, + person TYPE string, + salary TYPE t_number, + END OF t_table1, - tt_TABLE1 type standard table of t_TABLE1 with default key, + tt_table1 TYPE STANDARD TABLE OF t_table1 WITH DEFAULT KEY, - begin of t_LINE1, - CARRID type string, - CONNID type string, - FLDATE type d, - PRICE type t_number, - end of t_LINE1, + BEGIN OF t_line1, + carrid TYPE string, + connid TYPE string, + fldate TYPE d, + price TYPE t_number, + END OF t_line1, - tt_LINE1 type standard table of t_LINE1 with default key, + tt_line1 TYPE STANDARD TABLE OF t_line1 WITH DEFAULT KEY, - begin of t_TABLE2, - CARRID type string, - PRICE type t_number, - LINE1 type tt_LINE1, - end of t_TABLE2, + BEGIN OF t_table2, + carrid TYPE string, + price TYPE t_number, + line1 TYPE tt_line1, + END OF t_table2, - tt_TABLE2 type standard table of t_TABLE2 with default key, + tt_table2 TYPE STANDARD TABLE OF t_table2 WITH DEFAULT KEY, - begin of t_Sheet1, - DATE type d, - TIME type t, - USER type string, - TOTAL type t_number, - PRICE type t_number, - TABLE1 type tt_TABLE1, - TABLE2 type tt_TABLE2, - end of t_Sheet1, + BEGIN OF t_sheet1, + date TYPE d, + time TYPE t, + user TYPE string, + total TYPE t_number, + price TYPE t_number, + table1 TYPE tt_table1, + table2 TYPE tt_table2, + END OF t_sheet1, - begin of t_TABLE3, - PERSON type string, - SALARY type t_number, - end of t_TABLE3, + BEGIN OF t_table3, + person TYPE string, + salary TYPE t_number, + END OF t_table3, - tt_TABLE3 type standard table of t_TABLE3 with default key, + tt_table3 TYPE STANDARD TABLE OF t_table3 WITH DEFAULT KEY, - begin of t_Sheet2, - DATE type d, - TIME type t, - USER type string, - TOTAL type t_number, - TABLE3 type tt_TABLE3, - end of t_Sheet2. + BEGIN OF t_sheet2, + date TYPE d, + time TYPE t, + user TYPE string, + total TYPE t_number, + table3 TYPE tt_table3, + END OF t_sheet2. -DATA: lo_data type ref to ZCL_EXCEL_TEMPLATE_DATA. +DATA: lo_data TYPE REF TO zcl_excel_template_data. *================= * End of generated code *================= @@ -299,55 +299,55 @@ FORM load_smw0 RAISING zcx_excel. - DATA: lv_excel_data TYPE xstring, - lt_mime TYPE TABLE OF w3mime, - ls_key TYPE wwwdatatab, - lv_errormessage TYPE string, - lv_filesize TYPE i, - lv_filesizec TYPE c LENGTH 10. + DATA: lv_excel_data TYPE xstring, + lt_mime TYPE TABLE OF w3mime, + ls_key TYPE wwwdatatab, + lv_errormessage TYPE string, + lv_filesize TYPE i, + lv_filesizec TYPE c LENGTH 10. *--------------------------------------------------------------------* * Read file into binary string *--------------------------------------------------------------------* - ls_key-relid = 'MI'. - ls_key-objid = iv_w3objid . + ls_key-relid = 'MI'. + ls_key-objid = iv_w3objid . - CALL FUNCTION 'WWWDATA_IMPORT' - EXPORTING - key = ls_key - TABLES - mime = lt_mime - EXCEPTIONS - OTHERS = 1. - IF sy-subrc <> 0. - lv_errormessage = 'A problem occured when reading the MIME object'(004). - zcx_excel=>raise_text( lv_errormessage ). - ENDIF. + CALL FUNCTION 'WWWDATA_IMPORT' + EXPORTING + key = ls_key + TABLES + mime = lt_mime + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + lv_errormessage = 'A problem occured when reading the MIME object'(004). + zcx_excel=>raise_text( lv_errormessage ). + ENDIF. - CALL FUNCTION 'WWWPARAMS_READ' - EXPORTING - relid = ls_key-relid - objid = ls_key-objid - name = 'filesize' - IMPORTING - value = lv_filesizec. + CALL FUNCTION 'WWWPARAMS_READ' + EXPORTING + relid = ls_key-relid + objid = ls_key-objid + name = 'filesize' + IMPORTING + value = lv_filesizec. - lv_filesize = lv_filesizec. - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filesize - IMPORTING - buffer = lv_excel_data - TABLES - binary_tab = lt_mime - EXCEPTIONS - failed = 1 - OTHERS = 2. + lv_filesize = lv_filesizec. + CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' + EXPORTING + input_length = lv_filesize + IMPORTING + buffer = lv_excel_data + TABLES + binary_tab = lt_mime + EXCEPTIONS + failed = 1 + OTHERS = 2. *--------------------------------------------------------------------* * Parse Excel data into ZCL_EXCEL object from binary string *--------------------------------------------------------------------* - ro_excel = io_reader->load( i_excel2007 = lv_excel_data ). + ro_excel = io_reader->load( i_excel2007 = lv_excel_data ). ENDFORM. diff --git a/src/not_cloud/zexcel_template_get_types.prog.abap b/src/not_cloud/zexcel_template_get_types.prog.abap index 865bf39..7b26177 100644 --- a/src/not_cloud/zexcel_template_get_types.prog.abap +++ b/src/not_cloud/zexcel_template_get_types.prog.abap @@ -327,55 +327,55 @@ FORM load_smw0 RAISING zcx_excel. - DATA: lv_excel_data TYPE xstring, - lt_mime TYPE TABLE OF w3mime, - ls_key TYPE wwwdatatab, - lv_errormessage TYPE string, - lv_filesize TYPE i, - lv_filesizec TYPE c LENGTH 10. + DATA: lv_excel_data TYPE xstring, + lt_mime TYPE TABLE OF w3mime, + ls_key TYPE wwwdatatab, + lv_errormessage TYPE string, + lv_filesize TYPE i, + lv_filesizec TYPE c LENGTH 10. *--------------------------------------------------------------------* * Read file into binary string *--------------------------------------------------------------------* - ls_key-relid = 'MI'. - ls_key-objid = iv_w3objid . + ls_key-relid = 'MI'. + ls_key-objid = iv_w3objid . - CALL FUNCTION 'WWWDATA_IMPORT' - EXPORTING - key = ls_key - TABLES - mime = lt_mime - EXCEPTIONS - OTHERS = 1. - IF sy-subrc <> 0. - lv_errormessage = 'A problem occured when reading the MIME object'(004). - zcx_excel=>raise_text( lv_errormessage ). - ENDIF. + CALL FUNCTION 'WWWDATA_IMPORT' + EXPORTING + key = ls_key + TABLES + mime = lt_mime + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + lv_errormessage = 'A problem occured when reading the MIME object'(004). + zcx_excel=>raise_text( lv_errormessage ). + ENDIF. - CALL FUNCTION 'WWWPARAMS_READ' - EXPORTING - relid = ls_key-relid - objid = ls_key-objid - name = 'filesize' - IMPORTING - value = lv_filesizec. + CALL FUNCTION 'WWWPARAMS_READ' + EXPORTING + relid = ls_key-relid + objid = ls_key-objid + name = 'filesize' + IMPORTING + value = lv_filesizec. - lv_filesize = lv_filesizec. - CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' - EXPORTING - input_length = lv_filesize - IMPORTING - buffer = lv_excel_data - TABLES - binary_tab = lt_mime - EXCEPTIONS - failed = 1 - OTHERS = 2. + lv_filesize = lv_filesizec. + CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' + EXPORTING + input_length = lv_filesize + IMPORTING + buffer = lv_excel_data + TABLES + binary_tab = lt_mime + EXCEPTIONS + failed = 1 + OTHERS = 2. *--------------------------------------------------------------------* * Parse Excel data into ZCL_EXCEL object from binary string *--------------------------------------------------------------------* - ro_excel = io_reader->load( i_excel2007 = lv_excel_data ). + ro_excel = io_reader->load( i_excel2007 = lv_excel_data ). ENDFORM. diff --git a/src/zcl_excel.clas.abap b/src/zcl_excel.clas.abap index 29a6b12..2cb5f6e 100644 --- a/src/zcl_excel.clas.abap +++ b/src/zcl_excel.clas.abap @@ -147,8 +147,8 @@ CLASS zcl_excel DEFINITION IMPORTING !io_theme TYPE REF TO zcl_excel_theme . METHODS fill_template - importing - !iv_data TYPE REF TO ZCL_EXCEL_TEMPLATE_DATA + IMPORTING + !iv_data TYPE REF TO zcl_excel_template_data RAISING zcx_excel . PROTECTED SECTION. diff --git a/src/zcl_excel_autofilter.clas.abap b/src/zcl_excel_autofilter.clas.abap index 06fa438..b382fbb 100644 --- a/src/zcl_excel_autofilter.clas.abap +++ b/src/zcl_excel_autofilter.clas.abap @@ -401,9 +401,9 @@ CLASS zcl_excel_autofilter IMPLEMENTATION. METHOD validate_area. - DATA: l_col TYPE zexcel_cell_column, + DATA: l_col TYPE zexcel_cell_column, ls_original_filter_area TYPE zexcel_s_autofilter_area, - l_row TYPE zexcel_cell_row. + l_row TYPE zexcel_cell_row. l_row = worksheet->get_highest_row( ) . l_col = worksheet->get_highest_column( ) . diff --git a/src/zcl_excel_collection.clas.abap b/src/zcl_excel_collection.clas.abap index 868f5ed..48ff6b8 100644 --- a/src/zcl_excel_collection.clas.abap +++ b/src/zcl_excel_collection.clas.abap @@ -37,7 +37,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_COLLECTION IMPLEMENTATION. +CLASS zcl_excel_collection IMPLEMENTATION. METHOD add . diff --git a/src/zcl_excel_collection_iterator.clas.abap b/src/zcl_excel_collection_iterator.clas.abap index d104dc2..6e418a7 100644 --- a/src/zcl_excel_collection_iterator.clas.abap +++ b/src/zcl_excel_collection_iterator.clas.abap @@ -15,7 +15,7 @@ CLASS zcl_excel_collection_iterator DEFINITION VALUE(object) TYPE REF TO object. METHODS constructor IMPORTING - collection TYPE REF TO zCL_excel_COLLECTION. + collection TYPE REF TO zcl_excel_collection. PROTECTED SECTION. PRIVATE SECTION. DATA index TYPE i VALUE 0. @@ -24,7 +24,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_COLLECTION_ITERATOR IMPLEMENTATION. +CLASS zcl_excel_collection_iterator IMPLEMENTATION. METHOD constructor . diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 6bc1490..6ae1159 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -221,7 +221,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_COMMON IMPLEMENTATION. +CLASS zcl_excel_common IMPLEMENTATION. METHOD calculate_cell_distance. @@ -1082,32 +1082,32 @@ CLASS ZCL_EXCEL_COMMON IMPLEMENTATION. 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 TYPE string, " 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_ref_formula TYPE string, - lv_compare_1 TYPE string, - lv_compare_2 TYPE string, - lv_level TYPE i, " Level of groups [..[..]..] or {..} + 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 TYPE string, " 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_ref_formula TYPE string, + lv_compare_1 TYPE string, + lv_compare_2 TYPE string, + lv_level TYPE i, " Level of groups [..[..]..] or {..} - lv_errormessage TYPE string. + lv_errormessage TYPE string. *--------------------------------------------------------------------* * When copying a cell in EXCEL to another cell any inherent formulas @@ -1289,17 +1289,17 @@ CLASS ZCL_EXCEL_COMMON IMPLEMENTATION. ENDDO. ENDIF. - " Is valid column & row ? - IF lv_tcol1 IS NOT INITIAL AND lv_trow1 IS NOT INITIAL. - " COLUMN + ROW - CONCATENATE lv_tcol1 lv_trow1 INTO lv_compare_1. - " Original condensed string - lv_compare_2 = lv_ref_cell_addr. - CONDENSE lv_compare_2. - IF lv_compare_1 <> lv_compare_2. - CLEAR: lv_trow1, lv_tchar2. + " Is valid column & row ? + IF lv_tcol1 IS NOT INITIAL AND lv_trow1 IS NOT INITIAL. + " COLUMN + ROW + CONCATENATE lv_tcol1 lv_trow1 INTO lv_compare_1. + " Original condensed string + lv_compare_2 = lv_ref_cell_addr. + CONDENSE lv_compare_2. + IF lv_compare_1 <> lv_compare_2. + CLEAR: lv_trow1, lv_tchar2. + ENDIF. ENDIF. - ENDIF. *--------------------------------------------------------------------* * Check for invalid cell address diff --git a/src/zcl_excel_common.clas.testclasses.abap b/src/zcl_excel_common.clas.testclasses.abap index 81e3720..3828002 100644 --- a/src/zcl_excel_common.clas.testclasses.abap +++ b/src/zcl_excel_common.clas.testclasses.abap @@ -56,15 +56,15 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING RAISING cx_static_check. METHODS: calc_cell_dist_samecell FOR TESTING RAISING cx_static_check, - calc_cell_dist_down1pl FOR TESTING RAISING cx_static_check, - calc_cell_dist_downsome FOR TESTING RAISING cx_static_check, - calc_cell_dist_up1pl FOR TESTING RAISING cx_static_check, - calc_cell_dist_upsome FOR TESTING RAISING cx_static_check, - calc_cell_dist_right1pl FOR TESTING RAISING cx_static_check, - calc_cell_dist_rightsome FOR TESTING RAISING cx_static_check, - calc_cell_dist_left1pl FOR TESTING RAISING cx_static_check, - calc_cell_dist_leftsome FOR TESTING RAISING cx_static_check, - calc_cell_dist_fullpack FOR TESTING RAISING cx_static_check. + calc_cell_dist_down1pl FOR TESTING RAISING cx_static_check, + calc_cell_dist_downsome FOR TESTING RAISING cx_static_check, + calc_cell_dist_up1pl FOR TESTING RAISING cx_static_check, + calc_cell_dist_upsome FOR TESTING RAISING cx_static_check, + calc_cell_dist_right1pl FOR TESTING RAISING cx_static_check, + calc_cell_dist_rightsome FOR TESTING RAISING cx_static_check, + calc_cell_dist_left1pl FOR TESTING RAISING cx_static_check, + calc_cell_dist_leftsome FOR TESTING RAISING cx_static_check, + calc_cell_dist_fullpack FOR TESTING RAISING cx_static_check. METHODS macro_shift_formula IMPORTING iv_reference_formula TYPE clike @@ -72,31 +72,31 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING iv_shift_rows TYPE i iv_expected TYPE string. METHODS: shift_formula_basic FOR TESTING, - shift_formula_rightdown FOR TESTING, - shift_formula_leftup FOR TESTING, - shift_formula_fixedcolrows FOR TESTING, - shift_formula_mixedfixedrows FOR TESTING, - shift_formula_rangename FOR TESTING, - shift_formula_stringlitconc FOR TESTING, - shift_formula_extref FOR TESTING, - shift_formula_charblanks FOR TESTING, - shift_formula_stringblanks FOR TESTING, - shift_formula_funcnoargs FOR TESTING, - shift_formula_nocellref FOR TESTING, - shift_formula_empty FOR TESTING, - shift_formula_referr_colunder FOR TESTING, - shift_formula_referr_rowunder FOR TESTING, - shift_formula_referr_rowcolund FOR TESTING, - shift_formula_sheet_nodigit FOR TESTING, - shift_formula_sheet_nodig FOR TESTING, - shift_formula_sheet_special FOR TESTING, - shift_formula_resp_blanks_1 FOR TESTING, - shift_formula_resp_blanks_2 FOR TESTING, - shift_formula_range FOR TESTING, - shift_formula_notcols FOR TESTING, - shift_formula_name FOR TESTING, - shift_formula_refcolumn1 FOR TESTING, - shift_formula_refcolumn2 FOR TESTING. + shift_formula_rightdown FOR TESTING, + shift_formula_leftup FOR TESTING, + shift_formula_fixedcolrows FOR TESTING, + shift_formula_mixedfixedrows FOR TESTING, + shift_formula_rangename FOR TESTING, + shift_formula_stringlitconc FOR TESTING, + shift_formula_extref FOR TESTING, + shift_formula_charblanks FOR TESTING, + shift_formula_stringblanks FOR TESTING, + shift_formula_funcnoargs FOR TESTING, + shift_formula_nocellref FOR TESTING, + shift_formula_empty FOR TESTING, + shift_formula_referr_colunder FOR TESTING, + shift_formula_referr_rowunder FOR TESTING, + shift_formula_referr_rowcolund FOR TESTING, + shift_formula_sheet_nodigit FOR TESTING, + shift_formula_sheet_nodig FOR TESTING, + shift_formula_sheet_special FOR TESTING, + shift_formula_resp_blanks_1 FOR TESTING, + shift_formula_resp_blanks_2 FOR TESTING, + shift_formula_range FOR TESTING, + shift_formula_notcols FOR TESTING, + shift_formula_name FOR TESTING, + shift_formula_refcolumn1 FOR TESTING, + shift_formula_refcolumn2 FOR TESTING. METHODS is_cell_in_range_ulc_in FOR TESTING. METHODS is_cell_in_range_lrc_in FOR TESTING. METHODS is_cell_in_range_leftside_out FOR TESTING. @@ -1405,7 +1405,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_sheet_nodigit. -" Sheet name not ending with digit + " Sheet name not ending with digit macro_shift_formula( iv_reference_formula = 'Sheet!A1' iv_shift_cols = 1 @@ -1416,7 +1416,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_sheet_nodig. -" Sheet name ending with digit + " Sheet name ending with digit macro_shift_formula( iv_reference_formula = 'Sheet2!A1' iv_shift_cols = 1 @@ -1427,7 +1427,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_sheet_special. -" Sheet name with special characters + " Sheet name with special characters macro_shift_formula( iv_reference_formula = |'Sheet name'!A1| iv_shift_cols = 1 @@ -1438,7 +1438,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_resp_blanks_1. -" Respecting blanks + " Respecting blanks macro_shift_formula( iv_reference_formula = 'SUBTOTAL(109,Table1[SUM 1])' iv_shift_cols = 1 @@ -1449,7 +1449,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_resp_blanks_2. -" Respecting blanks + " Respecting blanks macro_shift_formula( iv_reference_formula = 'B4 & C4' iv_shift_cols = 0 @@ -1460,7 +1460,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_range. -" F_1 is a range name, not a cell address + " F_1 is a range name, not a cell address macro_shift_formula( iv_reference_formula = 'SUM(F_1,F_2)' iv_shift_cols = 1 @@ -1470,7 +1470,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. ENDMETHOD. METHOD shift_formula_notcols. -" RC are not columns + " RC are not columns macro_shift_formula( iv_reference_formula = 'INDIRECT("RC[4]",FALSE)' iv_shift_cols = 1 @@ -1481,7 +1481,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_name. -" A1 is a sheet name + " A1 is a sheet name macro_shift_formula( iv_reference_formula = |'A1'!$A$1| iv_shift_cols = 1 @@ -1492,7 +1492,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_refcolumn1. -" Reference to another column in the same row of a Table, with a space in the column name + " Reference to another column in the same row of a Table, with a space in the column name macro_shift_formula( iv_reference_formula = 'Tbl[[#This Row],[Air fare]]' iv_shift_cols = 1 @@ -1503,7 +1503,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION. METHOD shift_formula_refcolumn2. -" Reference to another column in the same row of a Table, inside more complex expression + " Reference to another column in the same row of a Table, inside more complex expression macro_shift_formula( iv_reference_formula = 'Tbl[[#This Row],[Air]]+A1' iv_shift_cols = 1 diff --git a/src/zcl_excel_converter.clas.abap b/src/zcl_excel_converter.clas.abap index 25e4fd0..2dff15a 100644 --- a/src/zcl_excel_converter.clas.abap +++ b/src/zcl_excel_converter.clas.abap @@ -255,7 +255,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_CONVERTER IMPLEMENTATION. +CLASS zcl_excel_converter IMPLEMENTATION. METHOD ask_option. diff --git a/src/zcl_excel_drawing.clas.abap b/src/zcl_excel_drawing.clas.abap index be4c140..51a0521 100644 --- a/src/zcl_excel_drawing.clas.abap +++ b/src/zcl_excel_drawing.clas.abap @@ -131,9 +131,9 @@ CLASS zcl_excel_drawing DEFINITION DATA type TYPE zexcel_drawing_type VALUE type_image. "#EC NOTEXT . . . . . . . . . . . " . DATA index TYPE string . DATA anchor TYPE zexcel_drawing_anchor VALUE anchor_one_cell. "#EC NOTEXT . . . . . . . . . . . " . - CONSTANTS c_media_source_www TYPE c VALUE 1. "#EC NOTEXT - CONSTANTS c_media_source_xstring TYPE c VALUE 0. "#EC NOTEXT - CONSTANTS c_media_source_mime TYPE c VALUE 2. "#EC NOTEXT + CONSTANTS c_media_source_www TYPE c VALUE 1. "#EC NOTEXT + CONSTANTS c_media_source_xstring TYPE c VALUE 0. "#EC NOTEXT + CONSTANTS c_media_source_mime TYPE c VALUE 2. "#EC NOTEXT DATA guid TYPE guid_16 . DATA media TYPE xstring . DATA media_key_www TYPE wwwdatatab . diff --git a/src/zcl_excel_font.clas.abap b/src/zcl_excel_font.clas.abap index ceaeea1..c7f0e2e 100644 --- a/src/zcl_excel_font.clas.abap +++ b/src/zcl_excel_font.clas.abap @@ -46,23 +46,23 @@ ENDCLASS. -CLASS ZCL_EXCEL_FONT IMPLEMENTATION. +CLASS zcl_excel_font IMPLEMENTATION. METHOD calculate_text_width. CONSTANTS lc_excel_cell_padding TYPE float VALUE '0.75'. - DATA: ld_current_character TYPE c LENGTH 1, - 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, - lt_font_families LIKE STANDARD TABLE OF ld_font_family, - ls_font_cache TYPE mty_s_font_cache. + DATA: ld_current_character TYPE c LENGTH 1, + 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, + lt_font_families LIKE STANDARD TABLE OF ld_font_family, + ls_font_cache TYPE mty_s_font_cache. FIELD-SYMBOLS: TYPE mty_s_font_cache, TYPE mty_s_font_metric, diff --git a/src/zcl_excel_font.clas.testclasses.abap b/src/zcl_excel_font.clas.testclasses.abap index 9801cec..a98b7d4 100644 --- a/src/zcl_excel_font.clas.testclasses.abap +++ b/src/zcl_excel_font.clas.testclasses.abap @@ -1,11 +1,11 @@ -CLASS ltcl_Test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. +CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS calculate FOR TESTING RAISING cx_static_check. ENDCLASS. -CLASS ltcl_Test IMPLEMENTATION. +CLASS ltcl_test IMPLEMENTATION. METHOD calculate. diff --git a/src/zcl_excel_reader_2007.clas.abap b/src/zcl_excel_reader_2007.clas.abap index 2ee2087..023c5f9 100644 --- a/src/zcl_excel_reader_2007.clas.abap +++ b/src/zcl_excel_reader_2007.clas.abap @@ -20,12 +20,12 @@ CLASS zcl_excel_reader_2007 DEFINITION *"* protected components of class ZCL_EXCEL_READER_2007 *"* do not include other source files here!!! BEGIN OF t_relationship, - id TYPE string, - type TYPE string, - target TYPE string, - targetmode TYPE string, - worksheet TYPE REF TO zcl_excel_worksheet, - sheetid TYPE string, "ins #235 - repeat rows/cols - needed to identify correct sheet + id TYPE string, + type TYPE string, + target TYPE string, + targetmode TYPE string, + worksheet TYPE REF TO zcl_excel_worksheet, + sheetid TYPE string, "ins #235 - repeat rows/cols - needed to identify correct sheet localsheetid TYPE string, END OF t_relationship . TYPES: @@ -876,7 +876,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. 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, - lo_node_r_child_rPr TYPE REF TO if_ixml_element, + lo_node_r_child_rpr TYPE REF TO if_ixml_element, lo_font TYPE REF TO zcl_excel_style_font, ls_rtf TYPE zexcel_s_rtf, lv_current_offset TYPE int2, @@ -1528,96 +1528,96 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. lo_node_font = io_xml_element. - CREATE OBJECT lo_font. + CREATE OBJECT lo_font. *--------------------------------------------------------------------* * Bold *--------------------------------------------------------------------* - IF lo_node_font->find_from_name( 'b' ) IS BOUND. - lo_font->bold = abap_true. - ENDIF. + 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. + 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. + 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. + 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. + 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' ). + lo_node2 = lo_node_font->find_from_name( 'name' ). + IF lo_node2 IS BOUND. + lo_font->name = lo_node2->get_attribute( 'val' ). + ELSE. + lo_node2 = lo_node_font->find_from_name( 'rFont' ). IF lo_node2 IS BOUND. lo_font->name = lo_node2->get_attribute( 'val' ). - ELSE. - lo_node2 = lo_node_font->find_from_name( 'rFont' ). - IF lo_node2 IS BOUND. - lo_font->name = lo_node2->get_attribute( 'val' ). - ENDIF. ENDIF. + 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. + 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. + 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. + 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. + ro_font = lo_font. ENDMETHOD. @@ -3572,9 +3572,9 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION. DATA: lo_ixml_ignored_errors TYPE REF TO if_ixml_node_collection, lo_ixml_ignored_error TYPE REF TO if_ixml_element, - lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, - ls_ignored_error TYPE zcl_excel_worksheet=>mty_s_ignored_errors, - lt_ignored_errors TYPE zcl_excel_worksheet=>mty_th_ignored_errors. + lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, + ls_ignored_error TYPE zcl_excel_worksheet=>mty_s_ignored_errors, + lt_ignored_errors TYPE zcl_excel_worksheet=>mty_th_ignored_errors. DATA: BEGIN OF ls_raw_ignored_error, sqref TYPE string, diff --git a/src/zcl_excel_reader_huge_file.clas.abap b/src/zcl_excel_reader_huge_file.clas.abap index 17b56c4..99aa7b0 100644 --- a/src/zcl_excel_reader_huge_file.clas.abap +++ b/src/zcl_excel_reader_huge_file.clas.abap @@ -28,7 +28,7 @@ CLASS zcl_excel_reader_huge_file DEFINITION BEGIN OF t_cell. INCLUDE TYPE t_cell_coord AS coord. INCLUDE TYPE t_cell_content AS content. - TYPES: END OF t_cell . + TYPES: END OF t_cell . INTERFACE if_sxml_node LOAD . CONSTANTS c_end_of_stream TYPE if_sxml_node=>node_type VALUE if_sxml_node=>co_nt_final. "#EC NOTEXT diff --git a/src/zcl_excel_reader_huge_file.clas.testclasses.abap b/src/zcl_excel_reader_huge_file.clas.testclasses.abap index 25cfe88..f7e98c2 100644 --- a/src/zcl_excel_reader_huge_file.clas.testclasses.abap +++ b/src/zcl_excel_reader_huge_file.clas.testclasses.abap @@ -1,133 +1,133 @@ *"* 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 DEFERRED. +CLASS zcl_excel_reader_huge_file DEFINITION LOCAL FRIENDS lcl_test. * -class lcl_test definition for testing - risk level harmless - duration short. +CLASS lcl_test DEFINITION FOR TESTING + RISK LEVEL HARMLESS + 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 raising cx_static_check, - test_number for testing raising cx_static_check, - test_shared_string for testing raising cx_static_check, - test_shared_string_missing for testing raising cx_static_check, - test_inline_string for testing raising cx_static_check, - test_empty_cells for testing raising cx_static_check, - test_boolean for testing raising cx_static_check, - test_style for testing raising cx_static_check, - test_style_missing for testing raising cx_static_check, - test_formula for testing raising cx_static_check, - test_read_shared_strings for testing raising cx_static_check, - test_shared_string_some_empty for testing raising cx_static_check, - test_skip_to_inexistent for testing raising cx_static_check, - 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. + 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 RAISING cx_static_check, + test_number FOR TESTING RAISING cx_static_check, + test_shared_string FOR TESTING RAISING cx_static_check, + test_shared_string_missing FOR TESTING RAISING cx_static_check, + test_inline_string FOR TESTING RAISING cx_static_check, + test_empty_cells FOR TESTING RAISING cx_static_check, + test_boolean FOR TESTING RAISING cx_static_check, + test_style FOR TESTING RAISING cx_static_check, + test_style_missing FOR TESTING RAISING cx_static_check, + test_formula FOR TESTING RAISING cx_static_check, + test_read_shared_strings FOR TESTING RAISING cx_static_check, + test_shared_string_some_empty FOR TESTING RAISING cx_static_check, + test_skip_to_inexistent FOR TESTING RAISING cx_static_check, + 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 +ENDCLASS. "lcl_test DEFINITION * -class lcl_test implementation. +CLASS lcl_test IMPLEMENTATION. * - method test_number. - data lo_reader type ref to if_sxml_reader. + METHOD test_number. + DATA lo_reader TYPE REF TO if_sxml_reader. lo_reader = get_reader( `17` ). out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). assert_value_equals( `17` ). assert_datatype_equals( `n` ). - endmethod. "test_shared_string + ENDMETHOD. "test_shared_string * - method test_shared_string. - data lo_reader type ref to if_sxml_reader. - data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string. + METHOD test_shared_string. + DATA lo_reader TYPE REF TO if_sxml_reader. + DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string. ls_shared_string-value = `Test1`. - append ls_shared_string to out->shared_strings. + APPEND ls_shared_string TO out->shared_strings. ls_shared_string-value = `Test2`. - append ls_shared_string to out->shared_strings. + APPEND ls_shared_string TO out->shared_strings. lo_reader = get_reader( `1` ). out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). assert_value_equals( `Test2` ). assert_datatype_equals( `s` ). - endmethod. "test_shared_string + ENDMETHOD. "test_shared_string * - method test_shared_string_missing. + 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. - data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string. + DATA: lo_reader TYPE REF TO if_sxml_reader, + lo_ex TYPE REF TO lcx_not_found, + lv_text TYPE string. + DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string. ls_shared_string-value = `Test`. - append ls_shared_string to out->shared_strings. + APPEND ls_shared_string TO out->shared_strings. lo_reader = get_reader( `1` ). - try. + TRY. out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - CL_ABAP_UNIT_ASSERT=>fail( `Index to non-existent shared string should give an error` ). - catch lcx_not_found into lo_ex. + cl_abap_unit_assert=>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. + ENDTRY. - endmethod. + ENDMETHOD. * - method test_inline_string. - data lo_reader type ref to if_sxml_reader. + METHOD test_inline_string. + DATA lo_reader TYPE REF TO if_sxml_reader. lo_reader = get_reader( `Alpha` ). out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). assert_value_equals( `Alpha` ). assert_datatype_equals( `inlineStr` ). - endmethod. "test_inline_string + ENDMETHOD. "test_inline_string * - method test_boolean. - data lo_reader type ref to if_sxml_reader. + METHOD test_boolean. + DATA lo_reader TYPE REF TO if_sxml_reader. lo_reader = get_reader( `1` ). out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). assert_value_equals( `1` ). assert_datatype_equals( `b` ). - endmethod. "test_boolean + ENDMETHOD. "test_boolean * - method test_formula. - data lo_reader type ref to if_sxml_reader. + METHOD test_formula. + DATA lo_reader TYPE REF TO if_sxml_reader. lo_reader = get_reader( `A2*A2` ). out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). assert_formula_equals( `A2*A2` ). assert_datatype_equals( `n` ). - endmethod. "test_formula + ENDMETHOD. "test_formula * - method test_empty_cells. + 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. - data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string. + DATA: lo_reader TYPE REF TO if_sxml_reader. + DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string. ls_shared_string-value = ``. - append ls_shared_string to out->shared_strings. + APPEND ls_shared_string TO out->shared_strings. ls_shared_string-value = `t`. - append ls_shared_string to out->shared_strings. + APPEND ls_shared_string TO out->shared_strings. lo_reader = get_reader( `0` & `` & @@ -140,17 +140,17 @@ class lcl_test implementation. assert_value_equals( iv_row = 2 iv_col = 1 iv_value = `` ). assert_value_equals( iv_row = 3 iv_col = 1 iv_value = `t` ). - endmethod. + 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( ). + 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( `18` @@ -159,173 +159,173 @@ class lcl_test implementation. assert_style_equals( lv_guid ). - endmethod. "test_style + ENDMETHOD. "test_style * - method test_style_missing. + 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. + 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( `18` ). - try. + TRY. out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ). - CL_ABAP_UNIT_ASSERT=>fail( `Reference to non-existent style should throw an lcx_not_found exception` ). - catch lcx_not_found into lo_ex. + cl_abap_unit_assert=>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. + ENDTRY. - endmethod. "test_style + 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. + 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 = `AlphaBravo` - importing buffer = lv_xstring ). + lo_c2x->convert( EXPORTING data = `AlphaBravo` + 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. + APPEND : + `` TO lt_exp, + `Alpha` TO lt_exp, + `Bravo` TO lt_exp. lt_act = out->read_shared_strings( lo_reader ). - CL_ABAP_UNIT_ASSERT=>assert_equals( act = lt_act + cl_abap_unit_assert=>assert_equals( act = lt_act exp = lt_exp ). - endmethod. + ENDMETHOD. * - method test_shared_string_some_empty. - data: lo_reader type ref to if_sxml_reader, - lt_act type stringtab, - lt_exp type stringtab. + 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( `` & `Alpha` & `` & `Bravo` ) ). - append : - `` to lt_exp, - `Alpha` to lt_exp, - `` to lt_exp, - `Bravo` to lt_exp. + APPEND : + `` TO lt_exp, + `Alpha` TO lt_exp, + `` TO lt_exp, + `Bravo` TO lt_exp. lt_act = out->read_shared_strings( lo_reader ). - CL_ABAP_UNIT_ASSERT=>assert_equals( act = lt_act + cl_abap_unit_assert=>assert_equals( act = lt_act exp = lt_exp ). - endmethod. + 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. + 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 = `AlphaBravo` - importing buffer = lv_xstring ). + lo_c2x->convert( EXPORTING data = `AlphaBravo` + IMPORTING buffer = lv_xstring ). lo_reader = cl_sxml_string_reader=>create( lv_xstring ). - try. + TRY. out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ). - CL_ABAP_UNIT_ASSERT=>fail( `Skipping to non-existing element must raise lcx_not_found exception` ). - catch lcx_not_found into lo_ex. + cl_abap_unit_assert=>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. + 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 `` iv_xml `` into lv_full. + METHOD get_reader. + DATA: lv_full TYPE string, + lo_c2x TYPE REF TO cl_abap_conv_out_ce, + lv_xstring TYPE xstring. + CONCATENATE `` iv_xml `` INTO lv_full. lo_c2x = cl_abap_conv_out_ce=>create( ). - lo_c2x->convert( exporting data = lv_full - importing buffer = lv_xstring ). + lo_c2x->convert( EXPORTING data = lv_full + IMPORTING buffer = lv_xstring ). eo_reader = cl_sxml_string_reader=>create( lv_xstring ). - endmethod. "get_reader + ENDMETHOD. "get_reader * - method assert_value_equals. + METHOD assert_value_equals. - constants: lc_empty_string type string value is initial. + CONSTANTS: lc_empty_string TYPE string VALUE IS INITIAL. - field-symbols: type zexcel_s_cell_data, - type string. + FIELD-SYMBOLS: TYPE zexcel_s_cell_data, + TYPE string. - read table worksheet->sheet_content assigning - with table key cell_row = iv_row cell_column = iv_col. - if sy-subrc eq 0. - assign -cell_value to . - else. - assign lc_empty_string to . - endif. + READ TABLE worksheet->sheet_content ASSIGNING + WITH TABLE KEY cell_row = iv_row cell_column = iv_col. + IF sy-subrc EQ 0. + ASSIGN -cell_value TO . + ELSE. + ASSIGN lc_empty_string TO . + ENDIF. - CL_ABAP_UNIT_ASSERT=>assert_equals( act = + cl_abap_unit_assert=>assert_equals( act = exp = iv_value ). - endmethod. "assert_value_equals + ENDMETHOD. "assert_value_equals ** - method assert_formula_equals. + METHOD assert_formula_equals. - field-symbols: type zexcel_s_cell_data. + FIELD-SYMBOLS: TYPE zexcel_s_cell_data. - read table worksheet->sheet_content assigning - with table key cell_row = iv_row cell_column = iv_col. - CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ). + READ TABLE worksheet->sheet_content ASSIGNING + WITH TABLE KEY cell_row = iv_row cell_column = iv_col. + cl_abap_unit_assert=>assert_subrc( sy-subrc ). - CL_ABAP_UNIT_ASSERT=>assert_equals( act = -cell_formula + cl_abap_unit_assert=>assert_equals( act = -cell_formula exp = iv_formula ). - endmethod. "assert_formula_equals + ENDMETHOD. "assert_formula_equals * - method assert_style_equals. + METHOD assert_style_equals. - field-symbols: type zexcel_s_cell_data. + FIELD-SYMBOLS: TYPE zexcel_s_cell_data. - read table worksheet->sheet_content assigning - with table key cell_row = iv_row cell_column = iv_col. - CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ). + READ TABLE worksheet->sheet_content ASSIGNING + WITH TABLE KEY cell_row = iv_row cell_column = iv_col. + cl_abap_unit_assert=>assert_subrc( sy-subrc ). - CL_ABAP_UNIT_ASSERT=>assert_equals( act = -cell_style + cl_abap_unit_assert=>assert_equals( act = -cell_style exp = iv_style ). - endmethod. + ENDMETHOD. * - method assert_datatype_equals. + METHOD assert_datatype_equals. - field-symbols: type zexcel_s_cell_data. + FIELD-SYMBOLS: TYPE zexcel_s_cell_data. - read table worksheet->sheet_content assigning - with table key cell_row = iv_row cell_column = iv_col. - CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ). + READ TABLE worksheet->sheet_content ASSIGNING + WITH TABLE KEY cell_row = iv_row cell_column = iv_col. + cl_abap_unit_assert=>assert_subrc( sy-subrc ). - CL_ABAP_UNIT_ASSERT=>assert_equals( act = -data_type + cl_abap_unit_assert=>assert_equals( act = -data_type exp = iv_datatype ). - endmethod. "assert_datatype_equals - method setup. - create object out. - create object excel. - create object worksheet - exporting + 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 + ENDMETHOD. "setup +ENDCLASS. "lcl_test IMPLEMENTATION diff --git a/src/zcl_excel_style_color.clas.abap b/src/zcl_excel_style_color.clas.abap index cbe9afb..424329f 100644 --- a/src/zcl_excel_style_color.clas.abap +++ b/src/zcl_excel_style_color.clas.abap @@ -57,7 +57,7 @@ CLASS zcl_excel_style_color DEFINITION *"* private components of class ZCL_EXCEL_STYLE_COLOR *"* do not include other source files here!!! - CONSTANTS c_alpha TYPE c LENGTH 2 VALUE 'FF'. "#EC NOTEXT + CONSTANTS c_alpha TYPE c LENGTH 2 VALUE 'FF'. "#EC NOTEXT ENDCLASS. diff --git a/src/zcl_excel_style_number_format.clas.abap b/src/zcl_excel_style_number_format.clas.abap index 7a60219..9064556 100644 --- a/src/zcl_excel_style_number_format.clas.abap +++ b/src/zcl_excel_style_number_format.clas.abap @@ -92,8 +92,8 @@ CLASS zcl_excel_style_number_format DEFINITION PRIVATE SECTION. CLASS-METHODS add_format IMPORTING - id TYPE string - code TYPE zexcel_number_format. + id TYPE string + code TYPE zexcel_number_format. *"* private components of class ZCL_EXCEL_STYLE_NUMBER_FORMAT *"* do not include other source files here!!! ENDCLASS. diff --git a/src/zcl_excel_worksheet.clas.abap b/src/zcl_excel_worksheet.clas.abap index 1c7b97b..e647e30 100644 --- a/src/zcl_excel_worksheet.clas.abap +++ b/src/zcl_excel_worksheet.clas.abap @@ -725,7 +725,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_WORKSHEET IMPLEMENTATION. +CLASS zcl_excel_worksheet IMPLEMENTATION. METHOD add_comment. diff --git a/src/zcl_excel_worksheet.clas.testclasses.abap b/src/zcl_excel_worksheet.clas.testclasses.abap index e33e3cf..b9bb8e7 100644 --- a/src/zcl_excel_worksheet.clas.testclasses.abap +++ b/src/zcl_excel_worksheet.clas.testclasses.abap @@ -79,9 +79,9 @@ CLASS lcl_excel_worksheet_test IMPLEMENTATION. CREATE OBJECT lo_excel. TRY. - CREATE OBJECT f_cut - EXPORTING - ip_excel = lo_excel. + CREATE OBJECT f_cut + EXPORTING + ip_excel = lo_excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. diff --git a/src/zcl_excel_writer_2007.clas.abap b/src/zcl_excel_writer_2007.clas.abap index b303750..abf6f32 100644 --- a/src/zcl_excel_writer_2007.clas.abap +++ b/src/zcl_excel_writer_2007.clas.abap @@ -251,11 +251,11 @@ CLASS zcl_excel_writer_2007 DEFINITION METHODS add_1_val_child_node IMPORTING - io_document TYPE REF TO if_ixml_document - io_parent TYPE REF TO if_ixml_element - iv_elem_name TYPE string - iv_attr_name TYPE string - iv_attr_value TYPE string. + io_document TYPE REF TO if_ixml_document + io_parent TYPE REF TO if_ixml_element + iv_elem_name TYPE string + iv_attr_name TYPE string + iv_attr_value TYPE string. METHODS flag2bool IMPORTING !ip_flag TYPE flag @@ -274,15 +274,15 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. METHOD add_1_val_child_node. - DATA: lo_child TYPE REF TO if_ixml_element. + DATA: lo_child TYPE REF TO if_ixml_element. - lo_child = io_document->create_simple_element( name = iv_elem_name - parent = io_document ). - IF iv_attr_name IS NOT INITIAL. - lo_child->set_attribute_ns( name = iv_attr_name - value = iv_attr_value ). - ENDIF. - io_parent->append_child( new_child = lo_child ). + lo_child = io_document->create_simple_element( name = iv_elem_name + parent = io_document ). + IF iv_attr_name IS NOT INITIAL. + lo_child->set_attribute_ns( name = iv_attr_name + value = iv_attr_value ). + ENDIF. + io_parent->append_child( new_child = lo_child ). ENDMETHOD. @@ -3650,13 +3650,13 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lo_element = lo_document->create_simple_element( name = lc_xml_node_si parent = lo_document ). IF -rtf_tab IS INITIAL. - lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t - parent = lo_document ). - IF boolc( contains( val = -string_value start = ` ` ) ) = abap_true - OR boolc( contains( val = -string_value end = ` ` ) ) = abap_true. - lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ). - ENDIF. - lo_sub_element->set_value( value = -string_value ). + lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t + parent = lo_document ). + IF boolc( contains( val = -string_value start = ` ` ) ) = abap_true + OR boolc( contains( val = -string_value end = ` ` ) ) = abap_true. + lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ). + ENDIF. + lo_sub_element->set_value( value = -string_value ). ELSE. LOOP AT -rtf_tab ASSIGNING . lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_r @@ -3846,7 +3846,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lc_xml_attr_priority TYPE string VALUE 'priority', lc_xml_attr_operator TYPE string VALUE 'operator', lc_xml_attr_text TYPE string VALUE 'text', - lc_xml_attr_notContainsText TYPE string VALUE 'notContainsText', + lc_xml_attr_notcontainstext TYPE string VALUE 'notContainsText', lc_xml_attr_allowblank TYPE string VALUE 'allowBlank', lc_xml_attr_showinputmessage TYPE string VALUE 'showInputMessage', lc_xml_attr_showerrormessage TYPE string VALUE 'showErrorMessage', @@ -4645,7 +4645,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lv_value = lo_style_cond->mode_textfunction-textfunction. ENDIF. ELSE. - lv_value = lo_style_cond->rule. + lv_value = lo_style_cond->rule. ENDIF. lo_element_2->set_attribute_ns( name = lc_xml_attr_type value = lv_value ). @@ -5536,7 +5536,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. io_element_root->append_child( lo_element ). - ENDIF. + ENDIF. ENDMETHOD. METHOD create_xl_sheet_column_formula. @@ -7276,16 +7276,16 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. METHOD create_xl_styles_font_node. - CONSTANTS: 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_name TYPE string VALUE 'name', - lc_xml_node_rfont TYPE string VALUE 'rFont', - lc_xml_node_family TYPE string VALUE 'family', - lc_xml_node_scheme TYPE string VALUE 'scheme', - lc_xml_attr_val TYPE string VALUE 'val'. + CONSTANTS: 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_name TYPE string VALUE 'name', + lc_xml_node_rfont TYPE string VALUE 'rFont', + lc_xml_node_family TYPE string VALUE 'family', + lc_xml_node_scheme TYPE string VALUE 'scheme', + lc_xml_attr_val TYPE string VALUE 'val'. DATA: lo_document TYPE REF TO if_ixml_document, lo_element_font TYPE REF TO if_ixml_element, @@ -7297,74 +7297,74 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. lo_element_font = io_parent. ls_font = is_font. - 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 + IF ls_font-bold EQ abap_true. + lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_b parent = lo_document ). - lv_value = ls_font-size. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. + 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 ). - "color - create_xl_styles_color_node( - io_document = lo_document - io_parent = lo_element_font - is_color = ls_font-color ). + 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 - IF iv_use_rtf = abap_false. + "name + IF iv_use_rtf = abap_false. lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_name parent = lo_document ). - ELSE. + ELSE. lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_rfont parent = lo_document ). - ENDIF. - 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 + ENDIF. + 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-family. - SHIFT lv_value RIGHT DELETING TRAILING space. - SHIFT lv_value LEFT DELETING LEADING space. + 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 ). - "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. + ENDIF. ENDMETHOD. @@ -7903,8 +7903,8 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION. * READ TABLE shared_strings INTO ls_shared_string WITH KEY string_value = ip_cell_value BINARY SEARCH. IF it_rtf IS INITIAL. - READ TABLE shared_strings INTO ls_shared_string WITH TABLE KEY string_value = ip_cell_value. - ep_index = ls_shared_string-string_no. + READ TABLE shared_strings INTO ls_shared_string WITH TABLE KEY string_value = ip_cell_value. + ep_index = ls_shared_string-string_no. ELSE. LOOP AT shared_strings INTO ls_shared_string WHERE string_value = ip_cell_value AND rtf_tab = it_rtf. diff --git a/src/zcl_excel_writer_csv.clas.abap b/src/zcl_excel_writer_csv.clas.abap index 44f4560..dbab77d 100644 --- a/src/zcl_excel_writer_csv.clas.abap +++ b/src/zcl_excel_writer_csv.clas.abap @@ -53,7 +53,7 @@ ENDCLASS. -CLASS ZCL_EXCEL_WRITER_CSV IMPLEMENTATION. +CLASS zcl_excel_writer_csv IMPLEMENTATION. METHOD create. diff --git a/src/zcl_excel_writer_huge_file.clas.abap b/src/zcl_excel_writer_huge_file.clas.abap index c271f92..46e28e9 100644 --- a/src/zcl_excel_writer_huge_file.clas.abap +++ b/src/zcl_excel_writer_huge_file.clas.abap @@ -69,7 +69,7 @@ CLASS zcl_excel_writer_huge_file IMPLEMENTATION. ********************************************************************** * STEP 0: Build Regex for invalid characters -" uccpi returns 2 chars but for this specific input 1 char is enough + " uccpi returns 2 chars but for this specific input 1 char is enough 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