mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 11:06:15 +08:00
Fix #893
* first part * second and last part Co-authored-by: sandraros <sandra.rossi@gmail.com>
This commit is contained in:
parent
dbd260da2c
commit
d7011f715c
|
@ -121,7 +121,7 @@ FORM user_command .
|
||||||
|
|
||||||
* export file to save file path
|
* export file to save file path
|
||||||
TRY.
|
TRY.
|
||||||
PERFORM export_to_excel.
|
PERFORM export_to_excel.
|
||||||
CATCH zcx_excel INTO lo_error.
|
CATCH zcx_excel INTO lo_error.
|
||||||
lv_message = lo_error->get_text( ).
|
lv_message = lo_error->get_text( ).
|
||||||
MESSAGE lv_message TYPE 'I' DISPLAY LIKE 'E'.
|
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' ).
|
lo_worksheet->set_title( ip_title = 'Sheet1' ).
|
||||||
|
|
||||||
* write to excel using method Bin_object
|
* write to excel using method Bin_object
|
||||||
lo_worksheet->bind_alv(
|
lo_worksheet->bind_alv(
|
||||||
io_alv = lo_salv
|
io_alv = lo_salv
|
||||||
it_table = gt_sbook
|
it_table = gt_sbook
|
||||||
i_top = 2
|
i_top = 2
|
||||||
i_left = 1
|
i_left = 1
|
||||||
).
|
).
|
||||||
|
|
||||||
PERFORM write_file.
|
PERFORM write_file.
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ START-OF-SELECTION.
|
||||||
|
|
||||||
CREATE OBJECT lo_app.
|
CREATE OBJECT lo_app.
|
||||||
TRY.
|
TRY.
|
||||||
lo_app->main( ).
|
lo_app->main( ).
|
||||||
CATCH zcx_excel INTO lo_error.
|
CATCH zcx_excel INTO lo_error.
|
||||||
lv_message = lo_error->get_text( ).
|
lv_message = lo_error->get_text( ).
|
||||||
MESSAGE lv_message TYPE 'I' DISPLAY LIKE 'E'.
|
MESSAGE lv_message TYPE 'I' DISPLAY LIKE 'E'.
|
||||||
|
@ -75,94 +75,94 @@ CLASS lcl_app IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD main.
|
METHOD main.
|
||||||
|
|
||||||
DATA:
|
DATA:
|
||||||
lo_style_cond TYPE REF TO zcl_excel_style_cond,
|
lo_style_cond TYPE REF TO zcl_excel_style_cond,
|
||||||
lo_style TYPE REF TO zcl_excel_style.
|
lo_style TYPE REF TO zcl_excel_style.
|
||||||
|
|
||||||
" Creates active sheet
|
" Creates active sheet
|
||||||
CREATE OBJECT lo_excel.
|
CREATE OBJECT lo_excel.
|
||||||
|
|
||||||
lo_style_1 = lo_excel->add_new_style( ).
|
lo_style_1 = lo_excel->add_new_style( ).
|
||||||
lo_style_1->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
|
lo_style_1->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
|
||||||
lo_style_1->fill->bgcolor-rgb = zcl_excel_style_color=>c_green.
|
lo_style_1->fill->bgcolor-rgb = zcl_excel_style_color=>c_green.
|
||||||
lv_style_1_guid = lo_style_1->get_guid( ).
|
lv_style_1_guid = lo_style_1->get_guid( ).
|
||||||
|
|
||||||
lo_style_2 = lo_excel->add_new_style( ).
|
lo_style_2 = lo_excel->add_new_style( ).
|
||||||
lo_style_2->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
|
lo_style_2->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
|
||||||
lo_style_2->fill->bgcolor-rgb = zcl_excel_style_color=>c_red.
|
lo_style_2->fill->bgcolor-rgb = zcl_excel_style_color=>c_red.
|
||||||
lv_style_2_guid = lo_style_2->get_guid( ).
|
lv_style_2_guid = lo_style_2->get_guid( ).
|
||||||
|
|
||||||
" Get active sheet
|
" Get active sheet
|
||||||
lo_worksheet = lo_excel->get_active_worksheet( ).
|
lo_worksheet = lo_excel->get_active_worksheet( ).
|
||||||
lv_title = 'Conditional formatting'.
|
lv_title = 'Conditional formatting'.
|
||||||
lo_worksheet->set_title( lv_title ).
|
lo_worksheet->set_title( lv_title ).
|
||||||
" Set values for dropdown
|
" Set values for dropdown
|
||||||
lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = c_fish ).
|
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 = 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 = 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 = 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 = 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 = 8 ip_column = 'A' ip_value = 'Eel' ).
|
||||||
lo_worksheet->set_cell( ip_row = 9 ip_column = 'A' ip_value = 'Haddock' ).
|
lo_worksheet->set_cell( ip_row = 9 ip_column = 'A' ip_value = 'Haddock' ).
|
||||||
|
|
||||||
lo_range = lo_excel->add_new_range( ).
|
lo_range = lo_excel->add_new_range( ).
|
||||||
lo_range->name = c_fish.
|
lo_range->name = c_fish.
|
||||||
lo_range->set_value( ip_sheet_name = lv_title
|
lo_range->set_value( ip_sheet_name = lv_title
|
||||||
ip_start_column = 'A'
|
ip_start_column = 'A'
|
||||||
ip_start_row = 4
|
ip_start_row = 4
|
||||||
ip_stop_column = 'A'
|
ip_stop_column = 'A'
|
||||||
ip_stop_row = 9 ).
|
ip_stop_row = 9 ).
|
||||||
|
|
||||||
" 1st validation
|
" 1st validation
|
||||||
lo_data_validation = lo_worksheet->add_new_data_validation( ).
|
lo_data_validation = lo_worksheet->add_new_data_validation( ).
|
||||||
lo_data_validation->type = zcl_excel_data_validation=>c_type_list.
|
lo_data_validation->type = zcl_excel_data_validation=>c_type_list.
|
||||||
lo_data_validation->formula1 = c_fish.
|
lo_data_validation->formula1 = c_fish.
|
||||||
lo_data_validation->cell_row = 2.
|
lo_data_validation->cell_row = 2.
|
||||||
lo_data_validation->cell_column = 'C'.
|
lo_data_validation->cell_column = 'C'.
|
||||||
lo_worksheet->set_cell( ip_row = 2 ip_column = 'C' ip_value = 'Select a value' ).
|
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 = lo_worksheet->add_new_style_cond( ).
|
||||||
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis.
|
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis.
|
||||||
ls_cellis-formula = '"Anchovy"'.
|
ls_cellis-formula = '"Anchovy"'.
|
||||||
ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal.
|
ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal.
|
||||||
ls_cellis-cell_style = lv_style_1_guid.
|
ls_cellis-cell_style = lv_style_1_guid.
|
||||||
lo_style_cond->mode_cellis = ls_cellis.
|
lo_style_cond->mode_cellis = ls_cellis.
|
||||||
lo_style_cond->priority = 1.
|
lo_style_cond->priority = 1.
|
||||||
lo_style_cond->set_range( ip_start_column = 'C'
|
lo_style_cond->set_range( ip_start_column = 'C'
|
||||||
ip_start_row = 2
|
ip_start_row = 2
|
||||||
ip_stop_column = 'C'
|
ip_stop_column = 'C'
|
||||||
ip_stop_row = 2 ).
|
ip_stop_row = 2 ).
|
||||||
|
|
||||||
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
||||||
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis.
|
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_cellis.
|
||||||
ls_cellis-formula = '"Carp"'.
|
ls_cellis-formula = '"Carp"'.
|
||||||
ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal.
|
ls_cellis-operator = zcl_excel_style_cond=>c_operator_equal.
|
||||||
ls_cellis-cell_style = lv_style_2_guid.
|
ls_cellis-cell_style = lv_style_2_guid.
|
||||||
lo_style_cond->mode_cellis = ls_cellis.
|
lo_style_cond->mode_cellis = ls_cellis.
|
||||||
lo_style_cond->priority = 2.
|
lo_style_cond->priority = 2.
|
||||||
lo_style_cond->set_range( ip_start_column = 'C'
|
lo_style_cond->set_range( ip_start_column = 'C'
|
||||||
ip_start_row = 2
|
ip_start_row = 2
|
||||||
ip_stop_column = 'C'
|
ip_stop_column = 'C'
|
||||||
ip_stop_row = 2 ).
|
ip_stop_row = 2 ).
|
||||||
|
|
||||||
" Conditional formatting for all operators
|
" 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 = '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 = '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 = '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 = '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 = '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 = '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_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 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 = '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 = '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 = '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_textfun( column = 'F' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_notcontains text = 'h' numfmt = 'not contains h' ).
|
||||||
|
|
||||||
*** Create output
|
*** Create output
|
||||||
lcl_output=>output( lo_excel ).
|
lcl_output=>output( lo_excel ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
|
@ -33,20 +33,20 @@ ENDCLASS. "lcl_handle_events IMPLEMENTATION
|
||||||
* DATA DECLARATION
|
* DATA DECLARATION
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
|
|
||||||
DATA: lo_excel TYPE REF TO zcl_excel,
|
DATA: lo_excel TYPE REF TO zcl_excel,
|
||||||
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||||
lo_salv TYPE REF TO cl_salv_table,
|
lo_salv TYPE REF TO cl_salv_table,
|
||||||
gr_events TYPE REF TO lcl_handle_events,
|
gr_events TYPE REF TO lcl_handle_events,
|
||||||
lr_events TYPE REF TO cl_salv_events_table,
|
lr_events TYPE REF TO cl_salv_events_table,
|
||||||
gt_sbook TYPE TABLE OF sbook.
|
gt_sbook TYPE TABLE OF sbook.
|
||||||
|
|
||||||
DATA: l_path TYPE string, " local dir
|
DATA: l_path TYPE string, " local dir
|
||||||
lv_workdir TYPE string,
|
lv_workdir TYPE string,
|
||||||
lv_file_separator TYPE c.
|
lv_file_separator TYPE c.
|
||||||
|
|
||||||
CONSTANTS:
|
CONSTANTS:
|
||||||
lv_default_file_name TYPE string VALUE '32_Export_ALV.xlsx',
|
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_name2 TYPE string VALUE '32_Export_Convert.xlsx'.
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
*START-OF-SELECTION
|
*START-OF-SELECTION
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
|
@ -101,38 +101,38 @@ FORM user_command .
|
||||||
lv_message TYPE string.
|
lv_message TYPE string.
|
||||||
|
|
||||||
* get save file path
|
* get save file path
|
||||||
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ).
|
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ).
|
||||||
cl_gui_cfw=>flush( ).
|
cl_gui_cfw=>flush( ).
|
||||||
cl_gui_frontend_services=>directory_browse(
|
cl_gui_frontend_services=>directory_browse(
|
||||||
EXPORTING initial_folder = l_path
|
EXPORTING initial_folder = l_path
|
||||||
CHANGING selected_folder = l_path ).
|
CHANGING selected_folder = l_path ).
|
||||||
|
|
||||||
IF l_path IS INITIAL.
|
IF l_path IS INITIAL.
|
||||||
cl_gui_frontend_services=>get_sapgui_workdir(
|
cl_gui_frontend_services=>get_sapgui_workdir(
|
||||||
CHANGING sapworkdir = lv_workdir ).
|
CHANGING sapworkdir = lv_workdir ).
|
||||||
l_path = lv_workdir.
|
l_path = lv_workdir.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
cl_gui_frontend_services=>get_file_separator(
|
cl_gui_frontend_services=>get_file_separator(
|
||||||
CHANGING file_separator = lv_file_separator ).
|
CHANGING file_separator = lv_file_separator ).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* export file to save file path
|
* export file to save file path
|
||||||
TRY.
|
TRY.
|
||||||
CASE sy-ucomm.
|
CASE sy-ucomm.
|
||||||
WHEN 'EXCELBIND'.
|
WHEN 'EXCELBIND'.
|
||||||
CONCATENATE l_path lv_file_separator lv_default_file_name
|
CONCATENATE l_path lv_file_separator lv_default_file_name
|
||||||
INTO l_path.
|
INTO l_path.
|
||||||
PERFORM export_to_excel_bind.
|
PERFORM export_to_excel_bind.
|
||||||
|
|
||||||
WHEN 'EXCELCONV'.
|
WHEN 'EXCELCONV'.
|
||||||
|
|
||||||
CONCATENATE l_path lv_file_separator lv_default_file_name2
|
CONCATENATE l_path lv_file_separator lv_default_file_name2
|
||||||
INTO l_path.
|
INTO l_path.
|
||||||
PERFORM export_to_excel_conv.
|
PERFORM export_to_excel_conv.
|
||||||
|
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
|
||||||
CATCH zcx_excel INTO lo_error.
|
CATCH zcx_excel INTO lo_error.
|
||||||
lv_message = lo_error->get_text( ).
|
lv_message = lo_error->get_text( ).
|
||||||
|
@ -225,7 +225,7 @@ FORM write_file RAISING zcx_excel.
|
||||||
RECEIVING
|
RECEIVING
|
||||||
et_solix = lt_file.
|
et_solix = lt_file.
|
||||||
|
|
||||||
l_bytecount = XSTRLEN( l_file ).
|
l_bytecount = xstrlen( l_file ).
|
||||||
ELSE.
|
ELSE.
|
||||||
" Convert to binary
|
" Convert to binary
|
||||||
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
|
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
REPORT zdemo_excel48.
|
REPORT zdemo_excel48.
|
||||||
|
|
||||||
DATA:
|
DATA:
|
||||||
lo_excel TYPE REF TO zcl_excel,
|
lo_excel TYPE REF TO zcl_excel,
|
||||||
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||||
lo_style_1 TYPE REF TO zcl_excel_style,
|
lo_style_1 TYPE REF TO zcl_excel_style,
|
||||||
lo_style_2 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_1_guid TYPE zexcel_cell_style,
|
||||||
lv_style_2_guid TYPE zexcel_cell_style,
|
lv_style_2_guid TYPE zexcel_cell_style,
|
||||||
lv_value TYPE string,
|
lv_value TYPE string,
|
||||||
ls_rtf TYPE zexcel_s_rtf,
|
ls_rtf TYPE zexcel_s_rtf,
|
||||||
lt_rtf TYPE zexcel_t_rtf.
|
lt_rtf TYPE zexcel_t_rtf.
|
||||||
|
|
||||||
|
|
||||||
CONSTANTS:
|
CONSTANTS:
|
||||||
|
|
|
@ -15,60 +15,60 @@ REPORT zdemo_excel_fill_template.
|
||||||
* on the Excel file ZDEMO_EXCEL_TEMPLATE
|
* on the Excel file ZDEMO_EXCEL_TEMPLATE
|
||||||
* from SMW0.
|
* from SMW0.
|
||||||
*=================
|
*=================
|
||||||
TYPES t_number TYPE p length 16 decimals 4.
|
TYPES t_number TYPE p LENGTH 16 DECIMALS 4.
|
||||||
TYPES:
|
TYPES:
|
||||||
begin of t_TABLE1,
|
BEGIN OF t_table1,
|
||||||
PERSON type string,
|
person TYPE string,
|
||||||
SALARY type t_number,
|
salary TYPE t_number,
|
||||||
end of t_TABLE1,
|
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,
|
BEGIN OF t_line1,
|
||||||
CARRID type string,
|
carrid TYPE string,
|
||||||
CONNID type string,
|
connid TYPE string,
|
||||||
FLDATE type d,
|
fldate TYPE d,
|
||||||
PRICE type t_number,
|
price TYPE t_number,
|
||||||
end of t_LINE1,
|
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,
|
BEGIN OF t_table2,
|
||||||
CARRID type string,
|
carrid TYPE string,
|
||||||
PRICE type t_number,
|
price TYPE t_number,
|
||||||
LINE1 type tt_LINE1,
|
line1 TYPE tt_line1,
|
||||||
end of t_TABLE2,
|
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,
|
BEGIN OF t_sheet1,
|
||||||
DATE type d,
|
date TYPE d,
|
||||||
TIME type t,
|
time TYPE t,
|
||||||
USER type string,
|
user TYPE string,
|
||||||
TOTAL type t_number,
|
total TYPE t_number,
|
||||||
PRICE type t_number,
|
price TYPE t_number,
|
||||||
TABLE1 type tt_TABLE1,
|
table1 TYPE tt_table1,
|
||||||
TABLE2 type tt_TABLE2,
|
table2 TYPE tt_table2,
|
||||||
end of t_Sheet1,
|
END OF t_sheet1,
|
||||||
|
|
||||||
|
|
||||||
begin of t_TABLE3,
|
BEGIN OF t_table3,
|
||||||
PERSON type string,
|
person TYPE string,
|
||||||
SALARY type t_number,
|
salary TYPE t_number,
|
||||||
end of t_TABLE3,
|
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,
|
BEGIN OF t_sheet2,
|
||||||
DATE type d,
|
date TYPE d,
|
||||||
TIME type t,
|
time TYPE t,
|
||||||
USER type string,
|
user TYPE string,
|
||||||
TOTAL type t_number,
|
total TYPE t_number,
|
||||||
TABLE3 type tt_TABLE3,
|
table3 TYPE tt_table3,
|
||||||
end of t_Sheet2.
|
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
|
* End of generated code
|
||||||
*=================
|
*=================
|
||||||
|
@ -299,55 +299,55 @@ FORM load_smw0
|
||||||
RAISING
|
RAISING
|
||||||
zcx_excel.
|
zcx_excel.
|
||||||
|
|
||||||
DATA: lv_excel_data TYPE xstring,
|
DATA: lv_excel_data TYPE xstring,
|
||||||
lt_mime TYPE TABLE OF w3mime,
|
lt_mime TYPE TABLE OF w3mime,
|
||||||
ls_key TYPE wwwdatatab,
|
ls_key TYPE wwwdatatab,
|
||||||
lv_errormessage TYPE string,
|
lv_errormessage TYPE string,
|
||||||
lv_filesize TYPE i,
|
lv_filesize TYPE i,
|
||||||
lv_filesizec TYPE c LENGTH 10.
|
lv_filesizec TYPE c LENGTH 10.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Read file into binary string
|
* Read file into binary string
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
|
|
||||||
ls_key-relid = 'MI'.
|
ls_key-relid = 'MI'.
|
||||||
ls_key-objid = iv_w3objid .
|
ls_key-objid = iv_w3objid .
|
||||||
|
|
||||||
CALL FUNCTION 'WWWDATA_IMPORT'
|
CALL FUNCTION 'WWWDATA_IMPORT'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
key = ls_key
|
key = ls_key
|
||||||
TABLES
|
TABLES
|
||||||
mime = lt_mime
|
mime = lt_mime
|
||||||
EXCEPTIONS
|
EXCEPTIONS
|
||||||
OTHERS = 1.
|
OTHERS = 1.
|
||||||
IF sy-subrc <> 0.
|
IF sy-subrc <> 0.
|
||||||
lv_errormessage = 'A problem occured when reading the MIME object'(004).
|
lv_errormessage = 'A problem occured when reading the MIME object'(004).
|
||||||
zcx_excel=>raise_text( lv_errormessage ).
|
zcx_excel=>raise_text( lv_errormessage ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
CALL FUNCTION 'WWWPARAMS_READ'
|
CALL FUNCTION 'WWWPARAMS_READ'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
relid = ls_key-relid
|
relid = ls_key-relid
|
||||||
objid = ls_key-objid
|
objid = ls_key-objid
|
||||||
name = 'filesize'
|
name = 'filesize'
|
||||||
IMPORTING
|
IMPORTING
|
||||||
value = lv_filesizec.
|
value = lv_filesizec.
|
||||||
|
|
||||||
lv_filesize = lv_filesizec.
|
lv_filesize = lv_filesizec.
|
||||||
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
|
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
input_length = lv_filesize
|
input_length = lv_filesize
|
||||||
IMPORTING
|
IMPORTING
|
||||||
buffer = lv_excel_data
|
buffer = lv_excel_data
|
||||||
TABLES
|
TABLES
|
||||||
binary_tab = lt_mime
|
binary_tab = lt_mime
|
||||||
EXCEPTIONS
|
EXCEPTIONS
|
||||||
failed = 1
|
failed = 1
|
||||||
OTHERS = 2.
|
OTHERS = 2.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Parse Excel data into ZCL_EXCEL object from binary string
|
* 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.
|
ENDFORM.
|
||||||
|
|
|
@ -327,55 +327,55 @@ FORM load_smw0
|
||||||
RAISING
|
RAISING
|
||||||
zcx_excel.
|
zcx_excel.
|
||||||
|
|
||||||
DATA: lv_excel_data TYPE xstring,
|
DATA: lv_excel_data TYPE xstring,
|
||||||
lt_mime TYPE TABLE OF w3mime,
|
lt_mime TYPE TABLE OF w3mime,
|
||||||
ls_key TYPE wwwdatatab,
|
ls_key TYPE wwwdatatab,
|
||||||
lv_errormessage TYPE string,
|
lv_errormessage TYPE string,
|
||||||
lv_filesize TYPE i,
|
lv_filesize TYPE i,
|
||||||
lv_filesizec TYPE c LENGTH 10.
|
lv_filesizec TYPE c LENGTH 10.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Read file into binary string
|
* Read file into binary string
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
|
|
||||||
ls_key-relid = 'MI'.
|
ls_key-relid = 'MI'.
|
||||||
ls_key-objid = iv_w3objid .
|
ls_key-objid = iv_w3objid .
|
||||||
|
|
||||||
CALL FUNCTION 'WWWDATA_IMPORT'
|
CALL FUNCTION 'WWWDATA_IMPORT'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
key = ls_key
|
key = ls_key
|
||||||
TABLES
|
TABLES
|
||||||
mime = lt_mime
|
mime = lt_mime
|
||||||
EXCEPTIONS
|
EXCEPTIONS
|
||||||
OTHERS = 1.
|
OTHERS = 1.
|
||||||
IF sy-subrc <> 0.
|
IF sy-subrc <> 0.
|
||||||
lv_errormessage = 'A problem occured when reading the MIME object'(004).
|
lv_errormessage = 'A problem occured when reading the MIME object'(004).
|
||||||
zcx_excel=>raise_text( lv_errormessage ).
|
zcx_excel=>raise_text( lv_errormessage ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
CALL FUNCTION 'WWWPARAMS_READ'
|
CALL FUNCTION 'WWWPARAMS_READ'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
relid = ls_key-relid
|
relid = ls_key-relid
|
||||||
objid = ls_key-objid
|
objid = ls_key-objid
|
||||||
name = 'filesize'
|
name = 'filesize'
|
||||||
IMPORTING
|
IMPORTING
|
||||||
value = lv_filesizec.
|
value = lv_filesizec.
|
||||||
|
|
||||||
lv_filesize = lv_filesizec.
|
lv_filesize = lv_filesizec.
|
||||||
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
|
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
input_length = lv_filesize
|
input_length = lv_filesize
|
||||||
IMPORTING
|
IMPORTING
|
||||||
buffer = lv_excel_data
|
buffer = lv_excel_data
|
||||||
TABLES
|
TABLES
|
||||||
binary_tab = lt_mime
|
binary_tab = lt_mime
|
||||||
EXCEPTIONS
|
EXCEPTIONS
|
||||||
failed = 1
|
failed = 1
|
||||||
OTHERS = 2.
|
OTHERS = 2.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Parse Excel data into ZCL_EXCEL object from binary string
|
* 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.
|
ENDFORM.
|
||||||
|
|
|
@ -147,8 +147,8 @@ CLASS zcl_excel DEFINITION
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!io_theme TYPE REF TO zcl_excel_theme .
|
!io_theme TYPE REF TO zcl_excel_theme .
|
||||||
METHODS fill_template
|
METHODS fill_template
|
||||||
importing
|
IMPORTING
|
||||||
!iv_data TYPE REF TO ZCL_EXCEL_TEMPLATE_DATA
|
!iv_data TYPE REF TO zcl_excel_template_data
|
||||||
RAISING
|
RAISING
|
||||||
zcx_excel .
|
zcx_excel .
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
|
|
|
@ -401,9 +401,9 @@ CLASS zcl_excel_autofilter IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD validate_area.
|
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,
|
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_row = worksheet->get_highest_row( ) .
|
||||||
l_col = worksheet->get_highest_column( ) .
|
l_col = worksheet->get_highest_column( ) .
|
||||||
|
|
|
@ -37,7 +37,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_COLLECTION IMPLEMENTATION.
|
CLASS zcl_excel_collection IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD add .
|
METHOD add .
|
||||||
|
|
|
@ -15,7 +15,7 @@ CLASS zcl_excel_collection_iterator DEFINITION
|
||||||
VALUE(object) TYPE REF TO object.
|
VALUE(object) TYPE REF TO object.
|
||||||
METHODS constructor
|
METHODS constructor
|
||||||
IMPORTING
|
IMPORTING
|
||||||
collection TYPE REF TO zCL_excel_COLLECTION.
|
collection TYPE REF TO zcl_excel_collection.
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
DATA index TYPE i VALUE 0.
|
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 .
|
METHOD constructor .
|
||||||
|
|
|
@ -221,7 +221,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_COMMON IMPLEMENTATION.
|
CLASS zcl_excel_common IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD calculate_cell_distance.
|
METHOD calculate_cell_distance.
|
||||||
|
@ -1082,32 +1082,32 @@ CLASS ZCL_EXCEL_COMMON IMPLEMENTATION.
|
||||||
lcv_digits TYPE string VALUE '0123456789',
|
lcv_digits TYPE string VALUE '0123456789',
|
||||||
lcv_cell_reference_error TYPE string VALUE '#REF!'.
|
lcv_cell_reference_error TYPE string VALUE '#REF!'.
|
||||||
|
|
||||||
DATA: lv_tcnt TYPE i, " Counter variable
|
DATA: lv_tcnt TYPE i, " Counter variable
|
||||||
lv_tlen TYPE i, " Temp variable length
|
lv_tlen TYPE i, " Temp variable length
|
||||||
lv_cnt TYPE i, " Counter variable
|
lv_cnt TYPE i, " Counter variable
|
||||||
lv_cnt2 TYPE i, " Counter variable
|
lv_cnt2 TYPE i, " Counter variable
|
||||||
lv_offset1 TYPE i, " Character offset
|
lv_offset1 TYPE i, " Character offset
|
||||||
lv_numchars TYPE i, " Number of characters counter
|
lv_numchars TYPE i, " Number of characters counter
|
||||||
lv_tchar(1) TYPE c, " Temp character
|
lv_tchar(1) TYPE c, " Temp character
|
||||||
lv_tchar2(1) TYPE c, " Temp character
|
lv_tchar2(1) TYPE c, " Temp character
|
||||||
lv_cur_form TYPE string, " Formula for current cell
|
lv_cur_form TYPE string, " Formula for current cell
|
||||||
lv_ref_cell_addr TYPE string, " Reference cell address
|
lv_ref_cell_addr TYPE string, " Reference cell address
|
||||||
lv_tcol1 TYPE string, " Temp column letter
|
lv_tcol1 TYPE string, " Temp column letter
|
||||||
lv_tcol2 TYPE string, " Temp column letter
|
lv_tcol2 TYPE string, " Temp column letter
|
||||||
lv_tcoln TYPE i, " Temp column number
|
lv_tcoln TYPE i, " Temp column number
|
||||||
lv_trow1 TYPE string, " Temp row number
|
lv_trow1 TYPE string, " Temp row number
|
||||||
lv_trow2 TYPE string, " Temp row number
|
lv_trow2 TYPE string, " Temp row number
|
||||||
lv_flen TYPE i, " Length of reference formula
|
lv_flen TYPE i, " Length of reference formula
|
||||||
lv_tlen2 TYPE i, " Temp variable length
|
lv_tlen2 TYPE i, " Temp variable length
|
||||||
lv_substr1 TYPE string, " Substring variable
|
lv_substr1 TYPE string, " Substring variable
|
||||||
lv_abscol TYPE string, " Absolute column symbol
|
lv_abscol TYPE string, " Absolute column symbol
|
||||||
lv_absrow TYPE string, " Absolute row symbol
|
lv_absrow TYPE string, " Absolute row symbol
|
||||||
lv_ref_formula TYPE string,
|
lv_ref_formula TYPE string,
|
||||||
lv_compare_1 TYPE string,
|
lv_compare_1 TYPE string,
|
||||||
lv_compare_2 TYPE string,
|
lv_compare_2 TYPE string,
|
||||||
lv_level TYPE i, " Level of groups [..[..]..] or {..}
|
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
|
* When copying a cell in EXCEL to another cell any inherent formulas
|
||||||
|
@ -1289,17 +1289,17 @@ CLASS ZCL_EXCEL_COMMON IMPLEMENTATION.
|
||||||
ENDDO.
|
ENDDO.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
" Is valid column & row ?
|
" Is valid column & row ?
|
||||||
IF lv_tcol1 IS NOT INITIAL AND lv_trow1 IS NOT INITIAL.
|
IF lv_tcol1 IS NOT INITIAL AND lv_trow1 IS NOT INITIAL.
|
||||||
" COLUMN + ROW
|
" COLUMN + ROW
|
||||||
CONCATENATE lv_tcol1 lv_trow1 INTO lv_compare_1.
|
CONCATENATE lv_tcol1 lv_trow1 INTO lv_compare_1.
|
||||||
" Original condensed string
|
" Original condensed string
|
||||||
lv_compare_2 = lv_ref_cell_addr.
|
lv_compare_2 = lv_ref_cell_addr.
|
||||||
CONDENSE lv_compare_2.
|
CONDENSE lv_compare_2.
|
||||||
IF lv_compare_1 <> lv_compare_2.
|
IF lv_compare_1 <> lv_compare_2.
|
||||||
CLEAR: lv_trow1, lv_tchar2.
|
CLEAR: lv_trow1, lv_tchar2.
|
||||||
|
ENDIF.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Check for invalid cell address
|
* Check for invalid cell address
|
||||||
|
|
|
@ -56,15 +56,15 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING
|
||||||
RAISING
|
RAISING
|
||||||
cx_static_check.
|
cx_static_check.
|
||||||
METHODS: calc_cell_dist_samecell 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_down1pl FOR TESTING RAISING cx_static_check,
|
||||||
calc_cell_dist_downsome 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_up1pl FOR TESTING RAISING cx_static_check,
|
||||||
calc_cell_dist_upsome 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_right1pl FOR TESTING RAISING cx_static_check,
|
||||||
calc_cell_dist_rightsome 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_left1pl FOR TESTING RAISING cx_static_check,
|
||||||
calc_cell_dist_leftsome 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_fullpack FOR TESTING RAISING cx_static_check.
|
||||||
METHODS macro_shift_formula
|
METHODS macro_shift_formula
|
||||||
IMPORTING
|
IMPORTING
|
||||||
iv_reference_formula TYPE clike
|
iv_reference_formula TYPE clike
|
||||||
|
@ -72,31 +72,31 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING
|
||||||
iv_shift_rows TYPE i
|
iv_shift_rows TYPE i
|
||||||
iv_expected TYPE string.
|
iv_expected TYPE string.
|
||||||
METHODS: shift_formula_basic FOR TESTING,
|
METHODS: shift_formula_basic FOR TESTING,
|
||||||
shift_formula_rightdown FOR TESTING,
|
shift_formula_rightdown FOR TESTING,
|
||||||
shift_formula_leftup FOR TESTING,
|
shift_formula_leftup FOR TESTING,
|
||||||
shift_formula_fixedcolrows FOR TESTING,
|
shift_formula_fixedcolrows FOR TESTING,
|
||||||
shift_formula_mixedfixedrows FOR TESTING,
|
shift_formula_mixedfixedrows FOR TESTING,
|
||||||
shift_formula_rangename FOR TESTING,
|
shift_formula_rangename FOR TESTING,
|
||||||
shift_formula_stringlitconc FOR TESTING,
|
shift_formula_stringlitconc FOR TESTING,
|
||||||
shift_formula_extref FOR TESTING,
|
shift_formula_extref FOR TESTING,
|
||||||
shift_formula_charblanks FOR TESTING,
|
shift_formula_charblanks FOR TESTING,
|
||||||
shift_formula_stringblanks FOR TESTING,
|
shift_formula_stringblanks FOR TESTING,
|
||||||
shift_formula_funcnoargs FOR TESTING,
|
shift_formula_funcnoargs FOR TESTING,
|
||||||
shift_formula_nocellref FOR TESTING,
|
shift_formula_nocellref FOR TESTING,
|
||||||
shift_formula_empty FOR TESTING,
|
shift_formula_empty FOR TESTING,
|
||||||
shift_formula_referr_colunder FOR TESTING,
|
shift_formula_referr_colunder FOR TESTING,
|
||||||
shift_formula_referr_rowunder FOR TESTING,
|
shift_formula_referr_rowunder FOR TESTING,
|
||||||
shift_formula_referr_rowcolund FOR TESTING,
|
shift_formula_referr_rowcolund FOR TESTING,
|
||||||
shift_formula_sheet_nodigit FOR TESTING,
|
shift_formula_sheet_nodigit FOR TESTING,
|
||||||
shift_formula_sheet_nodig FOR TESTING,
|
shift_formula_sheet_nodig FOR TESTING,
|
||||||
shift_formula_sheet_special FOR TESTING,
|
shift_formula_sheet_special FOR TESTING,
|
||||||
shift_formula_resp_blanks_1 FOR TESTING,
|
shift_formula_resp_blanks_1 FOR TESTING,
|
||||||
shift_formula_resp_blanks_2 FOR TESTING,
|
shift_formula_resp_blanks_2 FOR TESTING,
|
||||||
shift_formula_range FOR TESTING,
|
shift_formula_range FOR TESTING,
|
||||||
shift_formula_notcols FOR TESTING,
|
shift_formula_notcols FOR TESTING,
|
||||||
shift_formula_name FOR TESTING,
|
shift_formula_name FOR TESTING,
|
||||||
shift_formula_refcolumn1 FOR TESTING,
|
shift_formula_refcolumn1 FOR TESTING,
|
||||||
shift_formula_refcolumn2 FOR TESTING.
|
shift_formula_refcolumn2 FOR TESTING.
|
||||||
METHODS is_cell_in_range_ulc_in 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_lrc_in FOR TESTING.
|
||||||
METHODS is_cell_in_range_leftside_out 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.
|
METHOD shift_formula_sheet_nodigit.
|
||||||
|
|
||||||
" Sheet name not ending with digit
|
" Sheet name not ending with digit
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'Sheet!A1'
|
iv_reference_formula = 'Sheet!A1'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1416,7 +1416,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_sheet_nodig.
|
METHOD shift_formula_sheet_nodig.
|
||||||
|
|
||||||
" Sheet name ending with digit
|
" Sheet name ending with digit
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'Sheet2!A1'
|
iv_reference_formula = 'Sheet2!A1'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1427,7 +1427,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_sheet_special.
|
METHOD shift_formula_sheet_special.
|
||||||
|
|
||||||
" Sheet name with special characters
|
" Sheet name with special characters
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = |'Sheet name'!A1|
|
iv_reference_formula = |'Sheet name'!A1|
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1438,7 +1438,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_resp_blanks_1.
|
METHOD shift_formula_resp_blanks_1.
|
||||||
|
|
||||||
" Respecting blanks
|
" Respecting blanks
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'SUBTOTAL(109,Table1[SUM 1])'
|
iv_reference_formula = 'SUBTOTAL(109,Table1[SUM 1])'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1449,7 +1449,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_resp_blanks_2.
|
METHOD shift_formula_resp_blanks_2.
|
||||||
|
|
||||||
" Respecting blanks
|
" Respecting blanks
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'B4 & C4'
|
iv_reference_formula = 'B4 & C4'
|
||||||
iv_shift_cols = 0
|
iv_shift_cols = 0
|
||||||
|
@ -1460,7 +1460,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_range.
|
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(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'SUM(F_1,F_2)'
|
iv_reference_formula = 'SUM(F_1,F_2)'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1470,7 +1470,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD shift_formula_notcols.
|
METHOD shift_formula_notcols.
|
||||||
" RC are not columns
|
" RC are not columns
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'INDIRECT("RC[4]",FALSE)'
|
iv_reference_formula = 'INDIRECT("RC[4]",FALSE)'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1481,7 +1481,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_name.
|
METHOD shift_formula_name.
|
||||||
|
|
||||||
" A1 is a sheet name
|
" A1 is a sheet name
|
||||||
macro_shift_formula(
|
macro_shift_formula(
|
||||||
iv_reference_formula = |'A1'!$A$1|
|
iv_reference_formula = |'A1'!$A$1|
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1492,7 +1492,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_refcolumn1.
|
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(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'Tbl[[#This Row],[Air fare]]'
|
iv_reference_formula = 'Tbl[[#This Row],[Air fare]]'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
@ -1503,7 +1503,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD shift_formula_refcolumn2.
|
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(
|
macro_shift_formula(
|
||||||
iv_reference_formula = 'Tbl[[#This Row],[Air]]+A1'
|
iv_reference_formula = 'Tbl[[#This Row],[Air]]+A1'
|
||||||
iv_shift_cols = 1
|
iv_shift_cols = 1
|
||||||
|
|
|
@ -255,7 +255,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_CONVERTER IMPLEMENTATION.
|
CLASS zcl_excel_converter IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD ask_option.
|
METHOD ask_option.
|
||||||
|
|
|
@ -131,9 +131,9 @@ CLASS zcl_excel_drawing DEFINITION
|
||||||
DATA type TYPE zexcel_drawing_type VALUE type_image. "#EC NOTEXT . . . . . . . . . . . " .
|
DATA type TYPE zexcel_drawing_type VALUE type_image. "#EC NOTEXT . . . . . . . . . . . " .
|
||||||
DATA index TYPE string .
|
DATA index TYPE string .
|
||||||
DATA anchor TYPE zexcel_drawing_anchor VALUE anchor_one_cell. "#EC NOTEXT . . . . . . . . . . . " .
|
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_www TYPE c VALUE 1. "#EC NOTEXT
|
||||||
CONSTANTS c_media_source_xstring TYPE c VALUE 0. "#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_mime TYPE c VALUE 2. "#EC NOTEXT
|
||||||
DATA guid TYPE guid_16 .
|
DATA guid TYPE guid_16 .
|
||||||
DATA media TYPE xstring .
|
DATA media TYPE xstring .
|
||||||
DATA media_key_www TYPE wwwdatatab .
|
DATA media_key_www TYPE wwwdatatab .
|
||||||
|
|
|
@ -46,23 +46,23 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_FONT IMPLEMENTATION.
|
CLASS zcl_excel_font IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD calculate_text_width.
|
METHOD calculate_text_width.
|
||||||
|
|
||||||
CONSTANTS lc_excel_cell_padding TYPE float VALUE '0.75'.
|
CONSTANTS lc_excel_cell_padding TYPE float VALUE '0.75'.
|
||||||
|
|
||||||
DATA: ld_current_character TYPE c LENGTH 1,
|
DATA: ld_current_character TYPE c LENGTH 1,
|
||||||
lt_itcfc TYPE STANDARD TABLE OF itcfc,
|
lt_itcfc TYPE STANDARD TABLE OF itcfc,
|
||||||
ld_offset TYPE i,
|
ld_offset TYPE i,
|
||||||
ld_length TYPE i,
|
ld_length TYPE i,
|
||||||
ld_uccp TYPE i,
|
ld_uccp TYPE i,
|
||||||
ls_font_metric TYPE mty_s_font_metric,
|
ls_font_metric TYPE mty_s_font_metric,
|
||||||
ld_width_from_font_metrics TYPE i,
|
ld_width_from_font_metrics TYPE i,
|
||||||
ld_font_family TYPE itcfh-tdfamily,
|
ld_font_family TYPE itcfh-tdfamily,
|
||||||
lt_font_families LIKE STANDARD TABLE OF ld_font_family,
|
lt_font_families LIKE STANDARD TABLE OF ld_font_family,
|
||||||
ls_font_cache TYPE mty_s_font_cache.
|
ls_font_cache TYPE mty_s_font_cache.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <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_font_metric> TYPE mty_s_font_metric,
|
||||||
|
|
|
@ -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.
|
PRIVATE SECTION.
|
||||||
METHODS calculate FOR TESTING RAISING cx_static_check.
|
METHODS calculate FOR TESTING RAISING cx_static_check.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
CLASS ltcl_Test IMPLEMENTATION.
|
CLASS ltcl_test IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD calculate.
|
METHOD calculate.
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ CLASS zcl_excel_reader_2007 DEFINITION
|
||||||
*"* protected components of class ZCL_EXCEL_READER_2007
|
*"* protected components of class ZCL_EXCEL_READER_2007
|
||||||
*"* do not include other source files here!!!
|
*"* do not include other source files here!!!
|
||||||
BEGIN OF t_relationship,
|
BEGIN OF t_relationship,
|
||||||
id TYPE string,
|
id TYPE string,
|
||||||
type TYPE string,
|
type TYPE string,
|
||||||
target TYPE string,
|
target TYPE string,
|
||||||
targetmode TYPE string,
|
targetmode TYPE string,
|
||||||
worksheet TYPE REF TO zcl_excel_worksheet,
|
worksheet TYPE REF TO zcl_excel_worksheet,
|
||||||
sheetid TYPE string, "ins #235 - repeat rows/cols - needed to identify correct sheet
|
sheetid TYPE string, "ins #235 - repeat rows/cols - needed to identify correct sheet
|
||||||
localsheetid TYPE string,
|
localsheetid TYPE string,
|
||||||
END OF t_relationship .
|
END OF t_relationship .
|
||||||
TYPES:
|
TYPES:
|
||||||
|
@ -876,7 +876,7 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
lo_node_si TYPE REF TO if_ixml_element,
|
lo_node_si TYPE REF TO if_ixml_element,
|
||||||
lo_node_si_child 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_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,
|
lo_font TYPE REF TO zcl_excel_style_font,
|
||||||
ls_rtf TYPE zexcel_s_rtf,
|
ls_rtf TYPE zexcel_s_rtf,
|
||||||
lv_current_offset TYPE int2,
|
lv_current_offset TYPE int2,
|
||||||
|
@ -1528,96 +1528,96 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
lo_node_font = io_xml_element.
|
lo_node_font = io_xml_element.
|
||||||
|
|
||||||
CREATE OBJECT lo_font.
|
CREATE OBJECT lo_font.
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Bold
|
* Bold
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
IF lo_node_font->find_from_name( 'b' ) IS BOUND.
|
IF lo_node_font->find_from_name( 'b' ) IS BOUND.
|
||||||
lo_font->bold = abap_true.
|
lo_font->bold = abap_true.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Italic
|
* Italic
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
IF lo_node_font->find_from_name( 'i' ) IS BOUND.
|
IF lo_node_font->find_from_name( 'i' ) IS BOUND.
|
||||||
lo_font->italic = abap_true.
|
lo_font->italic = abap_true.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Underline
|
* Underline
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
lo_node2 = lo_node_font->find_from_name( 'u' ).
|
lo_node2 = lo_node_font->find_from_name( 'u' ).
|
||||||
IF lo_node2 IS BOUND.
|
IF lo_node2 IS BOUND.
|
||||||
lo_font->underline = abap_true.
|
lo_font->underline = abap_true.
|
||||||
lo_font->underline_mode = lo_node2->get_attribute( 'val' ).
|
lo_font->underline_mode = lo_node2->get_attribute( 'val' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* StrikeThrough
|
* StrikeThrough
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
IF lo_node_font->find_from_name( 'strike' ) IS BOUND.
|
IF lo_node_font->find_from_name( 'strike' ) IS BOUND.
|
||||||
lo_font->strikethrough = abap_true.
|
lo_font->strikethrough = abap_true.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Fontsize
|
* Fontsize
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
lo_node2 = lo_node_font->find_from_name( 'sz' ).
|
lo_node2 = lo_node_font->find_from_name( 'sz' ).
|
||||||
IF lo_node2 IS BOUND.
|
IF lo_node2 IS BOUND.
|
||||||
lo_font->size = lo_node2->get_attribute( 'val' ).
|
lo_font->size = lo_node2->get_attribute( 'val' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Fontname
|
* 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.
|
IF lo_node2 IS BOUND.
|
||||||
lo_font->name = lo_node2->get_attribute( 'val' ).
|
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.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Fontfamily
|
* Fontfamily
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
lo_node2 = lo_node_font->find_from_name( 'family' ).
|
lo_node2 = lo_node_font->find_from_name( 'family' ).
|
||||||
IF lo_node2 IS BOUND.
|
IF lo_node2 IS BOUND.
|
||||||
lo_font->family = lo_node2->get_attribute( 'val' ).
|
lo_font->family = lo_node2->get_attribute( 'val' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Fontscheme
|
* Fontscheme
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
lo_node2 = lo_node_font->find_from_name( 'scheme' ).
|
lo_node2 = lo_node_font->find_from_name( 'scheme' ).
|
||||||
IF lo_node2 IS BOUND.
|
IF lo_node2 IS BOUND.
|
||||||
lo_font->scheme = lo_node2->get_attribute( 'val' ).
|
lo_font->scheme = lo_node2->get_attribute( 'val' ).
|
||||||
ELSE.
|
ELSE.
|
||||||
CLEAR lo_font->scheme.
|
CLEAR lo_font->scheme.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
* Fontcolor
|
* Fontcolor
|
||||||
*--------------------------------------------------------------------*
|
*--------------------------------------------------------------------*
|
||||||
lo_node2 = lo_node_font->find_from_name( 'color' ).
|
lo_node2 = lo_node_font->find_from_name( 'color' ).
|
||||||
IF lo_node2 IS BOUND.
|
IF lo_node2 IS BOUND.
|
||||||
fill_struct_from_attributes( EXPORTING
|
fill_struct_from_attributes( EXPORTING
|
||||||
ip_element = lo_node2
|
ip_element = lo_node2
|
||||||
CHANGING
|
CHANGING
|
||||||
cp_structure = ls_color ).
|
cp_structure = ls_color ).
|
||||||
lo_font->color-rgb = ls_color-rgb.
|
lo_font->color-rgb = ls_color-rgb.
|
||||||
IF ls_color-indexed IS NOT INITIAL.
|
IF ls_color-indexed IS NOT INITIAL.
|
||||||
lo_font->color-indexed = ls_color-indexed.
|
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.
|
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.
|
ro_font = lo_font.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -3572,9 +3572,9 @@ CLASS zcl_excel_reader_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
DATA: lo_ixml_ignored_errors TYPE REF TO if_ixml_node_collection,
|
DATA: lo_ixml_ignored_errors TYPE REF TO if_ixml_node_collection,
|
||||||
lo_ixml_ignored_error TYPE REF TO if_ixml_element,
|
lo_ixml_ignored_error TYPE REF TO if_ixml_element,
|
||||||
lo_ixml_iterator TYPE REF TO if_ixml_node_iterator,
|
lo_ixml_iterator TYPE REF TO if_ixml_node_iterator,
|
||||||
ls_ignored_error TYPE zcl_excel_worksheet=>mty_s_ignored_errors,
|
ls_ignored_error TYPE zcl_excel_worksheet=>mty_s_ignored_errors,
|
||||||
lt_ignored_errors TYPE zcl_excel_worksheet=>mty_th_ignored_errors.
|
lt_ignored_errors TYPE zcl_excel_worksheet=>mty_th_ignored_errors.
|
||||||
|
|
||||||
DATA: BEGIN OF ls_raw_ignored_error,
|
DATA: BEGIN OF ls_raw_ignored_error,
|
||||||
sqref TYPE string,
|
sqref TYPE string,
|
||||||
|
|
|
@ -28,7 +28,7 @@ CLASS zcl_excel_reader_huge_file DEFINITION
|
||||||
BEGIN OF t_cell.
|
BEGIN OF t_cell.
|
||||||
INCLUDE TYPE t_cell_coord AS coord.
|
INCLUDE TYPE t_cell_coord AS coord.
|
||||||
INCLUDE TYPE t_cell_content AS content.
|
INCLUDE TYPE t_cell_content AS content.
|
||||||
TYPES: END OF t_cell .
|
TYPES: END OF t_cell .
|
||||||
|
|
||||||
INTERFACE if_sxml_node LOAD .
|
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
|
CONSTANTS c_end_of_stream TYPE if_sxml_node=>node_type VALUE if_sxml_node=>co_nt_final. "#EC NOTEXT
|
||||||
|
|
|
@ -1,133 +1,133 @@
|
||||||
*"* use this source file for your ABAP unit test classes
|
*"* use this source file for your ABAP unit test classes
|
||||||
class lcl_test definition deferred.
|
CLASS lcl_test DEFINITION DEFERRED.
|
||||||
class zcl_excel_reader_huge_file definition local friends lcl_test.
|
CLASS zcl_excel_reader_huge_file DEFINITION LOCAL FRIENDS lcl_test.
|
||||||
|
|
||||||
*
|
*
|
||||||
class lcl_test definition for testing
|
CLASS lcl_test DEFINITION FOR TESTING
|
||||||
risk level harmless
|
RISK LEVEL HARMLESS
|
||||||
duration short.
|
DURATION SHORT.
|
||||||
|
|
||||||
private section.
|
PRIVATE SECTION.
|
||||||
data:
|
DATA:
|
||||||
out type ref to zcl_excel_reader_huge_file, " object under test
|
out TYPE REF TO zcl_excel_reader_huge_file, " object under test
|
||||||
excel type ref to zcl_excel,
|
excel TYPE REF TO zcl_excel,
|
||||||
worksheet type ref to zcl_excel_worksheet.
|
worksheet TYPE REF TO zcl_excel_worksheet.
|
||||||
methods:
|
METHODS:
|
||||||
setup raising cx_static_check,
|
setup RAISING cx_static_check,
|
||||||
test_number for testing raising cx_static_check,
|
test_number FOR TESTING RAISING cx_static_check,
|
||||||
test_shared_string 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_shared_string_missing FOR TESTING RAISING cx_static_check,
|
||||||
test_inline_string 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_empty_cells FOR TESTING RAISING cx_static_check,
|
||||||
test_boolean for testing raising cx_static_check,
|
test_boolean FOR TESTING RAISING cx_static_check,
|
||||||
test_style for testing raising cx_static_check,
|
test_style FOR TESTING RAISING cx_static_check,
|
||||||
test_style_missing for testing raising cx_static_check,
|
test_style_missing FOR TESTING RAISING cx_static_check,
|
||||||
test_formula 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_read_shared_strings FOR TESTING RAISING cx_static_check,
|
||||||
test_shared_string_some_empty 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,
|
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,
|
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_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_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_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.
|
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.
|
METHOD test_number.
|
||||||
data lo_reader type ref to if_sxml_reader.
|
DATA lo_reader TYPE REF TO if_sxml_reader.
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="n"><v>17</v></c>`
|
`<c r="A1" t="n"><v>17</v></c>`
|
||||||
).
|
).
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
||||||
assert_value_equals( `17` ).
|
assert_value_equals( `17` ).
|
||||||
assert_datatype_equals( `n` ).
|
assert_datatype_equals( `n` ).
|
||||||
endmethod. "test_shared_string
|
ENDMETHOD. "test_shared_string
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_shared_string.
|
METHOD test_shared_string.
|
||||||
data lo_reader type ref to if_sxml_reader.
|
DATA lo_reader TYPE REF TO if_sxml_reader.
|
||||||
data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string.
|
DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string.
|
||||||
ls_shared_string-value = `Test1`.
|
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`.
|
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(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="s"><v>1</v></c>`
|
`<c r="A1" t="s"><v>1</v></c>`
|
||||||
).
|
).
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
||||||
assert_value_equals( `Test2` ).
|
assert_value_equals( `Test2` ).
|
||||||
assert_datatype_equals( `s` ).
|
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,
|
DATA: lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lo_ex type ref to lcx_not_found,
|
lo_ex TYPE REF TO lcx_not_found,
|
||||||
lv_text type string.
|
lv_text TYPE string.
|
||||||
data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string.
|
DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string.
|
||||||
ls_shared_string-value = `Test`.
|
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(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="s"><v>1</v></c>`
|
`<c r="A1" t="s"><v>1</v></c>`
|
||||||
).
|
).
|
||||||
|
|
||||||
try.
|
TRY.
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
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` ).
|
cl_abap_unit_assert=>fail( `Index to non-existent shared string should give an error` ).
|
||||||
catch lcx_not_found into lo_ex.
|
CATCH lcx_not_found INTO lo_ex.
|
||||||
lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger
|
lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger
|
||||||
endtry.
|
ENDTRY.
|
||||||
|
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
*
|
*
|
||||||
method test_inline_string.
|
METHOD test_inline_string.
|
||||||
data lo_reader type ref to if_sxml_reader.
|
DATA lo_reader TYPE REF TO if_sxml_reader.
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="inlineStr"><is><t>Alpha</t></is></c>`
|
`<c r="A1" t="inlineStr"><is><t>Alpha</t></is></c>`
|
||||||
).
|
).
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
||||||
assert_value_equals( `Alpha` ).
|
assert_value_equals( `Alpha` ).
|
||||||
assert_datatype_equals( `inlineStr` ).
|
assert_datatype_equals( `inlineStr` ).
|
||||||
endmethod. "test_inline_string
|
ENDMETHOD. "test_inline_string
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_boolean.
|
METHOD test_boolean.
|
||||||
data lo_reader type ref to if_sxml_reader.
|
DATA lo_reader TYPE REF TO if_sxml_reader.
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="b"><v>1</v></c>`
|
`<c r="A1" t="b"><v>1</v></c>`
|
||||||
).
|
).
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
||||||
assert_value_equals( `1` ).
|
assert_value_equals( `1` ).
|
||||||
assert_datatype_equals( `b` ).
|
assert_datatype_equals( `b` ).
|
||||||
endmethod. "test_boolean
|
ENDMETHOD. "test_boolean
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_formula.
|
METHOD test_formula.
|
||||||
data lo_reader type ref to if_sxml_reader.
|
DATA lo_reader TYPE REF TO if_sxml_reader.
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="n"><f>A2*A2</f></c>`
|
`<c r="A1" t="n"><f>A2*A2</f></c>`
|
||||||
).
|
).
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
||||||
assert_formula_equals( `A2*A2` ).
|
assert_formula_equals( `A2*A2` ).
|
||||||
assert_datatype_equals( `n` ).
|
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
|
* There is no need to store an empty cell in the ABAP worksheet structure
|
||||||
|
|
||||||
data: lo_reader type ref to if_sxml_reader.
|
DATA: lo_reader TYPE REF TO if_sxml_reader.
|
||||||
data: ls_shared_string type zcl_excel_reader_huge_file=>t_shared_string.
|
DATA: ls_shared_string TYPE zcl_excel_reader_huge_file=>t_shared_string.
|
||||||
ls_shared_string-value = ``.
|
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`.
|
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(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="s"><v>0</v></c>` &
|
`<c r="A1" t="s"><v>0</v></c>` &
|
||||||
`<c r="A2" t="inlineStr"><is><t></t></is></c>` &
|
`<c r="A2" t="inlineStr"><is><t></t></is></c>` &
|
||||||
|
@ -140,17 +140,17 @@ class lcl_test implementation.
|
||||||
assert_value_equals( iv_row = 2 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` ).
|
assert_value_equals( iv_row = 3 iv_col = 1 iv_value = `t` ).
|
||||||
|
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_style.
|
METHOD test_style.
|
||||||
data:
|
DATA:
|
||||||
lo_reader type ref to if_sxml_reader,
|
lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lo_style type ref to zcl_excel_style,
|
lo_style TYPE REF TO zcl_excel_style,
|
||||||
lv_guid type ZEXCEL_CELL_STYLE.
|
lv_guid TYPE zexcel_cell_style.
|
||||||
create object lo_style.
|
CREATE OBJECT lo_style.
|
||||||
append lo_style to out->styles.
|
APPEND lo_style TO out->styles.
|
||||||
lv_guid = lo_style->get_guid( ).
|
lv_guid = lo_style->get_guid( ).
|
||||||
|
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" s="0"><v>18</v></c>`
|
`<c r="A1" s="0"><v>18</v></c>`
|
||||||
|
@ -159,173 +159,173 @@ class lcl_test implementation.
|
||||||
|
|
||||||
assert_style_equals( lv_guid ).
|
assert_style_equals( lv_guid ).
|
||||||
|
|
||||||
endmethod. "test_style
|
ENDMETHOD. "test_style
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_style_missing.
|
METHOD test_style_missing.
|
||||||
|
|
||||||
data:
|
DATA:
|
||||||
lo_reader type ref to if_sxml_reader,
|
lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lo_ex type ref to lcx_not_found,
|
lo_ex TYPE REF TO lcx_not_found,
|
||||||
lv_text type string.
|
lv_text TYPE string.
|
||||||
|
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" s="0"><v>18</v></c>`
|
`<c r="A1" s="0"><v>18</v></c>`
|
||||||
).
|
).
|
||||||
|
|
||||||
try.
|
TRY.
|
||||||
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
|
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` ).
|
cl_abap_unit_assert=>fail( `Reference to non-existent style should throw an lcx_not_found exception` ).
|
||||||
catch lcx_not_found into lo_ex.
|
CATCH lcx_not_found INTO lo_ex.
|
||||||
lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger
|
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.
|
METHOD test_read_shared_strings.
|
||||||
data: lo_c2x type ref to cl_abap_conv_out_ce,
|
DATA: lo_c2x TYPE REF TO cl_abap_conv_out_ce,
|
||||||
lv_xstring type xstring,
|
lv_xstring TYPE xstring,
|
||||||
lo_reader type ref to if_sxml_reader,
|
lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lt_act type stringtab,
|
lt_act TYPE stringtab,
|
||||||
lt_exp type stringtab.
|
lt_exp TYPE stringtab.
|
||||||
|
|
||||||
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
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>`
|
lo_c2x->convert( EXPORTING data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
||||||
importing buffer = lv_xstring ).
|
IMPORTING buffer = lv_xstring ).
|
||||||
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
||||||
append :
|
APPEND :
|
||||||
`` to lt_exp,
|
`` TO lt_exp,
|
||||||
`Alpha` to lt_exp,
|
`Alpha` TO lt_exp,
|
||||||
`Bravo` to lt_exp.
|
`Bravo` TO lt_exp.
|
||||||
|
|
||||||
lt_act = out->read_shared_strings( lo_reader ).
|
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 ).
|
exp = lt_exp ).
|
||||||
|
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_shared_string_some_empty.
|
METHOD test_shared_string_some_empty.
|
||||||
data: lo_reader type ref to if_sxml_reader,
|
DATA: lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lt_act type stringtab,
|
lt_act TYPE stringtab,
|
||||||
lt_exp type stringtab.
|
lt_exp TYPE stringtab.
|
||||||
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to(
|
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to(
|
||||||
`<sst><si><t/></si>` &
|
`<sst><si><t/></si>` &
|
||||||
`<si><t>Alpha</t></si>` &
|
`<si><t>Alpha</t></si>` &
|
||||||
`<si><t/></si>` &
|
`<si><t/></si>` &
|
||||||
`<si><t>Bravo</t></si></sst>`
|
`<si><t>Bravo</t></si></sst>`
|
||||||
) ).
|
) ).
|
||||||
append :
|
APPEND :
|
||||||
`` to lt_exp,
|
`` TO lt_exp,
|
||||||
`Alpha` to lt_exp,
|
`Alpha` TO lt_exp,
|
||||||
`` to lt_exp,
|
`` TO lt_exp,
|
||||||
`Bravo` to lt_exp.
|
`Bravo` TO lt_exp.
|
||||||
|
|
||||||
lt_act = out->read_shared_strings( lo_reader ).
|
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 ).
|
exp = lt_exp ).
|
||||||
|
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_skip_to_inexistent.
|
METHOD test_skip_to_inexistent.
|
||||||
data: lo_c2x type ref to cl_abap_conv_out_ce,
|
DATA: lo_c2x TYPE REF TO cl_abap_conv_out_ce,
|
||||||
lv_xstring type xstring,
|
lv_xstring TYPE xstring,
|
||||||
lo_reader type ref to if_sxml_reader,
|
lo_reader TYPE REF TO if_sxml_reader,
|
||||||
lo_ex type ref to lcx_not_found,
|
lo_ex TYPE REF TO lcx_not_found,
|
||||||
lv_text type string.
|
lv_text TYPE string.
|
||||||
|
|
||||||
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
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>`
|
lo_c2x->convert( EXPORTING data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
||||||
importing buffer = lv_xstring ).
|
IMPORTING buffer = lv_xstring ).
|
||||||
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
||||||
try.
|
TRY.
|
||||||
out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ).
|
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` ).
|
cl_abap_unit_assert=>fail( `Skipping to non-existing element must raise lcx_not_found exception` ).
|
||||||
catch lcx_not_found into lo_ex.
|
CATCH lcx_not_found INTO lo_ex.
|
||||||
lv_text = lo_ex->get_text( ). " May inspect exception text in debugger
|
lv_text = lo_ex->get_text( ). " May inspect exception text in debugger
|
||||||
endtry.
|
ENDTRY.
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
|
|
||||||
*
|
*
|
||||||
method get_reader.
|
METHOD get_reader.
|
||||||
data: lv_full type string,
|
DATA: lv_full TYPE string,
|
||||||
lo_c2x type ref to cl_abap_conv_out_ce,
|
lo_c2x TYPE REF TO cl_abap_conv_out_ce,
|
||||||
lv_xstring type xstring.
|
lv_xstring TYPE xstring.
|
||||||
concatenate `<root><sheetData><row>` iv_xml `</row></sheetData></root>` into lv_full.
|
CONCATENATE `<root><sheetData><row>` iv_xml `</row></sheetData></root>` INTO lv_full.
|
||||||
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
||||||
lo_c2x->convert( exporting data = lv_full
|
lo_c2x->convert( EXPORTING data = lv_full
|
||||||
importing buffer = lv_xstring ).
|
IMPORTING buffer = lv_xstring ).
|
||||||
eo_reader = cl_sxml_string_reader=>create( 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: <ls_cell_data> type zexcel_s_cell_data,
|
FIELD-SYMBOLS: <ls_cell_data> TYPE zexcel_s_cell_data,
|
||||||
<lv_value> type string.
|
<lv_value> TYPE string.
|
||||||
|
|
||||||
read table worksheet->sheet_content assigning <ls_cell_data>
|
READ TABLE worksheet->sheet_content ASSIGNING <ls_cell_data>
|
||||||
with table key cell_row = iv_row cell_column = iv_col.
|
WITH TABLE KEY cell_row = iv_row cell_column = iv_col.
|
||||||
if sy-subrc eq 0.
|
IF sy-subrc EQ 0.
|
||||||
assign <ls_cell_data>-cell_value to <lv_value>.
|
ASSIGN <ls_cell_data>-cell_value TO <lv_value>.
|
||||||
else.
|
ELSE.
|
||||||
assign lc_empty_string to <lv_value>.
|
ASSIGN lc_empty_string TO <lv_value>.
|
||||||
endif.
|
ENDIF.
|
||||||
|
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_equals( act = <lv_value>
|
cl_abap_unit_assert=>assert_equals( act = <lv_value>
|
||||||
exp = iv_value ).
|
exp = iv_value ).
|
||||||
|
|
||||||
endmethod. "assert_value_equals
|
ENDMETHOD. "assert_value_equals
|
||||||
**
|
**
|
||||||
method assert_formula_equals.
|
METHOD assert_formula_equals.
|
||||||
|
|
||||||
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
|
FIELD-SYMBOLS: <ls_cell_data> TYPE zexcel_s_cell_data.
|
||||||
|
|
||||||
read table worksheet->sheet_content assigning <ls_cell_data>
|
READ TABLE worksheet->sheet_content ASSIGNING <ls_cell_data>
|
||||||
with table key cell_row = iv_row cell_column = iv_col.
|
WITH TABLE KEY cell_row = iv_row cell_column = iv_col.
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ).
|
cl_abap_unit_assert=>assert_subrc( sy-subrc ).
|
||||||
|
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_equals( act = <ls_cell_data>-cell_formula
|
cl_abap_unit_assert=>assert_equals( act = <ls_cell_data>-cell_formula
|
||||||
exp = iv_formula ).
|
exp = iv_formula ).
|
||||||
|
|
||||||
endmethod. "assert_formula_equals
|
ENDMETHOD. "assert_formula_equals
|
||||||
*
|
*
|
||||||
method assert_style_equals.
|
METHOD assert_style_equals.
|
||||||
|
|
||||||
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
|
FIELD-SYMBOLS: <ls_cell_data> TYPE zexcel_s_cell_data.
|
||||||
|
|
||||||
read table worksheet->sheet_content assigning <ls_cell_data>
|
READ TABLE worksheet->sheet_content ASSIGNING <ls_cell_data>
|
||||||
with table key cell_row = iv_row cell_column = iv_col.
|
WITH TABLE KEY cell_row = iv_row cell_column = iv_col.
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ).
|
cl_abap_unit_assert=>assert_subrc( sy-subrc ).
|
||||||
|
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_equals( act = <ls_cell_data>-cell_style
|
cl_abap_unit_assert=>assert_equals( act = <ls_cell_data>-cell_style
|
||||||
exp = iv_style ).
|
exp = iv_style ).
|
||||||
|
|
||||||
endmethod.
|
ENDMETHOD.
|
||||||
*
|
*
|
||||||
method assert_datatype_equals.
|
METHOD assert_datatype_equals.
|
||||||
|
|
||||||
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
|
FIELD-SYMBOLS: <ls_cell_data> TYPE zexcel_s_cell_data.
|
||||||
|
|
||||||
read table worksheet->sheet_content assigning <ls_cell_data>
|
READ TABLE worksheet->sheet_content ASSIGNING <ls_cell_data>
|
||||||
with table key cell_row = iv_row cell_column = iv_col.
|
WITH TABLE KEY cell_row = iv_row cell_column = iv_col.
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_subrc( sy-subrc ).
|
cl_abap_unit_assert=>assert_subrc( sy-subrc ).
|
||||||
|
|
||||||
CL_ABAP_UNIT_ASSERT=>assert_equals( act = <ls_cell_data>-data_type
|
cl_abap_unit_assert=>assert_equals( act = <ls_cell_data>-data_type
|
||||||
exp = iv_datatype ).
|
exp = iv_datatype ).
|
||||||
|
|
||||||
endmethod. "assert_datatype_equals
|
ENDMETHOD. "assert_datatype_equals
|
||||||
method setup.
|
METHOD setup.
|
||||||
create object out.
|
CREATE OBJECT out.
|
||||||
create object excel.
|
CREATE OBJECT excel.
|
||||||
create object worksheet
|
CREATE OBJECT worksheet
|
||||||
exporting
|
EXPORTING
|
||||||
ip_excel = excel.
|
ip_excel = excel.
|
||||||
endmethod. "setup
|
ENDMETHOD. "setup
|
||||||
endclass. "lcl_test IMPLEMENTATION
|
ENDCLASS. "lcl_test IMPLEMENTATION
|
||||||
|
|
|
@ -57,7 +57,7 @@ CLASS zcl_excel_style_color DEFINITION
|
||||||
|
|
||||||
*"* private components of class ZCL_EXCEL_STYLE_COLOR
|
*"* private components of class ZCL_EXCEL_STYLE_COLOR
|
||||||
*"* do not include other source files here!!!
|
*"* 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.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ CLASS zcl_excel_style_number_format DEFINITION
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
CLASS-METHODS add_format
|
CLASS-METHODS add_format
|
||||||
IMPORTING
|
IMPORTING
|
||||||
id TYPE string
|
id TYPE string
|
||||||
code TYPE zexcel_number_format.
|
code TYPE zexcel_number_format.
|
||||||
*"* private components of class ZCL_EXCEL_STYLE_NUMBER_FORMAT
|
*"* private components of class ZCL_EXCEL_STYLE_NUMBER_FORMAT
|
||||||
*"* do not include other source files here!!!
|
*"* do not include other source files here!!!
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
|
@ -725,7 +725,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_WORKSHEET IMPLEMENTATION.
|
CLASS zcl_excel_worksheet IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD add_comment.
|
METHOD add_comment.
|
||||||
|
|
|
@ -79,9 +79,9 @@ CLASS lcl_excel_worksheet_test IMPLEMENTATION.
|
||||||
CREATE OBJECT lo_excel.
|
CREATE OBJECT lo_excel.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
CREATE OBJECT f_cut
|
CREATE OBJECT f_cut
|
||||||
EXPORTING
|
EXPORTING
|
||||||
ip_excel = lo_excel.
|
ip_excel = lo_excel.
|
||||||
CATCH zcx_excel.
|
CATCH zcx_excel.
|
||||||
cl_abap_unit_assert=>fail( 'Could not create instance' ).
|
cl_abap_unit_assert=>fail( 'Could not create instance' ).
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
|
@ -251,11 +251,11 @@ CLASS zcl_excel_writer_2007 DEFINITION
|
||||||
|
|
||||||
METHODS add_1_val_child_node
|
METHODS add_1_val_child_node
|
||||||
IMPORTING
|
IMPORTING
|
||||||
io_document TYPE REF TO if_ixml_document
|
io_document TYPE REF TO if_ixml_document
|
||||||
io_parent TYPE REF TO if_ixml_element
|
io_parent TYPE REF TO if_ixml_element
|
||||||
iv_elem_name TYPE string
|
iv_elem_name TYPE string
|
||||||
iv_attr_name TYPE string
|
iv_attr_name TYPE string
|
||||||
iv_attr_value TYPE string.
|
iv_attr_value TYPE string.
|
||||||
METHODS flag2bool
|
METHODS flag2bool
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!ip_flag TYPE flag
|
!ip_flag TYPE flag
|
||||||
|
@ -274,15 +274,15 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD add_1_val_child_node.
|
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
|
lo_child = io_document->create_simple_element( name = iv_elem_name
|
||||||
parent = io_document ).
|
parent = io_document ).
|
||||||
IF iv_attr_name IS NOT INITIAL.
|
IF iv_attr_name IS NOT INITIAL.
|
||||||
lo_child->set_attribute_ns( name = iv_attr_name
|
lo_child->set_attribute_ns( name = iv_attr_name
|
||||||
value = iv_attr_value ).
|
value = iv_attr_value ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
io_parent->append_child( new_child = lo_child ).
|
io_parent->append_child( new_child = lo_child ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -3650,13 +3650,13 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
lo_element = lo_document->create_simple_element( name = lc_xml_node_si
|
lo_element = lo_document->create_simple_element( name = lc_xml_node_si
|
||||||
parent = lo_document ).
|
parent = lo_document ).
|
||||||
IF <fs_sheet_string>-rtf_tab IS INITIAL.
|
IF <fs_sheet_string>-rtf_tab IS INITIAL.
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t
|
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t
|
||||||
parent = lo_document ).
|
parent = lo_document ).
|
||||||
IF boolc( contains( val = <fs_sheet_string>-string_value start = ` ` ) ) = abap_true
|
IF boolc( contains( val = <fs_sheet_string>-string_value start = ` ` ) ) = abap_true
|
||||||
OR boolc( contains( val = <fs_sheet_string>-string_value end = ` ` ) ) = abap_true.
|
OR boolc( contains( val = <fs_sheet_string>-string_value end = ` ` ) ) = abap_true.
|
||||||
lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ).
|
lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
lo_sub_element->set_value( value = <fs_sheet_string>-string_value ).
|
lo_sub_element->set_value( value = <fs_sheet_string>-string_value ).
|
||||||
ELSE.
|
ELSE.
|
||||||
LOOP AT <fs_sheet_string>-rtf_tab ASSIGNING <fs_rtf>.
|
LOOP AT <fs_sheet_string>-rtf_tab ASSIGNING <fs_rtf>.
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_r
|
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_priority TYPE string VALUE 'priority',
|
||||||
lc_xml_attr_operator TYPE string VALUE 'operator',
|
lc_xml_attr_operator TYPE string VALUE 'operator',
|
||||||
lc_xml_attr_text TYPE string VALUE 'text',
|
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_allowblank TYPE string VALUE 'allowBlank',
|
||||||
lc_xml_attr_showinputmessage TYPE string VALUE 'showInputMessage',
|
lc_xml_attr_showinputmessage TYPE string VALUE 'showInputMessage',
|
||||||
lc_xml_attr_showerrormessage TYPE string VALUE 'showErrorMessage',
|
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.
|
lv_value = lo_style_cond->mode_textfunction-textfunction.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ELSE.
|
ELSE.
|
||||||
lv_value = lo_style_cond->rule.
|
lv_value = lo_style_cond->rule.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
lo_element_2->set_attribute_ns( name = lc_xml_attr_type
|
lo_element_2->set_attribute_ns( name = lc_xml_attr_type
|
||||||
value = lv_value ).
|
value = lv_value ).
|
||||||
|
@ -5536,7 +5536,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
io_element_root->append_child( lo_element ).
|
io_element_root->append_child( lo_element ).
|
||||||
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
METHOD create_xl_sheet_column_formula.
|
METHOD create_xl_sheet_column_formula.
|
||||||
|
@ -7276,16 +7276,16 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD create_xl_styles_font_node.
|
METHOD create_xl_styles_font_node.
|
||||||
|
|
||||||
CONSTANTS: lc_xml_node_b TYPE string VALUE 'b', "bold
|
CONSTANTS: lc_xml_node_b TYPE string VALUE 'b', "bold
|
||||||
lc_xml_node_i TYPE string VALUE 'i', "italic
|
lc_xml_node_i TYPE string VALUE 'i', "italic
|
||||||
lc_xml_node_u TYPE string VALUE 'u', "underline
|
lc_xml_node_u TYPE string VALUE 'u', "underline
|
||||||
lc_xml_node_strike TYPE string VALUE 'strike', "strikethrough
|
lc_xml_node_strike TYPE string VALUE 'strike', "strikethrough
|
||||||
lc_xml_node_sz TYPE string VALUE 'sz',
|
lc_xml_node_sz TYPE string VALUE 'sz',
|
||||||
lc_xml_node_name TYPE string VALUE 'name',
|
lc_xml_node_name TYPE string VALUE 'name',
|
||||||
lc_xml_node_rfont TYPE string VALUE 'rFont',
|
lc_xml_node_rfont TYPE string VALUE 'rFont',
|
||||||
lc_xml_node_family TYPE string VALUE 'family',
|
lc_xml_node_family TYPE string VALUE 'family',
|
||||||
lc_xml_node_scheme TYPE string VALUE 'scheme',
|
lc_xml_node_scheme TYPE string VALUE 'scheme',
|
||||||
lc_xml_attr_val TYPE string VALUE 'val'.
|
lc_xml_attr_val TYPE string VALUE 'val'.
|
||||||
|
|
||||||
DATA: lo_document TYPE REF TO if_ixml_document,
|
DATA: lo_document TYPE REF TO if_ixml_document,
|
||||||
lo_element_font TYPE REF TO if_ixml_element,
|
lo_element_font TYPE REF TO if_ixml_element,
|
||||||
|
@ -7297,74 +7297,74 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
||||||
lo_element_font = io_parent.
|
lo_element_font = io_parent.
|
||||||
ls_font = is_font.
|
ls_font = is_font.
|
||||||
|
|
||||||
IF ls_font-bold EQ abap_true.
|
IF ls_font-bold EQ abap_true.
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_b
|
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 ).
|
parent = lo_document ).
|
||||||
lv_value = ls_font-size.
|
lo_element_font->append_child( new_child = lo_sub_element ).
|
||||||
SHIFT lv_value RIGHT DELETING TRAILING space.
|
ENDIF.
|
||||||
SHIFT lv_value LEFT DELETING LEADING space.
|
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
|
lo_sub_element->set_attribute_ns( name = lc_xml_attr_val
|
||||||
value = lv_value ).
|
value = lv_value ).
|
||||||
lo_element_font->append_child( new_child = lo_sub_element ).
|
lo_element_font->append_child( new_child = lo_sub_element ).
|
||||||
"color
|
ENDIF.
|
||||||
create_xl_styles_color_node(
|
IF ls_font-strikethrough EQ abap_true.
|
||||||
io_document = lo_document
|
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_strike
|
||||||
io_parent = lo_element_font
|
parent = lo_document ).
|
||||||
is_color = ls_font-color ).
|
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
|
"name
|
||||||
IF iv_use_rtf = abap_false.
|
IF iv_use_rtf = abap_false.
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_name
|
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_name
|
||||||
parent = lo_document ).
|
parent = lo_document ).
|
||||||
ELSE.
|
ELSE.
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_rfont
|
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_rfont
|
||||||
parent = lo_document ).
|
parent = lo_document ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
lv_value = ls_font-name.
|
lv_value = ls_font-name.
|
||||||
lo_sub_element->set_attribute_ns( name = lc_xml_attr_val
|
lo_sub_element->set_attribute_ns( name = lc_xml_attr_val
|
||||||
value = lv_value ).
|
value = lv_value ).
|
||||||
lo_element_font->append_child( new_child = lo_sub_element ).
|
lo_element_font->append_child( new_child = lo_sub_element ).
|
||||||
"family
|
"family
|
||||||
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_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 ).
|
parent = lo_document ).
|
||||||
lv_value = ls_font-family.
|
lv_value = ls_font-scheme.
|
||||||
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
|
lo_sub_element->set_attribute_ns( name = lc_xml_attr_val
|
||||||
value = lv_value ).
|
value = lv_value ).
|
||||||
lo_element_font->append_child( new_child = lo_sub_element ).
|
lo_element_font->append_child( new_child = lo_sub_element ).
|
||||||
"scheme
|
ENDIF.
|
||||||
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.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
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.
|
* READ TABLE shared_strings INTO ls_shared_string WITH KEY string_value = ip_cell_value BINARY SEARCH.
|
||||||
IF it_rtf IS INITIAL.
|
IF it_rtf IS INITIAL.
|
||||||
READ TABLE shared_strings INTO ls_shared_string WITH TABLE KEY string_value = ip_cell_value.
|
READ TABLE shared_strings INTO ls_shared_string WITH TABLE KEY string_value = ip_cell_value.
|
||||||
ep_index = ls_shared_string-string_no.
|
ep_index = ls_shared_string-string_no.
|
||||||
ELSE.
|
ELSE.
|
||||||
LOOP AT shared_strings INTO ls_shared_string WHERE string_value = ip_cell_value
|
LOOP AT shared_strings INTO ls_shared_string WHERE string_value = ip_cell_value
|
||||||
AND rtf_tab = it_rtf.
|
AND rtf_tab = it_rtf.
|
||||||
|
|
|
@ -53,7 +53,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_EXCEL_WRITER_CSV IMPLEMENTATION.
|
CLASS zcl_excel_writer_csv IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD create.
|
METHOD create.
|
||||||
|
|
|
@ -69,7 +69,7 @@ CLASS zcl_excel_writer_huge_file IMPLEMENTATION.
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* STEP 0: Build Regex for invalid characters
|
* 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.
|
CASE cl_abap_char_utilities=>charsize.
|
||||||
WHEN 1.lv_last_allowed_char = cl_abap_conv_in_ce=>uccpi( 255 ). " FF in non-Unicode
|
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
|
WHEN 2.lv_last_allowed_char = cl_abap_conv_in_ce=>uccpi( 65533 )." FFFD in Unicode
|
||||||
|
|
Loading…
Reference in New Issue
Block a user