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: 

How to give Table cell color in MS Word through SAP OLE ?

0 Kudos

I need to give Cell Background color in a table which should be downloaded as a Word file from SAP ABAP. I know how to color the text, bold, italic, underlined. But I am not able to find the Cell color for a Table which is in a word file, I can get lot of examples for Excel file with cell color not for Word file.

7 REPLIES 7

raymond_giuseppi
Active Contributor

Usually I record a macro in Office to identify the OLE02 methods to be executed, and then translate manually the VBA to Abap.

Regards,
Raymond

0 Kudos

Hi Raymond Giuseppi,

Firstly, thank you Raymond Giuseppi. I did the same and I got to know the tricks for getting it. But still I am not able to find a solution to change the row height for a table, as it cannot be recorded through the MACRO in word. Can I get a help from you regarding this?

Thanks in advance,

Ravivarman P

The code to implement should look like

ActiveDocument.Tables(1).Rows.Height = 20

But beware that the height must not be defaulted by some Atttribute of HeightRule like wdRowHeightAuto.

Regards,
Raymond

0 Kudos

I agree Raymond Giuseppi. This command helps to change for the whole table. I need a particular row's height in a table to be controlled.

Thanks in advance.

Ravivarman P.

For a specific line use (e.g. row 5)

ActiveDocument.Tables(1).Rows(5).Height = 30

Regards,
Raymond

0 Kudos

Hi Raymond Giuseppi,

For more clarification,

In this code ActiveDocument.Tables(1).Rows(5).Height = 30.

Tables(1) denotes that the name of the table is 'Tables'.

Height = 30 denotes 30 cm or inch.

If the equivalent OLE code is there it would be more helpful.

Thanks in advance.

Ravivarman P

0 Kudos

I agree Raymond Giuseppi. This command helps to change for the whole table. I need a particular row's height in a table to be controlled.

Thanks in advance.

Ravivarman P.