mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 13:46:17 +08:00
Update zcl_excel_common.clas.abap
This commit is contained in:
parent
1956ec3591
commit
fba955bc5c
|
@ -1042,8 +1042,7 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
* This is private an no one using it so far except me, so no need to hurry
|
||||
DATA: descr TYPE REF TO cl_abap_structdescr,
|
||||
wa_component LIKE LINE OF descr->components,
|
||||
attribute_name LIKE wa_component-name,
|
||||
flag_class TYPE abap_bool.
|
||||
attribute_name LIKE wa_component-name.
|
||||
|
||||
FIELD-SYMBOLS: <field> TYPE any,
|
||||
<fieldx> TYPE any,
|
||||
|
@ -1058,7 +1057,6 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <field>.
|
||||
ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO <fieldx>.
|
||||
* At least one field in the structure should be marked - otherwise continue with next field
|
||||
CLEAR flag_class.
|
||||
* maybe source is just a structure - try assign component...
|
||||
ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <attribute>.
|
||||
IF sy-subrc <> 0.
|
||||
|
@ -1068,7 +1066,6 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
IF sy-subrc <> 0.
|
||||
EXIT.
|
||||
ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps
|
||||
flag_class = abap_true.
|
||||
ENDIF.
|
||||
|
||||
CASE wa_component-type_kind.
|
||||
|
@ -1094,7 +1091,9 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
DATA: descr TYPE REF TO cl_abap_structdescr,
|
||||
wa_component LIKE LINE OF descr->components,
|
||||
attribute_name LIKE wa_component-name,
|
||||
flag_class TYPE abap_bool,
|
||||
check_class TYPE abap_bool,
|
||||
lo_refdescr TYPE REF TO cl_abap_refdescr,
|
||||
lo_classdescr TYPE REF TO cl_abap_classdescr,
|
||||
o_border TYPE REF TO zcl_excel_style_border.
|
||||
|
||||
FIELD-SYMBOLS: <field> TYPE any,
|
||||
|
@ -1111,7 +1110,7 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO <fieldx>.
|
||||
* At least one field in the structure should be marked - otherwise continue with next field
|
||||
CHECK <fieldx> CA abap_true.
|
||||
CLEAR flag_class.
|
||||
CLEAR check_class.
|
||||
* maybe target is just a structure - try assign component...
|
||||
ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <attribute>.
|
||||
IF sy-subrc <> 0.
|
||||
|
@ -1119,22 +1118,25 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name.
|
||||
ASSIGN (attribute_name) TO <attribute>.
|
||||
IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps
|
||||
flag_class = abap_true.
|
||||
IF <attribute> IS INITIAL.
|
||||
check_class = abap_true.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
CASE wa_component-type_kind.
|
||||
WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion
|
||||
" To avoid dump with attribute GRADTYPE of class ZCL_EXCEL_STYLE_FILL
|
||||
" quick and really dirty fix -> check the attribute name
|
||||
" Border has to be initialized somewhere else
|
||||
IF wa_component-name EQ 'GRADTYPE'.
|
||||
flag_class = abap_false.
|
||||
ENDIF.
|
||||
|
||||
IF flag_class = abap_true AND <attribute> IS INITIAL.
|
||||
* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance
|
||||
CREATE OBJECT o_border.
|
||||
<attribute> = o_border.
|
||||
IF check_class = abap_true.
|
||||
TRY.
|
||||
lo_refdescr ?= cl_abap_typedescr=>describe_by_data( <attribute> ).
|
||||
lo_classdescr ?= lo_refdescr->get_referenced_type( ).
|
||||
CASE lo_classdescr->get_relative_name( ).
|
||||
WHEN 'ZCL_EXCEL_STYLE_BORDER'.
|
||||
* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance
|
||||
CREATE OBJECT o_border.
|
||||
<attribute> = o_border.
|
||||
ENDCASE.
|
||||
CATCH cx_sy_move_cast_error.
|
||||
ENDTRY.
|
||||
ENDIF.
|
||||
zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <field>
|
||||
i_sourcex = <fieldx>
|
||||
|
|
Loading…
Reference in New Issue
Block a user