add column for photographer, improve formatting (#943)

* add column for photographer, improve formatting

* Update src/demos/zdemo_calendar.prog.abap

Co-authored-by: sandraros <34005250+sandraros@users.noreply.github.com>

* Update src/demos/zdemo_calendar.prog.abap

Co-authored-by: sandraros <34005250+sandraros@users.noreply.github.com>

Co-authored-by: sandraros <34005250+sandraros@users.noreply.github.com>
This commit is contained in:
Gregor Wolf 2022-01-02 12:05:16 +01:00 committed by GitHub
parent 9ee01464fc
commit a5e4bb9c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 15 deletions

View File

@ -12,6 +12,7 @@
*& Image Filename *& Image Filename
*& Image Description *& Image Description
*& URL for the Description *& URL for the Description
*& Photographer
*& *&
*& The Images should be landscape JPEG's with a 3:2 ratio and min. *& The Images should be landscape JPEG's with a 3:2 ratio and min.
*& 450 pixel height. They must also be saved in the Export Directory. *& 450 pixel height. They must also be saved in the Export Directory.
@ -33,7 +34,7 @@ PARAMETERS: p_from TYPE dfrom,
p_to TYPE dto. p_to TYPE dto.
SELECTION-SCREEN BEGIN OF BLOCK orientation WITH FRAME TITLE orient. SELECTION-SCREEN BEGIN OF BLOCK orientation WITH FRAME TITLE orient.
PARAMETERS: p_portr TYPE flag RADIOBUTTON GROUP orie, PARAMETERS: p_portr TYPE flag RADIOBUTTON GROUP orie,
p_lands TYPE flag RADIOBUTTON GROUP orie DEFAULT 'X'. p_lands TYPE flag RADIOBUTTON GROUP orie DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK orientation. SELECTION-SCREEN END OF BLOCK orientation.
@ -61,6 +62,8 @@ START-OF-SELECTION.
lv_style_border_guid TYPE zexcel_cell_style. lv_style_border_guid TYPE zexcel_cell_style.
DATA: lo_style_center TYPE REF TO zcl_excel_style, DATA: lo_style_center TYPE REF TO zcl_excel_style,
lv_style_center_guid TYPE zexcel_cell_style. lv_style_center_guid TYPE zexcel_cell_style.
DATA: lo_style_right TYPE REF TO zcl_excel_style,
lv_style_right_guid TYPE zexcel_cell_style.
DATA: lv_full_path TYPE string, DATA: lv_full_path TYPE string,
image_descr_path TYPE string, image_descr_path TYPE string,
@ -92,6 +95,7 @@ START-OF-SELECTION.
filename TYPE string, filename TYPE string,
descr TYPE string, descr TYPE string,
url TYPE string, url TYPE string,
photographer TYPE string,
END OF tt_datatab. END OF tt_datatab.
DATA: image_descriptions TYPE TABLE OF tt_datatab. DATA: image_descriptions TYPE TABLE OF tt_datatab.
@ -154,11 +158,7 @@ START-OF-SELECTION.
" Create Styles " Create Styles
" Create an underline double style " Create an underline double style
lo_style_month = lo_excel->add_new_style( ). lo_style_month = lo_excel->add_new_style( ).
" lo_style_month->font->underline = abap_true. lo_style_month->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right.
" lo_style_month->font->underline_mode = zcl_excel_style_font=>c_underline_single.
lo_style_month->font->name = zcl_excel_style_font=>c_name_roman.
lo_style_month->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_month->font->family = zcl_excel_style_font=>c_family_roman.
lo_style_month->font->bold = abap_true. lo_style_month->font->bold = abap_true.
lo_style_month->font->size = 36. lo_style_month->font->size = 36.
lv_style_month_guid = lo_style_month->get_guid( ). lv_style_month_guid = lo_style_month->get_guid( ).
@ -177,6 +177,10 @@ START-OF-SELECTION.
lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center. lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_center->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top. lo_style_center->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top.
lv_style_center_guid = lo_style_center->get_guid( ). lv_style_center_guid = lo_style_center->get_guid( ).
"Create style alignment right
lo_style_right = lo_excel->add_new_style( ).
lo_style_right->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right.
lv_style_right_guid = lo_style_right->get_guid( ).
" Get Month Names " Get Month Names
CALL FUNCTION 'MONTH_NAMES_GET' CALL FUNCTION 'MONTH_NAMES_GET'
@ -307,7 +311,17 @@ START-OF-SELECTION.
ENDIF. ENDIF.
lo_row = lo_worksheet->get_row( row ). lo_row = lo_worksheet->get_row( row ).
lo_row->set_row_height( '22.0' ). lo_row->set_row_height( '22.0' ).
" Photographer
IF NOT <img_descr>-photographer IS INITIAL.
value = <img_descr>-photographer.
lo_worksheet->set_cell(
EXPORTING
ip_column = to_col_end " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = lv_style_right_guid
).
ENDIF.
" In Landscape mode the row between the description and the " In Landscape mode the row between the description and the
" dates should be not so high " dates should be not so high
IF p_lands = abap_true. IF p_lands = abap_true.

View File

@ -26,7 +26,7 @@
<item> <item>
<ID>I</ID> <ID>I</ID>
<KEY>002</KEY> <KEY>002</KEY>
<ENTRY>Created with abap2xlsx. Find more information at https://github.com/abap2xlsx/abap2xlsx.</ENTRY> <ENTRY>Created with https://github.com/abap2xlsx/abap2xlsx</ENTRY>
<LENGTH>132</LENGTH> <LENGTH>132</LENGTH>
</item> </item>
<item> <item>
@ -84,7 +84,7 @@
<item> <item>
<ID>I</ID> <ID>I</ID>
<KEY>002</KEY> <KEY>002</KEY>
<ENTRY>Erzeugt mit abap2xlsx. Weitere Informationen unter https://github.com/abap2xlsx/abap2xlsx.</ENTRY> <ENTRY>Erzeugt mit https://github.com/abap2xlsx/abap2xlsx</ENTRY>
<LENGTH>132</LENGTH> <LENGTH>132</LENGTH>
</item> </item>
<item> <item>

View File

@ -347,7 +347,7 @@ CLASS zcl_helper IMPLEMENTATION.
DATA: value TYPE string, DATA: value TYPE string,
hyperlink TYPE REF TO zcl_excel_hyperlink. hyperlink TYPE REF TO zcl_excel_hyperlink.
value = 'Created with abap2xlsx. Find more information at https://github.com/abap2xlsx/abap2xlsx.'(002). value = 'Created with https://github.com/abap2xlsx/abap2xlsx'(002).
hyperlink = zcl_excel_hyperlink=>create_external_link( 'https://github.com/abap2xlsx/abap2xlsx' ). "#EC NOTEXT hyperlink = zcl_excel_hyperlink=>create_external_link( 'https://github.com/abap2xlsx/abap2xlsx' ). "#EC NOTEXT
c_worksheet->set_cell( c_worksheet->set_cell(
EXPORTING EXPORTING