Application Development 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: 

ABAP OLE Excel - choosing colors & creating borders

Former Member
0 Kudos

Hi,

I am using OLE to create an Excel file, and I want to be able to set a background color of a cell. This is the code that I use to achieve this:

call method of cell_obj 'INTERIOR' = shading_obj.

set property of shading_obj 'ColorIndex' = color.

Color here is an integer from 1 to 56 that identifies some color available in Excel. I got all the color values from this link: http://dmcritchie.mvps.org/excel/colors.htm

Is it possible to choose a color that is not among these 56 colors? Maybe a color identified by hex or some RGB value?

Also, how can I create a border around some range of cells in Excel file?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Actually, I figured it out myself. I should use this code instead:

  CALL METHOD OF lo_cell 'Interior' = lo_interior.
 
SET PROPERTY OF lo_interior 'Color' = 15773696. "Hex color in decimal

1 REPLY 1

Former Member
0 Kudos

Actually, I figured it out myself. I should use this code instead:

  CALL METHOD OF lo_cell 'Interior' = lo_interior.
 
SET PROPERTY OF lo_interior 'Color' = 15773696. "Hex color in decimal