mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-04 15:16:21 +08:00
Fixed issue #348: Referenced formulae truncated
CLASS ZCL_EXCEL_COMMON : Extended length of internal field - now we'd really need huuuuuuuge formulae before we truncate ( was afraid to switch to string, no time to analyze if that is feasible ) CLASS ZCL_EXCEL_STYLE_COLOR: Added a method to allow creating rgb-colors with integer input instead of hex-input for the colors Report ZDEMO_EXCEL37: Added line to create output when using alternate writerclass ( was buggy after my extension of the report ), added code to save .xlsm templates as .xlsm when downloading, added set-get-parameter for better handling
This commit is contained in:
parent
7fdba5e3a4
commit
600ac8a159
|
@ -2213,7 +2213,7 @@ endmethod.</source>
|
|||
lv_numchars TYPE i, " Number of characters counter
|
||||
lv_tchar(1) TYPE c, " Temp character
|
||||
lv_tchar2(1) TYPE c, " Temp character
|
||||
lv_cur_form(132) TYPE c, " Formula for current cell
|
||||
lv_cur_form(2000) TYPE c, " Formula for current cell
|
||||
lv_ref_cell_addr TYPE string, " Reference cell address
|
||||
lv_tcol1 TYPE string, " Temp column letter
|
||||
lv_tcol2 TYPE string, " Temp column letter
|
||||
|
|
|
@ -35,16 +35,48 @@
|
|||
<attribute CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="C_THEME_NOT_SET" VERSION="1" LANGU="E" DESCRIPT="Theme Color - Not Set" EXPOSURE="2" STATE="1" EDITORDER="24 " ATTDECLTYP="2" ATTVALUE="-1" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_THEME" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="C_WHITE" VERSION="1" LANGU="E" DESCRIPT="Color ARGB" EXPOSURE="2" STATE="1" EDITORDER="10 " ATTDECLTYP="2" ATTVALUE="'FFFFFFFF'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_ARGB" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<attribute CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="C_YELLOW" VERSION="1" LANGU="E" DESCRIPT="Color ARGB" EXPOSURE="2" STATE="1" EDITORDER="11 " ATTDECLTYP="2" ATTVALUE="'FFFFFF00'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_ARGB" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
|
||||
<method CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARBG_INT" VERSION="1" LANGU="E" DESCRIPT="Create a custom ARGB color from RGB with integers" EXPOSURE="2" STATE="1" EDITORDER="2 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="1" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARBG_INT" SCONAME="IV_RED" VERSION="1" LANGU="E" DESCRIPT="Dummy for B20 int1 (Local Everywhere)" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="NUMERIC"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARBG_INT" SCONAME="IV_GREEN" VERSION="1" LANGU="E" DESCRIPT="Dummy for B20 int1 (Local Everywhere)" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="NUMERIC"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARBG_INT" SCONAME="IV_BLUE" VERSION="1" LANGU="E" DESCRIPT="Dummy for B20 int1 (Local Everywhere)" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="NUMERIC"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARBG_INT" SCONAME="RV_COLOR_ARGB" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_ARGB"/>
|
||||
<source>METHOD create_new_arbg_int.
|
||||
DATA: lv_red TYPE int1,
|
||||
lv_green TYPE int1,
|
||||
lv_blue TYPE int1,
|
||||
lv_hex TYPE x,
|
||||
lv_char_red TYPE zexcel_style_color_component,
|
||||
lv_char_green TYPE zexcel_style_color_component,
|
||||
lv_char_blue TYPE zexcel_style_color_component.
|
||||
|
||||
lv_red = iv_red MOD 256.
|
||||
lv_green = iv_green MOD 256.
|
||||
lv_blue = iv_blue MOD 256.
|
||||
|
||||
lv_hex = lv_red.
|
||||
lv_char_red = lv_hex.
|
||||
|
||||
lv_hex = lv_green.
|
||||
lv_char_green = lv_hex.
|
||||
|
||||
lv_hex = lv_blue.
|
||||
lv_char_blue = lv_hex.
|
||||
|
||||
|
||||
concatenate zcl_excel_style_color=>c_alpha lv_char_red lv_char_green lv_char_blue into rv_color_argb.
|
||||
|
||||
|
||||
ENDMETHOD.</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARGB" VERSION="1" LANGU="E" DESCRIPT="Create a custom ARGB color from RGB" EXPOSURE="2" STATE="1" EDITORDER="1 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="1" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARGB" SCONAME="IP_RED" VERSION="1" LANGU="E" DESCRIPT="Color Component" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_COMPONENT"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARGB" SCONAME="IP_GREEN" VERSION="1" LANGU="E" DESCRIPT="Color Component" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_COMPONENT"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARGB" SCONAME="IP_BLU" VERSION="1" LANGU="E" DESCRIPT="Color Component" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_COMPONENT"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_STYLE_COLOR" CMPNAME="CREATE_NEW_ARGB" SCONAME="EP_COLOR_ARGB" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="ZEXCEL_STYLE_COLOR_ARGB"/>
|
||||
<source>method CREATE_NEW_ARGB.
|
||||
|
||||
<source>METHOD create_new_argb.
|
||||
|
||||
CONCATENATE zcl_excel_style_color=>c_alpha ip_red ip_green ip_blu INTO ep_color_argb.
|
||||
|
||||
endmethod.</source>
|
||||
ENDMETHOD.</source>
|
||||
</method>
|
||||
</CLAS>
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
DATA: excel TYPE REF TO zcl_excel,
|
||||
reader TYPE REF TO zif_excel_reader,
|
||||
go_error TYPE REF TO cx_root,
|
||||
gv_memid_gr8 TYPE text255,
|
||||
gv_message TYPE string,
|
||||
lv_extension TYPE string,
|
||||
gv_error_program_name TYPE syrepid,
|
||||
gv_error_include_name TYPE syrepid,
|
||||
gv_error_line TYPE i.
|
||||
|
||||
|
||||
CONSTANTS: gc_save_file_name TYPE string VALUE '37- Read template and output.xlsx'.
|
||||
DATA: gc_save_file_name TYPE string VALUE '37- Read template and output.&'.
|
||||
|
||||
SELECTION-SCREEN BEGIN OF BLOCK blx WITH FRAME.
|
||||
PARAMETERS: p_upfile TYPE string DEFAULT 'c:\temp\whatever.xlsx' LOWER CASE.
|
||||
PARAMETERS: p_upfile TYPE string LOWER CASE MEMORY ID gr8.
|
||||
SELECTION-SCREEN END OF BLOCK blx.
|
||||
|
||||
INCLUDE zdemo_excel_outputopt_incl.
|
||||
|
@ -60,6 +60,12 @@ SELECTION-SCREEN END OF BLOCK bl_err.
|
|||
INITIALIZATION.
|
||||
PERFORM setup_listboxes.
|
||||
cmt_dump = text-dum.
|
||||
GET PARAMETER ID 'GR8' FIELD gv_memid_gr8.
|
||||
p_upfile = gv_memid_gr8.
|
||||
|
||||
IF p_upfile IS INITIAL.
|
||||
p_upfile = 'c:\temp\whatever.xlsx'.
|
||||
ENDIF.
|
||||
|
||||
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_upfile.
|
||||
PERFORM f4_p_upfile CHANGING p_upfile.
|
||||
|
@ -275,6 +281,7 @@ FORM read_template RAISING zcx_excel .
|
|||
|
||||
WHEN OTHERS.
|
||||
CREATE OBJECT reader TYPE (lb_read).
|
||||
excel = reader->load_file( p_upfile ).
|
||||
"Use template for charts
|
||||
excel->use_template = abap_true.
|
||||
|
||||
|
@ -296,9 +303,11 @@ FORM write_template RAISING zcx_excel.
|
|||
CASE lv_extension.
|
||||
|
||||
WHEN '.XLSX'.
|
||||
REPLACE '&' IN gc_save_file_name WITH 'xlsx'. " Pass extension for standard writer
|
||||
lcl_output=>output( excel ).
|
||||
|
||||
WHEN '.XLSM'.
|
||||
REPLACE '&' IN gc_save_file_name WITH 'xlsm'. " Pass extension for macro-writer
|
||||
lcl_output=>output( cl_excel = excel
|
||||
iv_writerclass_name = 'ZCL_EXCEL_WRITER_XLSM' ).
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user