mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-04 20:28:22 +08:00
* fix #844 to remove all macros * abaplint.json avoid_use/define false -> true Co-authored-by: sandraros <sandra.rossi@gmail.com> Co-authored-by: Abo <andrea@borgia.bo.it>
This commit is contained in:
parent
dc3962a402
commit
3b2423ea29
|
@ -75,7 +75,7 @@
|
|||
"allowed_object_types": false,
|
||||
"ambiguous_statement": false,
|
||||
"avoid_use": {
|
||||
"define": false,
|
||||
"define": true,
|
||||
"describeLines": false,
|
||||
"statics": false,
|
||||
"defaultKey": false,
|
||||
|
|
|
@ -8,16 +8,37 @@
|
|||
|
||||
REPORT zdemo_excel27.
|
||||
|
||||
CLASS lcl_app DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
METHODS main.
|
||||
PRIVATE SECTION.
|
||||
METHODS conditional_formatting_cellis
|
||||
IMPORTING
|
||||
column TYPE simple
|
||||
row TYPE zexcel_cell_row
|
||||
rule TYPE zexcel_condition_rule
|
||||
op TYPE zexcel_condition_operator
|
||||
f TYPE zexcel_style_formula
|
||||
f2 TYPE zexcel_style_formula
|
||||
numfmt TYPE string.
|
||||
METHODS conditional_formatting_textfun
|
||||
IMPORTING
|
||||
column TYPE simple
|
||||
row TYPE zexcel_cell_row
|
||||
txtfun TYPE zcl_excel_style_cond=>tv_textfunction
|
||||
text TYPE string
|
||||
numfmt TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
CONSTANTS: c_fish TYPE string VALUE 'Fish'.
|
||||
|
||||
DATA: lo_app TYPE REF TO lcl_app.
|
||||
DATA: lo_excel TYPE REF TO zcl_excel,
|
||||
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||
lo_range TYPE REF TO zcl_excel_range,
|
||||
lo_data_validation TYPE REF TO zcl_excel_data_validation,
|
||||
lo_style_cond TYPE REF TO zcl_excel_style_cond,
|
||||
lo_style_1 TYPE REF TO zcl_excel_style,
|
||||
lo_style_2 TYPE REF TO zcl_excel_style,
|
||||
lo_style TYPE REF TO zcl_excel_style,
|
||||
lv_style_1_guid TYPE zexcel_cell_style,
|
||||
lv_style_2_guid TYPE zexcel_cell_style,
|
||||
lv_style_guid TYPE zexcel_cell_style,
|
||||
|
@ -32,8 +53,18 @@ INCLUDE zdemo_excel_outputopt_incl.
|
|||
|
||||
|
||||
START-OF-SELECTION.
|
||||
CREATE OBJECT lo_app.
|
||||
lo_app->main( ).
|
||||
|
||||
|
||||
CLASS lcl_app IMPLEMENTATION.
|
||||
|
||||
METHOD main.
|
||||
|
||||
DATA:
|
||||
lo_style_cond TYPE REF TO zcl_excel_style_cond,
|
||||
lo_style TYPE REF TO zcl_excel_style.
|
||||
|
||||
" Creates active sheet
|
||||
CREATE OBJECT lo_excel.
|
||||
|
||||
|
@ -101,65 +132,84 @@ START-OF-SELECTION.
|
|||
ip_stop_row = 2 ).
|
||||
|
||||
" Conditional formatting for all operators
|
||||
DEFINE conditional_formatting_cellis.
|
||||
conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ).
|
||||
conditional_formatting_cellis( column = 'C' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_equal f = '="Anchovy"' f2 = '' numfmt = 'equal to Anchovy' ).
|
||||
conditional_formatting_cellis( column = 'D' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_notequal f = '="Anchovy"' f2 = '' numfmt = 'not equal to Anchovy' ).
|
||||
conditional_formatting_cellis( column = 'E' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_between f = '="B"' f2 = '="CC"' numfmt = 'between B and CC' ).
|
||||
conditional_formatting_cellis( column = 'F' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthan f = '="Catfish"' f2 = '' numfmt = 'greater than Catfish' ).
|
||||
conditional_formatting_cellis( column = 'G' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_greaterthanorequal f = '="Catfish"' f2 = '' numfmt = 'greater than or equal to Catfish' ).
|
||||
conditional_formatting_cellis( column = 'H' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthan f = '="Catfish"' f2 = '' numfmt = 'less than Catfish' ).
|
||||
conditional_formatting_cellis( column = 'I' row = 4 rule = zcl_excel_style_cond=>c_rule_cellis op = zcl_excel_style_cond=>c_operator_lessthanorequal f = '="Catfish"' f2 = '' numfmt = 'less than or equal to Catfish' ).
|
||||
|
||||
lo_style = lo_excel->add_new_style( ).
|
||||
lo_style->font->color-rgb = zcl_excel_style_color=>c_white.
|
||||
lo_style->number_format->format_code = '@\ "' && &7 && '"'.
|
||||
lo_style->alignment->wraptext = abap_true.
|
||||
lv_style_guid = lo_style->get_guid( ).
|
||||
|
||||
lo_worksheet->set_cell( ip_row = &2 ip_column = &1 ip_formula = '$C$2' ip_style = lv_style_guid ).
|
||||
|
||||
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
||||
lo_style_cond->rule = &3.
|
||||
ls_cellis-operator = &4.
|
||||
ls_cellis-formula = &5.
|
||||
ls_cellis-formula2 = &6.
|
||||
ls_cellis-cell_style = lv_style_1_guid.
|
||||
lo_style_cond->mode_cellis = ls_cellis.
|
||||
lo_style_cond->priority = 1.
|
||||
lo_style_cond->set_range( ip_start_column = &1
|
||||
ip_start_row = &2
|
||||
ip_stop_column = &1
|
||||
ip_stop_row = &2 ).
|
||||
END-OF-DEFINITION.
|
||||
|
||||
conditional_formatting_cellis 'C' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_equal '="Anchovy"' '' 'equal to Anchovy'.
|
||||
conditional_formatting_cellis 'D' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_notequal '="Anchovy"' '' 'not equal to Anchovy'.
|
||||
conditional_formatting_cellis 'E' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_between '="B"' '="CC"' 'between B and CC'.
|
||||
conditional_formatting_cellis 'F' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_greaterthan '="Catfish"' '' 'greater than Catfish'.
|
||||
conditional_formatting_cellis 'G' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_greaterthanorequal '="Catfish"' '' 'greater than or equal to Catfish'.
|
||||
conditional_formatting_cellis 'H' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_lessthan '="Catfish"' '' 'less than Catfish'.
|
||||
conditional_formatting_cellis 'I' 4 zcl_excel_style_cond=>c_rule_cellis zcl_excel_style_cond=>c_operator_lessthanorequal '="Catfish"' '' 'less than or equal to Catfish'.
|
||||
|
||||
DEFINE conditional_formatting_textfun.
|
||||
|
||||
lo_style = lo_excel->add_new_style( ).
|
||||
lo_style->font->color-rgb = zcl_excel_style_color=>c_white.
|
||||
lo_style->number_format->format_code = '@\ "' && &6 && '"'.
|
||||
lo_style->alignment->wraptext = abap_true.
|
||||
lv_style_guid = lo_style->get_guid( ).
|
||||
|
||||
lo_worksheet->set_cell( ip_row = &2 ip_column = &1 ip_formula = '$C$2' ip_style = lv_style_guid ).
|
||||
|
||||
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
||||
lo_style_cond->rule = &3.
|
||||
ls_textfunction-textfunction = &4.
|
||||
ls_textfunction-text = &5.
|
||||
ls_textfunction-cell_style = lv_style_1_guid.
|
||||
lo_style_cond->mode_textfunction = ls_textfunction.
|
||||
lo_style_cond->priority = 1.
|
||||
lo_style_cond->set_range( ip_start_column = &1
|
||||
ip_start_row = &2
|
||||
ip_stop_column = &1
|
||||
ip_stop_row = &2 ).
|
||||
END-OF-DEFINITION.
|
||||
|
||||
conditional_formatting_textfun 'C' 6 zcl_excel_style_cond=>c_rule_textfunction zcl_excel_style_cond=>c_textfunction_beginswith 'A' 'begins with A'.
|
||||
conditional_formatting_textfun 'D' 6 zcl_excel_style_cond=>c_rule_textfunction zcl_excel_style_cond=>c_textfunction_containstext 'h' 'contains text h'.
|
||||
conditional_formatting_textfun 'E' 6 zcl_excel_style_cond=>c_rule_textfunction zcl_excel_style_cond=>c_textfunction_endswith 'p' 'ends with p'.
|
||||
conditional_formatting_textfun 'F' 6 zcl_excel_style_cond=>c_rule_textfunction zcl_excel_style_cond=>c_textfunction_notcontains 'h' 'not contains h'.
|
||||
" Conditional formatting for all text functions
|
||||
conditional_formatting_textfun( column = 'C' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_beginswith text = 'A' numfmt = 'begins with A' ).
|
||||
conditional_formatting_textfun( column = 'D' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_containstext text = 'h' numfmt = 'contains text h' ).
|
||||
conditional_formatting_textfun( column = 'E' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_endswith text = 'p' numfmt = 'ends with p' ).
|
||||
conditional_formatting_textfun( column = 'F' row = 6 txtfun = zcl_excel_style_cond=>c_textfunction_notcontains text = 'h' numfmt = 'not contains h' ).
|
||||
|
||||
*** Create output
|
||||
lcl_output=>output( lo_excel ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD conditional_formatting_cellis.
|
||||
|
||||
DATA:
|
||||
lo_style TYPE REF TO zcl_excel_style,
|
||||
lo_style_cond TYPE REF TO zcl_excel_style_cond.
|
||||
|
||||
lo_style = lo_excel->add_new_style( ).
|
||||
lo_style->font->color-rgb = zcl_excel_style_color=>c_white.
|
||||
lo_style->number_format->format_code = '@\ "' && numfmt && '"'.
|
||||
lo_style->alignment->wraptext = abap_true.
|
||||
lv_style_guid = lo_style->get_guid( ).
|
||||
|
||||
lo_worksheet->set_cell( ip_row = row ip_column = column ip_formula = '$C$2' ip_style = lv_style_guid ).
|
||||
|
||||
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
||||
lo_style_cond->rule = rule.
|
||||
ls_cellis-operator = op.
|
||||
ls_cellis-formula = f.
|
||||
ls_cellis-formula2 = f2.
|
||||
ls_cellis-cell_style = lv_style_1_guid.
|
||||
lo_style_cond->mode_cellis = ls_cellis.
|
||||
lo_style_cond->priority = 1.
|
||||
lo_style_cond->set_range( ip_start_column = column
|
||||
ip_start_row = row
|
||||
ip_stop_column = column
|
||||
ip_stop_row = row ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD conditional_formatting_textfun.
|
||||
|
||||
DATA:
|
||||
lo_style TYPE REF TO zcl_excel_style,
|
||||
lo_style_cond TYPE REF TO zcl_excel_style_cond.
|
||||
|
||||
lo_style = lo_excel->add_new_style( ).
|
||||
lo_style->font->color-rgb = zcl_excel_style_color=>c_white.
|
||||
lo_style->number_format->format_code = '@\ "' && numfmt && '"'.
|
||||
lo_style->alignment->wraptext = abap_true.
|
||||
lv_style_guid = lo_style->get_guid( ).
|
||||
|
||||
lo_worksheet->set_cell( ip_row = row ip_column = column ip_formula = '$C$2' ip_style = lv_style_guid ).
|
||||
|
||||
lo_style_cond = lo_worksheet->add_new_style_cond( ).
|
||||
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_textfunction.
|
||||
ls_textfunction-textfunction = txtfun.
|
||||
ls_textfunction-text = text.
|
||||
ls_textfunction-cell_style = lv_style_1_guid.
|
||||
lo_style_cond->mode_textfunction = ls_textfunction.
|
||||
lo_style_cond->priority = 1.
|
||||
lo_style_cond->set_range( ip_start_column = column
|
||||
ip_start_row = row
|
||||
ip_stop_column = column
|
||||
ip_stop_row = row ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -185,20 +185,34 @@ CLASS lcl_output IMPLEMENTATION.
|
|||
METHOD parametertexts.
|
||||
* If started in language w/o textelements translated set defaults
|
||||
* Furthermore I don't have to change the selectiontexts of all demoreports.
|
||||
DEFINE default_parametertext.
|
||||
IF %_&1_%_app_%-text = '&1' OR
|
||||
%_&1_%_app_%-text IS INITIAL.
|
||||
%_&1_%_app_%-text = &2.
|
||||
|
||||
TYPES: BEGIN OF ty_parameter,
|
||||
name TYPE string,
|
||||
text TYPE string,
|
||||
END OF ty_parameter.
|
||||
DATA: parameters TYPE TABLE OF ty_parameter,
|
||||
parameter TYPE ty_parameter,
|
||||
parameter_text_name TYPE string.
|
||||
FIELD-SYMBOLS: <parameter> TYPE ty_parameter,
|
||||
<parameter_text> TYPE c.
|
||||
|
||||
parameter-name = 'RB_DOWN'. parameter-text = 'Save to frontend'. APPEND parameter TO parameters.
|
||||
parameter-name = 'RB_BACK'. parameter-text = 'Save to backend'. APPEND parameter TO parameters.
|
||||
parameter-name = 'RB_SHOW'. parameter-text = 'Direct display'. APPEND parameter TO parameters.
|
||||
parameter-name = 'RB_SEND'. parameter-text = 'Send via email'. APPEND parameter TO parameters.
|
||||
parameter-name = 'P_PATH'. parameter-text = 'Frontend-path to download to'. APPEND parameter TO parameters.
|
||||
parameter-name = 'P_EMAIL'. parameter-text = 'Email to send xlsx to'. APPEND parameter TO parameters.
|
||||
|
||||
LOOP AT parameters ASSIGNING <parameter>.
|
||||
parameter_text_name = |%_{ <parameter>-name }_%_APP_%-TEXT|.
|
||||
ASSIGN (parameter_text_name) TO <parameter_text>.
|
||||
IF sy-subrc = 0.
|
||||
IF <parameter_text> = <parameter>-name OR
|
||||
<parameter_text> IS INITIAL.
|
||||
<parameter_text> = <parameter>-text.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
END-OF-DEFINITION.
|
||||
|
||||
default_parametertext: rb_down 'Save to frontend',
|
||||
rb_back 'Save to backend',
|
||||
rb_show 'Direct display',
|
||||
rb_send 'Send via email',
|
||||
|
||||
p_path 'Frontend-path to download to',
|
||||
p_email 'Email to send xlsx to'.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD. "parametertexts
|
||||
|
||||
|
|
|
@ -31,6 +31,16 @@ CLASS zcl_excel_ole DEFINITION
|
|||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
|
||||
CLASS-METHODS close_document.
|
||||
CLASS-METHODS error_doi.
|
||||
|
||||
CLASS-DATA: lo_spreadsheet TYPE REF TO i_oi_spreadsheet,
|
||||
lo_control TYPE REF TO i_oi_container_control,
|
||||
lo_proxy TYPE REF TO i_oi_document_proxy,
|
||||
lo_error TYPE REF TO i_oi_error,
|
||||
lc_retcode TYPE soi_ret_string.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -52,13 +62,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
* Data for session 0: DOI constructor
|
||||
* ------------------------------------------
|
||||
|
||||
DATA: lo_control TYPE REF TO i_oi_container_control.
|
||||
DATA: lo_proxy TYPE REF TO i_oi_document_proxy.
|
||||
DATA: lo_spreadsheet TYPE REF TO i_oi_spreadsheet.
|
||||
DATA: lo_error TYPE REF TO i_oi_error.
|
||||
DATA: lc_retcode TYPE soi_ret_string.
|
||||
DATA: li_has TYPE i. "Proxy has spreadsheet interface?
|
||||
DATA: l_is_closed TYPE i.
|
||||
|
||||
* Data for session 1: Get LVC data from ALV object
|
||||
* ------------------------------------------
|
||||
|
@ -247,69 +251,6 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
DATA: li_document_size TYPE i.
|
||||
DATA: ls_path TYPE rlgrap-filename.
|
||||
|
||||
* MACRO: Close_document
|
||||
*-------------------------------------------
|
||||
|
||||
DEFINE close_document.
|
||||
CLEAR: l_is_closed.
|
||||
IF lo_proxy IS NOT INITIAL.
|
||||
|
||||
* check proxy detroyed adi
|
||||
|
||||
CALL METHOD lo_proxy->is_destroyed
|
||||
IMPORTING
|
||||
ret_value = l_is_closed.
|
||||
|
||||
* if dun detroyed yet: close -> release proxy
|
||||
|
||||
IF l_is_closed IS INITIAL.
|
||||
CALL METHOD lo_proxy->close_document
|
||||
* EXPORTING
|
||||
* do_save = do_save
|
||||
IMPORTING
|
||||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
ENDIF.
|
||||
|
||||
CALL METHOD lo_proxy->release_document
|
||||
IMPORTING
|
||||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
ELSE.
|
||||
lc_retcode = c_oi_errors=>ret_document_not_open.
|
||||
ENDIF.
|
||||
|
||||
* Detroy control container
|
||||
|
||||
IF lo_control IS NOT INITIAL.
|
||||
CALL METHOD lo_control->destroy_control.
|
||||
ENDIF.
|
||||
|
||||
CLEAR:
|
||||
lo_spreadsheet,
|
||||
lo_proxy,
|
||||
lo_control.
|
||||
|
||||
* free local
|
||||
|
||||
CLEAR: l_is_closed.
|
||||
|
||||
END-OF-DEFINITION.
|
||||
|
||||
* Macro to catch DOI error
|
||||
*-------------------------------------------
|
||||
|
||||
DEFINE error_doi.
|
||||
IF lc_retcode NE c_oi_errors=>ret_ok.
|
||||
close_document.
|
||||
CALL METHOD lo_error->raise_message
|
||||
EXPORTING
|
||||
type = 'E'.
|
||||
CLEAR: lo_error.
|
||||
ENDIF.
|
||||
END-OF-DEFINITION.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
* SESSION 0: DOI CONSTRUCTOR
|
||||
*--------------------------------------------------------------------*
|
||||
|
@ -331,7 +272,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
control = lo_control
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
* Initialize Container control
|
||||
|
||||
|
@ -347,13 +288,13 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
* Get Proxy Document:
|
||||
* check exist of document proxy, if exist -> close first
|
||||
|
||||
IF NOT lo_proxy IS INITIAL.
|
||||
close_document.
|
||||
close_document( ).
|
||||
ENDIF.
|
||||
|
||||
IF i_xls IS NOT INITIAL.
|
||||
|
@ -373,7 +314,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
IF i_document_url IS INITIAL.
|
||||
|
||||
|
@ -388,7 +329,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
ELSE.
|
||||
|
||||
|
@ -404,7 +345,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
ENDIF.
|
||||
|
||||
|
@ -416,7 +357,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
* create Spreadsheet object
|
||||
|
||||
|
@ -428,7 +369,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
* SESSION 1: GET LVC DATA FROM ALV OBJECT
|
||||
|
@ -1940,7 +1881,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
* reformat subtotal / total line after format wholw table
|
||||
|
||||
|
@ -2080,7 +2021,7 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
CHANGING
|
||||
document_size = li_document_size.
|
||||
|
||||
error_doi.
|
||||
error_doi( ).
|
||||
|
||||
* if save successfully -> raise successful message
|
||||
MESSAGE i400(zabap2xlsx).
|
||||
|
@ -2089,7 +2030,68 @@ CLASS zcl_excel_ole IMPLEMENTATION.
|
|||
ls_path,
|
||||
li_document_size.
|
||||
|
||||
close_document.
|
||||
close_document( ).
|
||||
ENDMETHOD. "BIND_ALV_OLE2
|
||||
|
||||
|
||||
METHOD close_document.
|
||||
|
||||
DATA: l_is_closed TYPE i.
|
||||
|
||||
CLEAR: l_is_closed.
|
||||
IF lo_proxy IS NOT INITIAL.
|
||||
|
||||
* check proxy detroyed adi
|
||||
|
||||
CALL METHOD lo_proxy->is_destroyed
|
||||
IMPORTING
|
||||
ret_value = l_is_closed.
|
||||
|
||||
* if dun detroyed yet: close -> release proxy
|
||||
|
||||
IF l_is_closed IS INITIAL.
|
||||
CALL METHOD lo_proxy->close_document
|
||||
* EXPORTING
|
||||
* do_save = do_save
|
||||
IMPORTING
|
||||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
ENDIF.
|
||||
|
||||
CALL METHOD lo_proxy->release_document
|
||||
IMPORTING
|
||||
error = lo_error
|
||||
retcode = lc_retcode.
|
||||
|
||||
ELSE.
|
||||
lc_retcode = c_oi_errors=>ret_document_not_open.
|
||||
ENDIF.
|
||||
|
||||
* Detroy control container
|
||||
|
||||
IF lo_control IS NOT INITIAL.
|
||||
CALL METHOD lo_control->destroy_control.
|
||||
ENDIF.
|
||||
|
||||
CLEAR:
|
||||
lo_spreadsheet,
|
||||
lo_proxy,
|
||||
lo_control.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD error_doi.
|
||||
|
||||
IF lc_retcode NE c_oi_errors=>ret_ok.
|
||||
close_document( ).
|
||||
CALL METHOD lo_error->raise_message
|
||||
EXPORTING
|
||||
type = 'E'.
|
||||
CLEAR: lo_error.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -707,6 +707,11 @@ CLASS zcl_excel_worksheet DEFINITION
|
|||
!ct_rtf TYPE zexcel_t_rtf
|
||||
RAISING
|
||||
zcx_excel .
|
||||
METHODS clear_initial_colorxfields
|
||||
IMPORTING
|
||||
is_color TYPE zexcel_s_style_color
|
||||
CHANGING
|
||||
cs_xcolor TYPE zexcel_s_cstylex_color.
|
||||
METHODS generate_title
|
||||
RETURNING
|
||||
VALUE(ep_title) TYPE zexcel_sheet_title .
|
||||
|
@ -716,6 +721,15 @@ CLASS zcl_excel_worksheet DEFINITION
|
|||
EXPORTING
|
||||
!ep_value TYPE simple
|
||||
!ep_value_type TYPE abap_typekind .
|
||||
METHODS move_supplied_borders
|
||||
IMPORTING
|
||||
iv_border_supplied TYPE abap_bool
|
||||
is_border TYPE zexcel_s_cstyle_border
|
||||
iv_xborder_supplied TYPE abap_bool
|
||||
is_xborder TYPE zexcel_s_cstylex_border
|
||||
CHANGING
|
||||
cs_complete_style_border TYPE zexcel_s_cstyle_border
|
||||
cs_complete_stylex_border TYPE zexcel_s_cstylex_border.
|
||||
METHODS print_title_set_range .
|
||||
METHODS update_dimension_range
|
||||
RAISING
|
||||
|
@ -1511,46 +1525,12 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
METHOD change_cell_style.
|
||||
" issue # 139
|
||||
DATA: stylemapping TYPE zexcel_s_stylemapping,
|
||||
|
||||
complete_style TYPE zexcel_s_cstyle_complete,
|
||||
complete_stylex TYPE zexcel_s_cstylex_complete,
|
||||
|
||||
borderx TYPE zexcel_s_cstylex_border,
|
||||
l_guid TYPE zexcel_cell_style. "issue # 177
|
||||
|
||||
* We have a lot of parameters. Use some macros to make the coding more structured
|
||||
|
||||
DEFINE clear_initial_colorxfields.
|
||||
IF &1-rgb IS INITIAL.
|
||||
CLEAR &2-rgb.
|
||||
ENDIF.
|
||||
IF &1-indexed IS INITIAL.
|
||||
CLEAR &2-indexed.
|
||||
ENDIF.
|
||||
IF &1-theme IS INITIAL.
|
||||
CLEAR &2-theme.
|
||||
ENDIF.
|
||||
IF &1-tint IS INITIAL.
|
||||
CLEAR &2-tint.
|
||||
ENDIF.
|
||||
END-OF-DEFINITION.
|
||||
|
||||
DEFINE move_supplied_borders.
|
||||
IF ip_&1 IS SUPPLIED. " only act if parameter was supplied
|
||||
IF ip_x&1 IS SUPPLIED. "
|
||||
borderx = ip_x&1. " use supplied x-parameter
|
||||
ELSE.
|
||||
CLEAR borderx WITH 'X'.
|
||||
* clear in a way that would be expected to work easily
|
||||
IF ip_&1-border_style IS INITIAL.
|
||||
CLEAR borderx-border_style.
|
||||
ENDIF.
|
||||
clear_initial_colorxfields ip_&1-border_color borderx-border_color.
|
||||
ENDIF.
|
||||
MOVE-CORRESPONDING ip_&1 TO complete_style-&2.
|
||||
MOVE-CORRESPONDING borderx TO complete_stylex-&2.
|
||||
ENDIF.
|
||||
END-OF-DEFINITION.
|
||||
DATA: lv_border_supplied TYPE abap_bool,
|
||||
lv_xborder_supplied TYPE abap_bool,
|
||||
lv_style_supplied TYPE abap_bool.
|
||||
|
||||
* First get current stylsettings
|
||||
TRY.
|
||||
|
@ -1588,7 +1568,11 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
fontx-strikethrough,
|
||||
fontx-underline_mode.
|
||||
CLEAR fontx-color WITH 'X'.
|
||||
clear_initial_colorxfields ip_font-color fontx-color.
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_font-color
|
||||
CHANGING
|
||||
cs_xcolor = fontx-color ).
|
||||
IF ip_font-family IS NOT INITIAL.
|
||||
fontx-family = 'X'.
|
||||
ENDIF.
|
||||
|
@ -1619,8 +1603,16 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
IF ip_fill-filltype IS INITIAL.
|
||||
CLEAR fillx-filltype.
|
||||
ENDIF.
|
||||
clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor.
|
||||
clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor.
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_fill-fgcolor
|
||||
CHANGING
|
||||
cs_xcolor = fillx-fgcolor ).
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_fill-bgcolor
|
||||
CHANGING
|
||||
cs_xcolor = fillx-bgcolor ).
|
||||
|
||||
ENDIF.
|
||||
MOVE-CORRESPONDING ip_fill TO complete_style-fill.
|
||||
|
@ -1652,12 +1644,42 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
IF ip_borders-top-border_style IS INITIAL.
|
||||
CLEAR bordersx-top-border_style.
|
||||
ENDIF.
|
||||
clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color.
|
||||
clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color.
|
||||
clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color.
|
||||
clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color.
|
||||
clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color.
|
||||
clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color.
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-allborders-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-allborders-border_color ).
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-diagonal-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-diagonal-border_color ).
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-down-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-down-border_color ).
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-left-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-left-border_color ).
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-right-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-right-border_color ).
|
||||
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = ip_borders-top-border_color
|
||||
CHANGING
|
||||
cs_xcolor = bordersx-top-border_color ).
|
||||
|
||||
ENDIF.
|
||||
MOVE-CORRESPONDING ip_borders TO complete_style-borders.
|
||||
|
@ -1696,113 +1718,414 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
|
||||
move_supplied_borders : borders_allborders borders-allborders,
|
||||
borders_diagonal borders-diagonal ,
|
||||
borders_down borders-down ,
|
||||
borders_left borders-left ,
|
||||
borders_right borders-right ,
|
||||
borders_top borders-top .
|
||||
lv_border_supplied = boolc( ip_borders_allborders IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_allborders IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_allborders
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_allborders
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-allborders
|
||||
cs_complete_stylex_border = complete_stylex-borders-allborders ).
|
||||
|
||||
DEFINE move_supplied_singlestyles.
|
||||
IF ip_&1 IS SUPPLIED.
|
||||
complete_style-&2 = ip_&1.
|
||||
complete_stylex-&2 = 'X'.
|
||||
ENDIF.
|
||||
END-OF-DEFINITION.
|
||||
lv_border_supplied = boolc( ip_borders_diagonal IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_diagonal IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_diagonal
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_diagonal
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-diagonal
|
||||
cs_complete_stylex_border = complete_stylex-borders-diagonal ).
|
||||
|
||||
move_supplied_singlestyles: number_format_format_code number_format-format_code,
|
||||
font_bold font-bold,
|
||||
font_color font-color,
|
||||
font_color_rgb font-color-rgb,
|
||||
font_color_indexed font-color-indexed,
|
||||
font_color_theme font-color-theme,
|
||||
font_color_tint font-color-tint,
|
||||
lv_border_supplied = boolc( ip_borders_down IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_down IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_down
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_down
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-down
|
||||
cs_complete_stylex_border = complete_stylex-borders-down ).
|
||||
|
||||
font_family font-family,
|
||||
font_italic font-italic,
|
||||
font_name font-name,
|
||||
font_scheme font-scheme,
|
||||
font_size font-size,
|
||||
font_strikethrough font-strikethrough,
|
||||
font_underline font-underline,
|
||||
font_underline_mode font-underline_mode,
|
||||
fill_filltype fill-filltype,
|
||||
fill_rotation fill-rotation,
|
||||
fill_fgcolor fill-fgcolor,
|
||||
fill_fgcolor_rgb fill-fgcolor-rgb,
|
||||
fill_fgcolor_indexed fill-fgcolor-indexed,
|
||||
fill_fgcolor_theme fill-fgcolor-theme,
|
||||
fill_fgcolor_tint fill-fgcolor-tint,
|
||||
lv_border_supplied = boolc( ip_borders_left IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_left IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_left
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_left
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-left
|
||||
cs_complete_stylex_border = complete_stylex-borders-left ).
|
||||
|
||||
fill_bgcolor fill-bgcolor,
|
||||
fill_bgcolor_rgb fill-bgcolor-rgb,
|
||||
fill_bgcolor_indexed fill-bgcolor-indexed,
|
||||
fill_bgcolor_theme fill-bgcolor-theme,
|
||||
fill_bgcolor_tint fill-bgcolor-tint,
|
||||
lv_border_supplied = boolc( ip_borders_right IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_right IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_right
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_right
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-right
|
||||
cs_complete_stylex_border = complete_stylex-borders-right ).
|
||||
|
||||
fill_gradtype_type fill-gradtype-type,
|
||||
fill_gradtype_degree fill-gradtype-degree,
|
||||
fill_gradtype_bottom fill-gradtype-bottom,
|
||||
fill_gradtype_left fill-gradtype-left,
|
||||
fill_gradtype_top fill-gradtype-top,
|
||||
fill_gradtype_right fill-gradtype-right,
|
||||
fill_gradtype_position1 fill-gradtype-position1,
|
||||
fill_gradtype_position2 fill-gradtype-position2,
|
||||
fill_gradtype_position3 fill-gradtype-position3,
|
||||
lv_border_supplied = boolc( ip_borders_top IS SUPPLIED ).
|
||||
lv_xborder_supplied = boolc( ip_xborders_top IS SUPPLIED ).
|
||||
move_supplied_borders(
|
||||
EXPORTING
|
||||
iv_border_supplied = lv_border_supplied
|
||||
is_border = ip_borders_top
|
||||
iv_xborder_supplied = lv_xborder_supplied
|
||||
is_xborder = ip_xborders_top
|
||||
CHANGING
|
||||
cs_complete_style_border = complete_style-borders-top
|
||||
cs_complete_stylex_border = complete_stylex-borders-top ).
|
||||
|
||||
IF ip_number_format_format_code IS SUPPLIED.
|
||||
complete_style-number_format-format_code = ip_number_format_format_code.
|
||||
complete_stylex-number_format-format_code = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_bold IS SUPPLIED.
|
||||
complete_style-font-bold = ip_font_bold.
|
||||
complete_stylex-font-bold = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_color IS SUPPLIED.
|
||||
complete_style-font-color = ip_font_color.
|
||||
complete_stylex-font-color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_color_rgb IS SUPPLIED.
|
||||
complete_style-font-color-rgb = ip_font_color_rgb.
|
||||
complete_stylex-font-color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_color_indexed IS SUPPLIED.
|
||||
complete_style-font-color-indexed = ip_font_color_indexed.
|
||||
complete_stylex-font-color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_color_theme IS SUPPLIED.
|
||||
complete_style-font-color-theme = ip_font_color_theme.
|
||||
complete_stylex-font-color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_color_tint IS SUPPLIED.
|
||||
complete_style-font-color-tint = ip_font_color_tint.
|
||||
complete_stylex-font-color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
IF ip_font_family IS SUPPLIED.
|
||||
complete_style-font-family = ip_font_family.
|
||||
complete_stylex-font-family = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_italic IS SUPPLIED.
|
||||
complete_style-font-italic = ip_font_italic.
|
||||
complete_stylex-font-italic = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_name IS SUPPLIED.
|
||||
complete_style-font-name = ip_font_name.
|
||||
complete_stylex-font-name = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_scheme IS SUPPLIED.
|
||||
complete_style-font-scheme = ip_font_scheme.
|
||||
complete_stylex-font-scheme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_size IS SUPPLIED.
|
||||
complete_style-font-size = ip_font_size.
|
||||
complete_stylex-font-size = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_strikethrough IS SUPPLIED.
|
||||
complete_style-font-strikethrough = ip_font_strikethrough.
|
||||
complete_stylex-font-strikethrough = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_underline IS SUPPLIED.
|
||||
complete_style-font-underline = ip_font_underline.
|
||||
complete_stylex-font-underline = 'X'.
|
||||
ENDIF.
|
||||
IF ip_font_underline_mode IS SUPPLIED.
|
||||
complete_style-font-underline_mode = ip_font_underline_mode.
|
||||
complete_stylex-font-underline_mode = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_filltype IS SUPPLIED.
|
||||
complete_style-fill-filltype = ip_fill_filltype.
|
||||
complete_stylex-fill-filltype = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_rotation IS SUPPLIED.
|
||||
complete_style-fill-rotation = ip_fill_rotation.
|
||||
complete_stylex-fill-rotation = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_fgcolor IS SUPPLIED.
|
||||
complete_style-fill-fgcolor = ip_fill_fgcolor.
|
||||
complete_stylex-fill-fgcolor-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_fgcolor_rgb IS SUPPLIED.
|
||||
complete_style-fill-fgcolor-rgb = ip_fill_fgcolor_rgb.
|
||||
complete_stylex-fill-fgcolor-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_fgcolor_indexed IS SUPPLIED.
|
||||
complete_style-fill-fgcolor-indexed = ip_fill_fgcolor_indexed.
|
||||
complete_stylex-fill-fgcolor-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_fgcolor_theme IS SUPPLIED.
|
||||
complete_style-fill-fgcolor-theme = ip_fill_fgcolor_theme.
|
||||
complete_stylex-fill-fgcolor-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_fgcolor_tint IS SUPPLIED.
|
||||
complete_style-fill-fgcolor-tint = ip_fill_fgcolor_tint.
|
||||
complete_stylex-fill-fgcolor-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
IF ip_fill_bgcolor IS SUPPLIED.
|
||||
complete_style-fill-bgcolor = ip_fill_bgcolor.
|
||||
complete_stylex-fill-bgcolor-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_bgcolor_rgb IS SUPPLIED.
|
||||
complete_style-fill-bgcolor-rgb = ip_fill_bgcolor_rgb.
|
||||
complete_stylex-fill-bgcolor-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_bgcolor_indexed IS SUPPLIED.
|
||||
complete_style-fill-bgcolor-indexed = ip_fill_bgcolor_indexed.
|
||||
complete_stylex-fill-bgcolor-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_bgcolor_theme IS SUPPLIED.
|
||||
complete_style-fill-bgcolor-theme = ip_fill_bgcolor_theme.
|
||||
complete_stylex-fill-bgcolor-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_bgcolor_tint IS SUPPLIED.
|
||||
complete_style-fill-bgcolor-tint = ip_fill_bgcolor_tint.
|
||||
complete_stylex-fill-bgcolor-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
IF ip_fill_gradtype_type IS SUPPLIED.
|
||||
complete_style-fill-gradtype-type = ip_fill_gradtype_type.
|
||||
complete_stylex-fill-gradtype-type = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_degree IS SUPPLIED.
|
||||
complete_style-fill-gradtype-degree = ip_fill_gradtype_degree.
|
||||
complete_stylex-fill-gradtype-degree = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_bottom IS SUPPLIED.
|
||||
complete_style-fill-gradtype-bottom = ip_fill_gradtype_bottom.
|
||||
complete_stylex-fill-gradtype-bottom = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_left IS SUPPLIED.
|
||||
complete_style-fill-gradtype-left = ip_fill_gradtype_left.
|
||||
complete_stylex-fill-gradtype-left = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_top IS SUPPLIED.
|
||||
complete_style-fill-gradtype-top = ip_fill_gradtype_top.
|
||||
complete_stylex-fill-gradtype-top = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_right IS SUPPLIED.
|
||||
complete_style-fill-gradtype-right = ip_fill_gradtype_right.
|
||||
complete_stylex-fill-gradtype-right = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_position1 IS SUPPLIED.
|
||||
complete_style-fill-gradtype-position1 = ip_fill_gradtype_position1.
|
||||
complete_stylex-fill-gradtype-position1 = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_position2 IS SUPPLIED.
|
||||
complete_style-fill-gradtype-position2 = ip_fill_gradtype_position2.
|
||||
complete_stylex-fill-gradtype-position2 = 'X'.
|
||||
ENDIF.
|
||||
IF ip_fill_gradtype_position3 IS SUPPLIED.
|
||||
complete_style-fill-gradtype-position3 = ip_fill_gradtype_position3.
|
||||
complete_stylex-fill-gradtype-position3 = 'X'.
|
||||
ENDIF.
|
||||
|
||||
|
||||
|
||||
borders_diagonal_mode borders-diagonal_mode,
|
||||
alignment_horizontal alignment-horizontal,
|
||||
alignment_vertical alignment-vertical,
|
||||
alignment_textrotation alignment-textrotation,
|
||||
alignment_wraptext alignment-wraptext,
|
||||
alignment_shrinktofit alignment-shrinktofit,
|
||||
alignment_indent alignment-indent,
|
||||
protection_hidden protection-hidden,
|
||||
protection_locked protection-locked,
|
||||
IF ip_borders_diagonal_mode IS SUPPLIED.
|
||||
complete_style-borders-diagonal_mode = ip_borders_diagonal_mode.
|
||||
complete_stylex-borders-diagonal_mode = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_horizontal IS SUPPLIED.
|
||||
complete_style-alignment-horizontal = ip_alignment_horizontal.
|
||||
complete_stylex-alignment-horizontal = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_vertical IS SUPPLIED.
|
||||
complete_style-alignment-vertical = ip_alignment_vertical.
|
||||
complete_stylex-alignment-vertical = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_textrotation IS SUPPLIED.
|
||||
complete_style-alignment-textrotation = ip_alignment_textrotation.
|
||||
complete_stylex-alignment-textrotation = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_wraptext IS SUPPLIED.
|
||||
complete_style-alignment-wraptext = ip_alignment_wraptext.
|
||||
complete_stylex-alignment-wraptext = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_shrinktofit IS SUPPLIED.
|
||||
complete_style-alignment-shrinktofit = ip_alignment_shrinktofit.
|
||||
complete_stylex-alignment-shrinktofit = 'X'.
|
||||
ENDIF.
|
||||
IF ip_alignment_indent IS SUPPLIED.
|
||||
complete_style-alignment-indent = ip_alignment_indent.
|
||||
complete_stylex-alignment-indent = 'X'.
|
||||
ENDIF.
|
||||
IF ip_protection_hidden IS SUPPLIED.
|
||||
complete_style-protection-hidden = ip_protection_hidden.
|
||||
complete_stylex-protection-hidden = 'X'.
|
||||
ENDIF.
|
||||
IF ip_protection_locked IS SUPPLIED.
|
||||
complete_style-protection-locked = ip_protection_locked.
|
||||
complete_stylex-protection-locked = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_allborders_style borders-allborders-border_style,
|
||||
borders_allborders_color borders-allborders-border_color,
|
||||
borders_allbo_color_rgb borders-allborders-border_color-rgb,
|
||||
borders_allbo_color_indexed borders-allborders-border_color-indexed,
|
||||
borders_allbo_color_theme borders-allborders-border_color-theme,
|
||||
borders_allbo_color_tint borders-allborders-border_color-tint,
|
||||
IF ip_borders_allborders_style IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_style = ip_borders_allborders_style.
|
||||
complete_stylex-borders-allborders-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_allborders_color IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_color = ip_borders_allborders_color.
|
||||
complete_stylex-borders-allborders-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_allbo_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_color-rgb = ip_borders_allbo_color_rgb.
|
||||
complete_stylex-borders-allborders-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_allbo_color_indexed IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_color-indexed = ip_borders_allbo_color_indexed.
|
||||
complete_stylex-borders-allborders-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_allbo_color_theme IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_color-theme = ip_borders_allbo_color_theme.
|
||||
complete_stylex-borders-allborders-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_allbo_color_tint IS SUPPLIED.
|
||||
complete_style-borders-allborders-border_color-tint = ip_borders_allbo_color_tint.
|
||||
complete_stylex-borders-allborders-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_diagonal_style borders-diagonal-border_style,
|
||||
borders_diagonal_color borders-diagonal-border_color,
|
||||
borders_diagonal_color_rgb borders-diagonal-border_color-rgb,
|
||||
borders_diagonal_color_inde borders-diagonal-border_color-indexed,
|
||||
borders_diagonal_color_them borders-diagonal-border_color-theme,
|
||||
borders_diagonal_color_tint borders-diagonal-border_color-tint,
|
||||
IF ip_borders_diagonal_style IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_style = ip_borders_diagonal_style.
|
||||
complete_stylex-borders-diagonal-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_diagonal_color IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_color = ip_borders_diagonal_color.
|
||||
complete_stylex-borders-diagonal-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_diagonal_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_color-rgb = ip_borders_diagonal_color_rgb.
|
||||
complete_stylex-borders-diagonal-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_diagonal_color_inde IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_color-indexed = ip_borders_diagonal_color_inde.
|
||||
complete_stylex-borders-diagonal-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_diagonal_color_them IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_color-theme = ip_borders_diagonal_color_them.
|
||||
complete_stylex-borders-diagonal-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_diagonal_color_tint IS SUPPLIED.
|
||||
complete_style-borders-diagonal-border_color-tint = ip_borders_diagonal_color_tint.
|
||||
complete_stylex-borders-diagonal-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_down_style borders-down-border_style,
|
||||
borders_down_color borders-down-border_color,
|
||||
borders_down_color_rgb borders-down-border_color-rgb,
|
||||
borders_down_color_indexed borders-down-border_color-indexed,
|
||||
borders_down_color_theme borders-down-border_color-theme,
|
||||
borders_down_color_tint borders-down-border_color-tint,
|
||||
IF ip_borders_down_style IS SUPPLIED.
|
||||
complete_style-borders-down-border_style = ip_borders_down_style.
|
||||
complete_stylex-borders-down-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_down_color IS SUPPLIED.
|
||||
complete_style-borders-down-border_color = ip_borders_down_color.
|
||||
complete_stylex-borders-down-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_down_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-down-border_color-rgb = ip_borders_down_color_rgb.
|
||||
complete_stylex-borders-down-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_down_color_indexed IS SUPPLIED.
|
||||
complete_style-borders-down-border_color-indexed = ip_borders_down_color_indexed.
|
||||
complete_stylex-borders-down-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_down_color_theme IS SUPPLIED.
|
||||
complete_style-borders-down-border_color-theme = ip_borders_down_color_theme.
|
||||
complete_stylex-borders-down-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_down_color_tint IS SUPPLIED.
|
||||
complete_style-borders-down-border_color-tint = ip_borders_down_color_tint.
|
||||
complete_stylex-borders-down-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_left_style borders-left-border_style,
|
||||
borders_left_color borders-left-border_color,
|
||||
borders_left_color_rgb borders-left-border_color-rgb,
|
||||
borders_left_color_indexed borders-left-border_color-indexed,
|
||||
borders_left_color_theme borders-left-border_color-theme,
|
||||
borders_left_color_tint borders-left-border_color-tint,
|
||||
IF ip_borders_left_style IS SUPPLIED.
|
||||
complete_style-borders-left-border_style = ip_borders_left_style.
|
||||
complete_stylex-borders-left-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_left_color IS SUPPLIED.
|
||||
complete_style-borders-left-border_color = ip_borders_left_color.
|
||||
complete_stylex-borders-left-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_left_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-left-border_color-rgb = ip_borders_left_color_rgb.
|
||||
complete_stylex-borders-left-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_left_color_indexed IS SUPPLIED.
|
||||
complete_style-borders-left-border_color-indexed = ip_borders_left_color_indexed.
|
||||
complete_stylex-borders-left-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_left_color_theme IS SUPPLIED.
|
||||
complete_style-borders-left-border_color-theme = ip_borders_left_color_theme.
|
||||
complete_stylex-borders-left-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_left_color_tint IS SUPPLIED.
|
||||
complete_style-borders-left-border_color-tint = ip_borders_left_color_tint.
|
||||
complete_stylex-borders-left-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_right_style borders-right-border_style,
|
||||
borders_right_color borders-right-border_color,
|
||||
borders_right_color_rgb borders-right-border_color-rgb,
|
||||
borders_right_color_indexed borders-right-border_color-indexed,
|
||||
borders_right_color_theme borders-right-border_color-theme,
|
||||
borders_right_color_tint borders-right-border_color-tint,
|
||||
IF ip_borders_right_style IS SUPPLIED.
|
||||
complete_style-borders-right-border_style = ip_borders_right_style.
|
||||
complete_stylex-borders-right-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_right_color IS SUPPLIED.
|
||||
complete_style-borders-right-border_color = ip_borders_right_color.
|
||||
complete_stylex-borders-right-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_right_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-right-border_color-rgb = ip_borders_right_color_rgb.
|
||||
complete_stylex-borders-right-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_right_color_indexed IS SUPPLIED.
|
||||
complete_style-borders-right-border_color-indexed = ip_borders_right_color_indexed.
|
||||
complete_stylex-borders-right-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_right_color_theme IS SUPPLIED.
|
||||
complete_style-borders-right-border_color-theme = ip_borders_right_color_theme.
|
||||
complete_stylex-borders-right-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_right_color_tint IS SUPPLIED.
|
||||
complete_style-borders-right-border_color-tint = ip_borders_right_color_tint.
|
||||
complete_stylex-borders-right-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
borders_top_style borders-top-border_style,
|
||||
borders_top_color borders-top-border_color,
|
||||
borders_top_color_rgb borders-top-border_color-rgb,
|
||||
borders_top_color_indexed borders-top-border_color-indexed,
|
||||
borders_top_color_theme borders-top-border_color-theme,
|
||||
borders_top_color_tint borders-top-border_color-tint.
|
||||
IF ip_borders_top_style IS SUPPLIED.
|
||||
complete_style-borders-top-border_style = ip_borders_top_style.
|
||||
complete_stylex-borders-top-border_style = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_top_color IS SUPPLIED.
|
||||
complete_style-borders-top-border_color = ip_borders_top_color.
|
||||
complete_stylex-borders-top-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_top_color_rgb IS SUPPLIED.
|
||||
complete_style-borders-top-border_color-rgb = ip_borders_top_color_rgb.
|
||||
complete_stylex-borders-top-border_color-rgb = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_top_color_indexed IS SUPPLIED.
|
||||
complete_style-borders-top-border_color-indexed = ip_borders_top_color_indexed.
|
||||
complete_stylex-borders-top-border_color-indexed = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_top_color_theme IS SUPPLIED.
|
||||
complete_style-borders-top-border_color-theme = ip_borders_top_color_theme.
|
||||
complete_stylex-borders-top-border_color-theme = 'X'.
|
||||
ENDIF.
|
||||
IF ip_borders_top_color_tint IS SUPPLIED.
|
||||
complete_style-borders-top-border_color-tint = ip_borders_top_color_tint.
|
||||
complete_stylex-borders-top-border_color-tint = 'X'.
|
||||
ENDIF.
|
||||
|
||||
|
||||
* Now we have a completly filled styles.
|
||||
|
@ -1907,6 +2230,24 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD clear_initial_colorxfields.
|
||||
|
||||
IF is_color-rgb IS INITIAL.
|
||||
CLEAR cs_xcolor-rgb.
|
||||
ENDIF.
|
||||
IF is_color-indexed IS INITIAL.
|
||||
CLEAR cs_xcolor-indexed.
|
||||
ENDIF.
|
||||
IF is_color-theme IS INITIAL.
|
||||
CLEAR cs_xcolor-theme.
|
||||
ENDIF.
|
||||
IF is_color-tint IS INITIAL.
|
||||
CLEAR cs_xcolor-tint.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD constructor.
|
||||
DATA: lv_title TYPE zexcel_sheet_title.
|
||||
|
||||
|
@ -2776,6 +3117,32 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
|
|||
ENDMETHOD. "IS_CELL_MERGED
|
||||
|
||||
|
||||
METHOD move_supplied_borders.
|
||||
|
||||
DATA: ls_borderx TYPE zexcel_s_cstylex_border.
|
||||
|
||||
IF iv_border_supplied = abap_true. " only act if parameter was supplied
|
||||
IF iv_xborder_supplied = abap_true. "
|
||||
ls_borderx = is_xborder. " use supplied x-parameter
|
||||
ELSE.
|
||||
CLEAR ls_borderx WITH 'X'. " <============================== DDIC structure enh. category to set?
|
||||
" clear in a way that would be expected to work easily
|
||||
IF is_border-border_style IS INITIAL.
|
||||
CLEAR ls_borderx-border_style.
|
||||
ENDIF.
|
||||
clear_initial_colorxfields(
|
||||
EXPORTING
|
||||
is_color = is_border-border_color
|
||||
CHANGING
|
||||
cs_xcolor = ls_borderx-border_color ).
|
||||
ENDIF.
|
||||
MOVE-CORRESPONDING is_border TO cs_complete_style_border.
|
||||
MOVE-CORRESPONDING ls_borderx TO cs_complete_stylex_border.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD print_title_set_range.
|
||||
*--------------------------------------------------------------------*
|
||||
* issue#235 - repeat rows/columns
|
||||
|
|
|
@ -239,6 +239,13 @@ CLASS zcl_excel_writer_2007 DEFINITION
|
|||
CONSTANTS c_xl_printersettings TYPE string VALUE 'xl/printerSettings/printerSettings#.bin'. "#EC NOTEXT
|
||||
TYPES: tv_charbool TYPE c LENGTH 5.
|
||||
|
||||
METHODS add_1_val_child_node
|
||||
IMPORTING
|
||||
io_document TYPE REF TO if_ixml_document
|
||||
io_parent TYPE REF TO if_ixml_element
|
||||
iv_elem_name TYPE string
|
||||
iv_attr_name TYPE string
|
||||
iv_attr_value TYPE string.
|
||||
METHODS flag2bool
|
||||
IMPORTING
|
||||
!ip_flag TYPE flag
|
||||
|
@ -255,6 +262,21 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD add_1_val_child_node.
|
||||
|
||||
DATA: lo_child TYPE REF TO if_ixml_element.
|
||||
|
||||
lo_child = io_document->create_simple_element( name = iv_elem_name
|
||||
parent = io_document ).
|
||||
IF iv_attr_name IS NOT INITIAL.
|
||||
lo_child->set_attribute_ns( name = iv_attr_name
|
||||
value = iv_attr_value ).
|
||||
ENDIF.
|
||||
io_parent->append_child( new_child = lo_child ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD add_further_data_to_zip.
|
||||
* Can be used by child classes like xlsm-writer to write additional data to zip archive
|
||||
ENDMETHOD.
|
||||
|
@ -2321,22 +2343,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
|||
DATA: lv_rel_id TYPE i,
|
||||
lv_author TYPE string.
|
||||
|
||||
DEFINE add_1_val_child_node.
|
||||
* &1: parent element
|
||||
* &2: child element
|
||||
* &3: element name
|
||||
* &4: attribute name
|
||||
* &5: attribute value
|
||||
|
||||
&2 = lo_document->create_simple_element( name = &3
|
||||
parent = lo_document ).
|
||||
IF &4 IS NOT INITIAL.
|
||||
&2->set_attribute_ns( name = &4
|
||||
value = &5 ).
|
||||
ENDIF.
|
||||
&1->append_child( new_child = &2 ).
|
||||
END-OF-DEFINITION.
|
||||
|
||||
|
||||
**********************************************************************
|
||||
* STEP 1: Create [Content_Types].xml into the root of the ZIP
|
||||
|
@ -2393,12 +2399,10 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
|||
parent = lo_document ).
|
||||
lo_element_rpr->append_child( new_child = lo_element_b ).
|
||||
|
||||
add_1_val_child_node lo_element_rpr: lo_element_sz lc_xml_node_sz lc_xml_attr_val '9',
|
||||
lo_element_color lc_xml_node_color lc_xml_attr_indexed '81',
|
||||
lo_element_rfont lc_xml_node_rfont lc_xml_attr_val 'Tahoma',
|
||||
lo_element_family lc_xml_node_family lc_xml_attr_val '2'
|
||||
* lo_element_charset lc_xml_node_charset lc_xml_attr_val '1'
|
||||
.
|
||||
add_1_val_child_node( io_document = lo_document io_parent = lo_element_rpr iv_elem_name = lc_xml_node_sz iv_attr_name = lc_xml_attr_val iv_attr_value = '9' ).
|
||||
add_1_val_child_node( io_document = lo_document io_parent = lo_element_rpr iv_elem_name = lc_xml_node_color iv_attr_name = lc_xml_attr_indexed iv_attr_value = '81' ).
|
||||
add_1_val_child_node( io_document = lo_document io_parent = lo_element_rpr iv_elem_name = lc_xml_node_rfont iv_attr_name = lc_xml_attr_val iv_attr_value = 'Tahoma' ).
|
||||
add_1_val_child_node( io_document = lo_document io_parent = lo_element_rpr iv_elem_name = lc_xml_node_family iv_attr_name = lc_xml_attr_val iv_attr_value = '2' ).
|
||||
|
||||
lo_element_r->append_child( new_child = lo_element_rpr ).
|
||||
|
||||
|
@ -3155,22 +3159,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
|
|||
lv_int_value_string TYPE string.
|
||||
DATA: lv_rel_id TYPE i.
|
||||
|
||||
DEFINE add_1_val_child_node.
|
||||
* &1: parent element
|
||||
* &2: child element
|
||||
* &3: element name
|
||||
* &4: attribute name
|
||||
* &5: attribute value
|
||||
|
||||
&2 = lo_document->create_simple_element( name = &3
|
||||
parent = lo_document ).
|
||||
IF &4 IS NOT INITIAL.
|
||||
&2->set_attribute_ns( name = &4
|
||||
value = &5 ).
|
||||
ENDIF.
|
||||
&1->append_child( new_child = &2 ).
|
||||
END-OF-DEFINITION.
|
||||
|
||||
|
||||
**********************************************************************
|
||||
* STEP 1: Create XML document
|
||||
|
|
Loading…
Reference in New Issue
Block a user