cancel
Showing results for 
Search instead for 
Did you mean: 

Ole2 to Excel: Column and Row Properties

Former Member
0 Kudos

Does anybody knows how can I give format to columns and rows to an MS Excel sheet created with Ole2.

I want to give columns width, and to fit to text.

Thanks.

Message was edited by: Joaquin Da Silva

Accepted Solutions (1)

Accepted Solutions (1)

ssimsekler
Active Contributor
0 Kudos

Hi Joaquin

I believe this will do your work:


....
DATA gs_range TYPE ole2_object .
....
*--Creating OLE object for MS Excel
....

CALL METHOD OF gs_excel 'Range' = gs_range 
     EXPORTING #1 = 'A:A' .
SET PROPERTY OF gs_range 'ColumnWidth' = '20' .
SET PROPERTY OF gs_range 'ShrinkToFit' = '1' .
....

Hope this helps...

*--Serdar

Answers (1)

Answers (1)

Former Member
0 Kudos

It works, thank you very much.

Do you know where can I find a list of all the properties I can set??.

Now I want to give borders to cells and I'm having the same problem trying to find how to work it out.

Former Member
0 Kudos

Hi Joaquin,

To find out what possible methods and/or properties you could use, you simply need to startup MS Excel (and with a worksheet active).

Open the visual basic editor (Menu: Extra -> Macro -> Visual Basic Editor , or press Alt+F11).

Herein open the Object viewer (Menu: View -> Object overview , or press F2).

Switch from All Libraries to only Excel Library and there you'll find all the possible details.

Left all the classes and Right all the component of a selected class.

For example to modify borders of a cell you will need to have class CellFormat and for the colors Class Interior.

Hope this answers your question.

Regards,

Rob.

ssimsekler
Active Contributor
0 Kudos

Hi Joaquin

<u>Firstly</u>, Rob's explanation is the best way to retrieve information about OLE methods and properties.

<u>Secondly</u>;

Happy that you have solved your question. Would you like to reward points for useful answers?

To do so, first you should convert your thread as a question thread. You can achieve this by editing your first post and checking the relevant checkbox and then saving it.

After this step, each post (except yours) will have a yellow star at its header. You can assign points to each post by clicking that yellow star at its header. You can reward;

- one 10 points (solved)

- two 6 points (very helpful answer)

- many 2 points (helpful answer)

This is the way to thank contributing people at SDN.

Kind regards

*--Serdar

Former Member
0 Kudos

Hi Rob,

Could you help me in issues of plotting Excel graphs using ABAP - OLE. This will help me a lot.

The requirement is:-

I am able to plot a graph for the data in ABAP program. But the graph gets plotted for all the Excel columns and I need graph only for few columns. How do I select only a few columns.

Secondly, the chart types need to be different for different worksheet wcolumns as this is not the case.

If you could provide some code sample, this will help a lot.

Thanks in advance.

Regards,

Vinayak Kale