Skip to Content
0
Former Member
Oct 12, 2005 at 06:53 AM

Resize Word-Tables with ABAP

67 Views

Hi,

I have a Problem by creating a Word-Table using the OLE2-Interface!

I created the Table with 5 rows and 3 columns. Everything perfect 😊

But now I want to Resize the first Column. My Code is the following:

CREATE OBJECT o_word 'Word.Application'.

SET PROPERTY OF o_word 'Visible' = '1'.

GET PROPERTY OF o_word 'Documents' = o_documents.
CALL METHOD OF o_documents 'Add'
  EXPORTING
  #1 = 'normal.dot'.

GET PROPERTY OF o_word 'ActiveDocument' = o_actdoc.
GET PROPERTY OF o_word 'Selection' = o_selection.


GET PROPERTY OF o_actdoc 'Tables' = o_tables.
GET PROPERTY OF o_selection 'Range' = o_range.

CALL METHOD OF o_tables 'Add' = o_table
  EXPORTING
  #1 = o_range
  #2 = '5'
  #3 = '3'.

GET PROPERTY OF o_selection 'Columns' = o_column.

CALL METHOD OF o_column 'SetWidth'
  EXPORTING
    #1 = '196.8'
    #2 = '0'.

Unfortunately nothing happened 😔

Can anyone help me?

The VB Code to Set the Width of a column is:

Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=196.8, RulerStyle:=wdAdjustNone