Application Development and Automation 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: 
Read only

Convert flat file to word document

Former Member
0 Likes
366

Hello,

Any pointers as how to acheive if we want to convert a flat file into a meanigful word output.

approach: I want to add some lines of introduction to the word document ,

then add some data from the flat file,

again some explanation to the data and then again a bunch of data..

earlier i had posted the post and Ch@ndra had replied giving some inputs,

What I could understand, we can create a new word file and add some text to it,

But how we combine the the selected flat file data and some text.

posting the code which Ch@ndra posted me ..

INCLUDE ole2incl.

DATA: word TYPE ole2_object,

documentos TYPE ole2_object,

documento TYPE ole2_object,

selection TYPE ole2_object,

font TYPE ole2_object.

CREATE OBJECT word 'WORD.APPLICATION'.

CALL METHOD OF word 'Documents' = documentos.

CALL METHOD OF documentos 'Add' = documento.

CALL METHOD OF documento 'Activate'.

GET PROPERTY OF word 'Selection' = selection.

GET PROPERTY OF selection 'Font' = font.

SET PROPERTY OF word 'Visible' = 1.

SET PROPERTY OF font 'Name' = 'Arial'.

SET PROPERTY OF font 'Size' = 10.

SET PROPERTY OF font 'Bold' = 1. "o 0

SET PROPERTY OF font 'Underline' = 1. "o 0

CALL METHOD OF selection 'TypeText' EXPORTING #1 = 'Assesment Tool'.

CALL METHOD OF selection 'TypeParagraph'.

CALL METHOD OF documento 'SaveAs' EXPORTING #1 = 'c:\test.doc'.

CALL METHOD OF word 'Quit'.

any other commands availbale to convert the data into table and other forms.

thanks

Hello,

Any pointers as how to acheive if we want to convert a flat file into a meanigful word output.

approach: I want to add some lines of introduction to the word document ,

then add some data from the flat file,

again some explanation to the data and then again a bunch of data..

earlier i had posted the post and Ch@ndra had replied giving some inputs,

What I could understand, we can create a new word file and add some text to it,

But how we combine the the selected flat file data and some text.

posting the code which Ch@ndra posted me ..

INCLUDE ole2incl.

DATA: word TYPE ole2_object,

documentos TYPE ole2_object,

documento TYPE ole2_object,

selection TYPE ole2_object,

font TYPE ole2_object.

CREATE OBJECT word 'WORD.APPLICATION'.

CALL METHOD OF word 'Documents' = documentos.

CALL METHOD OF documentos 'Add' = documento.

CALL METHOD OF documento 'Activate'.

GET PROPERTY OF word 'Selection' = selection.

GET PROPERTY OF selection 'Font' = font.

SET PROPERTY OF word 'Visible' = 1.

SET PROPERTY OF font 'Name' = 'Arial'.

SET PROPERTY OF font 'Size' = 10.

SET PROPERTY OF font 'Bold' = 1. "o 0

SET PROPERTY OF font 'Underline' = 1. "o 0

CALL METHOD OF selection 'TypeText' EXPORTING #1 = 'Assesment Tool'.

CALL METHOD OF selection 'TypeParagraph'.

CALL METHOD OF documento 'SaveAs' EXPORTING #1 = 'c:\test.doc'.

CALL METHOD OF word 'Quit'.

any other commands availbale to convert the data into table and other forms.

thanks

1 REPLY 1
Read only

Former Member
0 Likes
289

Dhruv,

GO to Tcode SE83->Controls>Click on Desktop office integration

right side you will get one screen.Goto examples tab strip.Here you will find very good examples.

Pls. reward for all useful answers.