sitarammani
26th March 2002, 18:57
Formatting Baan output to MS Word
I borrowed the idea of using [Bookmark] feature I found on the net.

Created MSWord Template (as a .doc file)

Created Book marks in the template,where data from Baan will fill in the blanks .

create the output from Baan as follows:
1*Path of output file to be created in the Win-PC-Terminal
2*Path of the template file which should be located in the pc
3*Header, Detail, Footer Indicator
4*The book Mark to be located in the template
5*The value to be placed at the bookmark

The paths[1,2] are captured in the Report Session's Form

The above 5 fields are separted by "|"

The above output file
will be sent to a batch file residing in c:\windows say Baan2Word.bat

Baan2Word.bat will invoke a VB6 program Baan2Word.exe. <>Baan2Word.exe will open the template file
<>Locate the bookmarks and fill in the blanks.
When it senses the line type is detail it will handle the table row in the template file iteratively.
it will save the output doc file as suggested in field 1.

It can handle any number of output files to be created.

Finally it will create a batch file with a Start FileName.Doc for the user to see and print the output.

If you would like to try it
open ms-word
place cursor at some point
Insert+BookMark, provide a name
close the window.
Create as may BookMarks you need.
To view the book marks
Select tools menu, options check bookmarks on ok.
The placed Book marks will be visible as 'I'


Interested?
download the attachment.
the attachment contains:
The Source code for the VB6 program
Copy of the templates
Sample output into ms word
Sample output from Baan for conversion to word

all for free, no strings attached, no warranty, no liability, no damages claimable from me.


Sitaram Mani
Note:
You must ensure there is a "footer" line type
after (all of the) detail line type. The footer bookmark value may also be filled with " ".

BaanTech
11th July 2002, 21:47
Quick question, when you say that you then allow the user
to see the doc and print it is the printing something they
manually do, or is this automated ? eg. Using word macros ?

sitarammani
12th July 2002, 04:56
The user prints the documents manually.
No macros defined anywhere in the document.

dstuchly
7th December 2004, 11:28
Your solution sounds interesting. To test it, the executable Baan2Word.exe ist needed. I am not able to build it from the VB source (I have only Office XP installed but no Visual Basic). Could you help, please?

Thanks.

sitarammani
7th December 2004, 17:52
I am sorry it would be very difficult for me to send you the compiled exe.
I am sure someone around should be able to help out.

~Vamsi
7th December 2004, 18:12
Here is a compiled file. Totally untested.