mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-04 17:56:10 +08:00
Demo of modification of theme added
ZDEMO_EXCEL42
This commit is contained in:
parent
f37e6e1b88
commit
f62ee2a037
|
@ -70,7 +70,7 @@
|
|||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_COLOR" SCONAME="IV_TYPE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_COLOR" SCONAME="IV_SRGB" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="ZCL_EXCEL_THEME_COLOR_SCHEME=>T_SRGB" PAROPTIONL="X"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_COLOR" SCONAME="IV_SYSCOLORNAME" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING" PAROPTIONL="X"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_COLOR" SCONAME="IV_SYSCOLORLAST" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="ZCL_EXCEL_THEME_COLOR_SCHEME=>T_SRGB"/>
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_COLOR" SCONAME="IV_SYSCOLORLAST" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="ZCL_EXCEL_THEME_COLOR_SCHEME=>T_SRGB" PAROPTIONL="X"/>
|
||||
<source>method set_color.
|
||||
elements->color_scheme->set_color(
|
||||
exporting
|
||||
|
@ -157,6 +157,12 @@
|
|||
).
|
||||
endmethod. "set_latin_font</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_THEME_NAME" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="11 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="SET_THEME_NAME" SCONAME="IV_NAME" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
|
||||
<source>method set_theme_name.
|
||||
name = iv_name.
|
||||
endmethod.</source>
|
||||
</method>
|
||||
<method CLSNAME="ZCL_EXCEL_THEME" CMPNAME="WRITE_THEME" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="3 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
|
||||
<parameter CLSNAME="ZCL_EXCEL_THEME" CMPNAME="WRITE_THEME" SCONAME="RV_XSTRING" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="XSTRING"/>
|
||||
<source>method write_theme.
|
||||
|
|
110
ZA2X/PROG/ZDEMO_EXCEL42.slnk
Normal file
110
ZA2X/PROG/ZDEMO_EXCEL42.slnk
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PROG NAME="ZDEMO_EXCEL42" VARCL="X" SUBC="1" APPL="*" RSTAT="K" RMAND="001" RLOAD="E" FIXPT="X" UCCHECK="X">
|
||||
<textPool>
|
||||
<language SPRAS="E">
|
||||
<textElement ID="R" ENTRY="Theme manipulation demo" LENGTH="23 "/>
|
||||
</language>
|
||||
</textPool>
|
||||
<source>*&---------------------------------------------------------------------*
|
||||
*& Report ZDEMO_EXCEL42
|
||||
*&
|
||||
*&---------------------------------------------------------------------*
|
||||
*&
|
||||
*&
|
||||
*&---------------------------------------------------------------------*
|
||||
|
||||
REPORT ZDEMO_EXCEL42.
|
||||
type-POOLS: vrm.
|
||||
|
||||
DATA: lo_excel TYPE REF TO zcl_excel,
|
||||
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||
lo_theme TYPE REF TO zcl_excel_theme,
|
||||
lo_style type ref to zcl_excel_style,
|
||||
lv_style_guid type ZEXCEL_CELL_STYLE.
|
||||
DATA: gc_save_file_name TYPE string VALUE '42 Theme Manipulation demo.&'.
|
||||
include zdemo_excel_outputopt_incl.
|
||||
|
||||
initialization.
|
||||
|
||||
|
||||
START-OF-SELECTION.
|
||||
|
||||
|
||||
" Creates active sheet
|
||||
CREATE OBJECT lo_excel.
|
||||
|
||||
" Create a bold / italic style with usage of major font
|
||||
lo_style = lo_excel->add_new_style( ).
|
||||
lo_style->font->bold = abap_true.
|
||||
lo_style->font->italic = abap_true.
|
||||
lo_style->font->scheme = zcl_excel_style_font=>c_scheme_major.
|
||||
lo_style->font->color-rgb = zcl_excel_style_color=>c_red.
|
||||
lv_style_guid = lo_style->get_guid( ).
|
||||
|
||||
" Get active sheet
|
||||
lo_worksheet = lo_excel->get_active_worksheet( ).
|
||||
lo_worksheet->set_title( ip_title = 'Styles' ).
|
||||
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
|
||||
lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_guid ).
|
||||
|
||||
"create theme
|
||||
create object lo_theme.
|
||||
lo_theme->set_theme_name( iv_name = 'Theme Demo 42 A2X' ).
|
||||
lo_theme->set_color_scheme_name( iv_name = 'Demo 42 A2X' ).
|
||||
|
||||
"set theme colors
|
||||
lo_theme->set_color(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_color_scheme=>c_dark1
|
||||
iv_srgb = '5F9EA0'
|
||||
* iv_syscolorname =
|
||||
* iv_syscolorlast =
|
||||
).
|
||||
lo_theme->set_color(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_color_scheme=>c_dark2
|
||||
iv_srgb = 'FFA500'
|
||||
* iv_syscolorname =
|
||||
* iv_syscolorlast =
|
||||
).
|
||||
lo_theme->set_color(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_color_scheme=>c_light1
|
||||
iv_srgb = '778899'
|
||||
* iv_syscolorname =
|
||||
* iv_syscolorlast =
|
||||
).
|
||||
|
||||
lo_theme->set_color(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_color_scheme=>c_light1
|
||||
iv_srgb = '9932CC'
|
||||
* iv_syscolorname =
|
||||
* iv_syscolorlast =
|
||||
).
|
||||
lo_theme->set_font_scheme_name( iv_name = 'Demo 42 A2X' ).
|
||||
|
||||
|
||||
"set theme latin fonts - major and minor
|
||||
lo_theme->set_latin_font(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_font_scheme=>c_major
|
||||
iv_typeface = 'Britannic Bold'
|
||||
* iv_panose =
|
||||
* iv_pitchfamily =
|
||||
* iv_charset =
|
||||
).
|
||||
lo_theme->set_latin_font(
|
||||
exporting
|
||||
iv_type = zcl_excel_theme_font_scheme=>c_minor
|
||||
iv_typeface = 'Broadway'
|
||||
* iv_panose =
|
||||
* iv_pitchfamily =
|
||||
* iv_charset =
|
||||
).
|
||||
"push theme to file
|
||||
lo_excel->set_theme( io_theme = lo_theme ).
|
||||
|
||||
"output
|
||||
lcl_output=>output( cl_excel = lo_excel ).</source>
|
||||
</PROG>
|
Loading…
Reference in New Issue
Block a user