‎2009 May 19 9:32 AM
Hello,
I'm just working in that area of OLE programming. I set up my first Excel sheet but now I want to create a better design. At the moment I only know below features to design the sheet:
SET PROPERTY OF h_f 'Bold' = bold .
SET PROPERTY OF h_f 'ColorIndex' = col.
SET PROPERTY OF h_f 'Size' = groesse.
But what I don't know is e.g. which value represents which coulor for Colorindex? Are there some more parameters to change background coulor of cell, high of a cell, font etc.
Is there a complete catalogue available?
Thank you for your effort.
Norbert
‎2009 May 19 9:40 AM
See the following logic to formatting your sheet.
FORM create_excel.
w_line = 1.
CREATE OBJECT e_appl 'EXCEL.APPLICATION'.
SET PROPERTY OF e_appl 'VISIBLE' = 1.
CALL METHOD OF e_appl 'WORKBOOKS' = e_work.
CALL METHOD OF e_work 'Add' = e_work.
GET PROPERTY OF e_appl 'ActiveSheet' = e_activesheet.
SET PROPERTY OF e_activesheet 'Name' = 'Customer Details'.
LOOP AT t_spfli ASSIGNING <fs_spfli>.
w_tabix = sy-tabix.
w_line = w_line + 1.
LOOP AT t_titles ASSIGNING <fs_titles>.
w_titles = sy-tabix.
CALL METHOD OF e_appl 'Cells' = e_cell
EXPORTING
#1 = 1
#2 = w_titles.
SET PROPERTY OF e_cell 'Value' = <fs_titles>-title.
GET PROPERTY OF e_cell 'Interior' = e_color.
SET PROPERTY OF e_color 'ColorIndex' = 35.
GET PROPERTY OF e_cell 'Font' = e_bold.
SET PROPERTY OF e_bold 'Bold' = 1.
CALL METHOD OF e_appl 'Cells' = e_cell
EXPORTING
#1 = w_line
#2 = w_titles.
CONCATENATE '<fs_spfli>-' <fs_titles>-field
INTO w_field.
ASSIGN (w_field) TO <fs>.
SET PROPERTY OF e_cell 'Value' = <fs>.
GET PROPERTY OF e_cell 'Interior' = e_color.
SET PROPERTY OF e_cell 'ColumnWidth' = 20.
SET PROPERTY OF e_color 'ColorIndex' = 0.
GET PROPERTY OF e_cell 'Font' = e_bold.
SET PROPERTY OF e_bold 'Bold' = 0.
ENDLOOP.
ENDLOOP.
CALL METHOD OF e_work 'SAVEAS'
EXPORTING
#1 = p_file.
CALL METHOD OF e_work 'close'.
CALL METHOD OF e_appl 'QUIT'.
FREE OBJECT e_appl.
ENDFORM. " create_excel
‎2009 May 19 9:51 AM
Hello,
There is a Complete & Very good documentation by SAP available on this URL. Please read this.
Hope your query get solved.
Thanks and regards,
Ramani N