abap2xlsx/ZA2X/PROG/ZDEMO_EXCEL2.slnk
Ivan fde89c9625 Several Fixes and Include Pull Request #350
Added the pull request #350 "Gradient Fill -> writer + demo programs 2 &
34" manually
Fixed ZEXCEL_DEMO report, bug after fix #345
Excel common has a bug, right now I used a quick and really dirty
solution
2015-01-09 18:07:01 -06:00

340 lines
22 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<PROG NAME="ZDEMO_EXCEL2" VARCL="X" SUBC="1" RSTAT="T" RMAND="001" RLOAD="E" FIXPT="X" UCCHECK="X">
<textPool>
<language SPRAS="E">
<textElement ID="R" ENTRY="abap2xlsx Demo: Styles" LENGTH="25 "/>
<textElement ID="S" KEY="P_PATH" ENTRY="D ." LENGTH="9 "/>
</language>
</textPool>
<source>*&amp;---------------------------------------------------------------------*
*&amp; Report ZDEMO_EXCEL2
*&amp; Test Styles for ABAP2XLSX
*&amp;---------------------------------------------------------------------*
*&amp;
*&amp;
*&amp;---------------------------------------------------------------------*
REPORT zdemo_excel2.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_bold TYPE REF TO zcl_excel_style,
lo_style_underline TYPE REF TO zcl_excel_style,
lo_style_filled TYPE REF TO zcl_excel_style,
lo_style_border TYPE REF TO zcl_excel_style,
lo_style_button TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border,
lo_border_light TYPE REF TO zcl_excel_style_border.
DATA: lv_style_bold_guid TYPE zexcel_cell_style,
lv_style_underline_guid TYPE zexcel_cell_style,
lv_style_filled_guid TYPE zexcel_cell_style,
lv_style_filled_green_guid TYPE zexcel_cell_style,
lv_style_border_guid TYPE zexcel_cell_style,
lv_style_button_guid TYPE zexcel_cell_style,
lv_style_filled_turquoise_guid TYPE zexcel_cell_style,
lv_style_gr_cornerlb_guid TYPE zexcel_cell_style,
lv_style_gr_cornerlt_guid TYPE zexcel_cell_style,
lv_style_gr_cornerrb_guid TYPE zexcel_cell_style,
lv_style_gr_cornerrt_guid TYPE zexcel_cell_style,
lv_style_gr_horizontal90_guid TYPE zexcel_cell_style,
lv_style_gr_horizontal270_guid TYPE zexcel_cell_style,
lv_style_gr_horizontalb_guid TYPE zexcel_cell_style,
lv_style_gr_vertical_guid TYPE zexcel_cell_style,
lv_style_gr_vertical2_guid TYPE zexcel_cell_style,
lv_style_gr_fromcenter_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal45_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal45b_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal135_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal135b_guid TYPE zexcel_cell_style .
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
DATA: lo_row_dim TYPE REF TO zcl_excel_worksheet_rowdimensi.
CONSTANTS: gc_save_file_name TYPE string VALUE &apos;02_Styles.xlsx&apos;.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
&quot; Creates active sheet
CREATE OBJECT lo_excel.
&quot; Create border object
CREATE OBJECT lo_border_dark.
lo_border_dark-&gt;border_color-rgb = zcl_excel_style_color=&gt;c_black.
lo_border_dark-&gt;border_style = zcl_excel_style_border=&gt;c_border_thin.
CREATE OBJECT lo_border_light.
lo_border_light-&gt;border_color-rgb = zcl_excel_style_color=&gt;c_gray.
lo_border_light-&gt;border_style = zcl_excel_style_border=&gt;c_border_thin.
&quot; Create a bold / italic style
lo_style_bold = lo_excel-&gt;add_new_style( ).
lo_style_bold-&gt;font-&gt;bold = abap_true.
lo_style_bold-&gt;font-&gt;italic = abap_true.
lo_style_bold-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_arial.
lo_style_bold-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_none.
lo_style_bold-&gt;font-&gt;color-rgb = zcl_excel_style_color=&gt;c_red.
lv_style_bold_guid = lo_style_bold-&gt;get_guid( ).
&quot; Create an underline double style
lo_style_underline = lo_excel-&gt;add_new_style( ).
lo_style_underline-&gt;font-&gt;underline = abap_true.
lo_style_underline-&gt;font-&gt;underline_mode = zcl_excel_style_font=&gt;c_underline_double.
lo_style_underline-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_roman.
lo_style_underline-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_none.
lo_style_underline-&gt;font-&gt;family = zcl_excel_style_font=&gt;c_family_roman.
lv_style_underline_guid = lo_style_underline-&gt;get_guid( ).
&quot; Create filled style yellow
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_solid.
lo_style_filled-&gt;fill-&gt;fgcolor-theme = zcl_excel_style_color=&gt;c_theme_accent6.
lv_style_filled_guid = lo_style_filled-&gt;get_guid( ).
&quot; Create border with button effects
lo_style_button = lo_excel-&gt;add_new_style( ).
lo_style_button-&gt;borders-&gt;right = lo_border_dark.
lo_style_button-&gt;borders-&gt;down = lo_border_dark.
lo_style_button-&gt;borders-&gt;left = lo_border_light.
lo_style_button-&gt;borders-&gt;top = lo_border_light.
lv_style_button_guid = lo_style_button-&gt;get_guid( ).
&quot;Create style with border
lo_style_border = lo_excel-&gt;add_new_style( ).
lo_style_border-&gt;borders-&gt;allborders = lo_border_dark.
lo_style_border-&gt;borders-&gt;diagonal = lo_border_dark.
lo_style_border-&gt;borders-&gt;diagonal_mode = zcl_excel_style_borders=&gt;c_diagonal_both.
lv_style_border_guid = lo_style_border-&gt;get_guid( ).
&quot; Create filled style green
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_solid.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_green.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_filled_green_guid = lo_style_filled-&gt;get_guid( ).
&quot; Create filled with gradients
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_cornerlb.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_cornerlb_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_cornerlt.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_cornerlt_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_cornerrb.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_cornerrb_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_cornerrt.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_cornerrt_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_horizontal90.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_horizontal90_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_horizontal270.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_horizontal270_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_horizontalb.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_horizontalb_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_vertical.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_vertical_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_vertical.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_vertical2_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_fromcenter.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_fromcenter_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal45.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_diagonal45_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal45b.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_diagonal45b_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal135.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_diagonal135_guid = lo_style_filled-&gt;get_guid( ).
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal135b.
lo_style_filled-&gt;fill-&gt;fgcolor-rgb = zcl_excel_style_color=&gt;c_blue.
lo_style_filled-&gt;fill-&gt;bgcolor-rgb = zcl_excel_style_color=&gt;c_white.
lo_style_filled-&gt;font-&gt;name = zcl_excel_style_font=&gt;c_name_cambria.
lo_style_filled-&gt;font-&gt;scheme = zcl_excel_style_font=&gt;c_scheme_major.
lv_style_gr_diagonal135b_guid = lo_style_filled-&gt;get_guid( ).
&quot; Create filled style turquoise using legacy excel ver &lt;= 2003 palette. (https://code.sdn.sap.com/spaces/abap2xlsx/tickets/92)
lo_style_filled = lo_excel-&gt;add_new_style( ).
lo_excel-&gt;legacy_palette-&gt;set_color( &quot;replace built-in color from palette with out custom RGB turquoise
ip_index = 16
ip_color = &apos;0040E0D0&apos; ).
lo_style_filled-&gt;fill-&gt;filltype = zcl_excel_style_fill=&gt;c_fill_solid.
lo_style_filled-&gt;fill-&gt;fgcolor-indexed = 16.
lv_style_filled_turquoise_guid = lo_style_filled-&gt;get_guid( ).
&quot; Get active sheet
lo_worksheet = lo_excel-&gt;get_active_worksheet( ).
lo_worksheet-&gt;set_title( ip_title = &apos;Styles&apos; ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 2 ip_value = &apos;Hello world&apos; ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 3 ip_value = &apos;Bold text&apos; ip_style = lv_style_bold_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;D&apos; ip_row = 4 ip_value = &apos;Underlined text&apos; ip_style = lv_style_underline_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 5 ip_value = &apos;Filled text&apos; ip_style = lv_style_filled_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 6 ip_value = &apos;Borders&apos; ip_style = lv_style_border_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;D&apos; ip_row = 7 ip_value = &apos;I&apos;&apos;m not a button :)&apos; ip_style = lv_style_button_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 9 ip_value = &apos;Modified color for Excel 2003&apos; ip_style = lv_style_filled_turquoise_guid ).
&quot; Fill the cell and apply one style
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 6 ip_value = &apos;Filled text&apos; ip_style = lv_style_filled_guid ).
&quot; Change the style
lo_worksheet-&gt;set_cell_style( ip_column = &apos;B&apos; ip_row = 6 ip_style = lv_style_filled_green_guid ).
&quot; Add Style to an empty cell to test Fix for Issue
&quot;#44 Exception ZCX_EXCEL thrown when style is set for an empty cell
&quot; https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell
lo_worksheet-&gt;set_cell_style( ip_column = &apos;E&apos; ip_row = 6 ip_style = lv_style_filled_green_guid ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 10 ip_style = lv_style_gr_cornerlb_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_cornerlb ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 10 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 11 ip_style = lv_style_gr_cornerlt_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_cornerlt ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 11 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 12 ip_style = lv_style_gr_cornerrb_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_cornerrb ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 12 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 13 ip_style = lv_style_gr_cornerrt_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_cornerrt ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 13 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 14 ip_style = lv_style_gr_horizontal90_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_horizontal90 ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 14 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 15 ip_style = lv_style_gr_horizontal270_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_horizontal270 ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 15 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 16 ip_style = lv_style_gr_horizontalb_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_horizontalb ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 16 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 17 ip_style = lv_style_gr_vertical_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_vertical ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 17 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 18 ip_style = lv_style_gr_vertical2_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_vertical ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 18 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 19 ip_style = lv_style_gr_fromcenter_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_fromcenter ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 19 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 20 ip_style = lv_style_gr_diagonal45_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal45 ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 20 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 21 ip_style = lv_style_gr_diagonal45b_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal45b ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 21 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 22 ip_style = lv_style_gr_diagonal135_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal135 ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 22 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 23 ip_style = lv_style_gr_diagonal135b_guid ip_value = zcl_excel_style_fill=&gt;c_fill_gradient_diagonal135b ).
lo_row_dim = lo_worksheet-&gt;get_row_dimension( ip_row = 23 ).
lo_row_dim-&gt;set_row_height( ip_row_height = 30 ).
* CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
* lv_file = lo_excel_writer-&gt;write_file( lo_excel ).
*
* &quot; Convert to binary
* CALL FUNCTION &apos;SCMS_XSTRING_TO_BINARY&apos;
* EXPORTING
* buffer = lv_file
* IMPORTING
* output_length = lv_bytecount
* TABLES
* binary_tab = lt_file_tab.
** &quot; This method is only available on AS ABAP &gt; 6.40
** lt_file_tab = cl_bcs_convert=&gt;xstring_to_solix( iv_xstring = lv_file ).
** lv_bytecount = xstrlen( lv_file ).
*
* &quot; Save the file
* cl_gui_frontend_services=&gt;gui_download( EXPORTING bin_filesize = lv_bytecount
* filename = lv_full_path
* filetype = &apos;BIN&apos;
* CHANGING data_tab = lt_file_tab ).
lcl_output=&gt;output( lo_excel ).</source>
</PROG>