Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OLE programming

Former Member
0 Likes
619

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

2 REPLIES 2
Read only

Former Member
0 Likes
551

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

Read only

former_member229729
Active Participant
0 Likes
551

Hello,

There is a Complete & Very good documentation by SAP available on this URL. Please read this.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/204d1bb8-489d-2910-d0b5-cdddb322...

Hope your query get solved.

Thanks and regards,

Ramani N