Skip to Content
0
Former Member
Dec 09, 2011 at 02:15 PM

Create Word Document using OLE and contain table

1652 Views

Hi,

I have been looking at various blogs etc to get example programs to create a word document using OLE. Some of these programs have code in them to create a table on the document.

For some reason the table is not being shown on the document and I cannot figure out why.

Has anybody got this to work so that a table will appear on a word document .

This is the logic I have: -

 CALL METHOD OF gs_tables 'Add' = gs_table
  EXPORTING
  #1 = gs_range " Handle for range entity
  #2 = '3' "Number of rows
  #3 = '2'. "Number of columns

*--Setting border attribute for the table
  GET PROPERTY OF gs_table 'Borders' = gs_table_border .
  SET PROPERTY OF gs_table_border 'Enable' = '1' . "With border
*--Filling the table with dummy data
*--Reseting font attributes for table content
  SET PROPERTY OF gs_font 'Name' = 'Garamond' .
  SET PROPERTY OF gs_font 'Size' = '11' .
  SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
  SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
  SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Getting cell coordinates
  CALL METHOD OF gs_table 'Cell' = gs_cell
  EXPORTING
  #1 = '1' "first row
  #2 = '1'. "first column

*--Getting the range handle to write the text
  GET PROPERTY OF gs_cell 'Range' = gs_range .
*--Filling the cell
  SET PROPERTY OF gs_range 'Text' = 'OLE' .

Thanks

Martin