Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Document Creation

Status
Not open for further replies.

unicorn11

Programmer
Jun 10, 2000
392
0
0
IN
Hi Everybody !

I have to create a word document that contains data that is stored in a database when a user clicks HTML link.

I created a VB DLL to accomplish this. In this DLL I have used the word object msword8.olb. It is also requires that the data come is a specific format (according to a template). This dll opens the word application then opens the template fills the data from the database and saves it with a different name

The template contains Images, Tables and Objects like Lines and Textboxes that need to be created

There are two problems
1. First the component utilizes 100% of the CPU process
2. MS word should be installed on the server

Is there any method that can be used that without word being installed on the server we can create a document that meets all the requirements like Tables and images etc.

Regards Unicorn11
unicorn11@mailcity.com
[red]We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. --- Plato [red]
 
It can be done, but it's really not worth the effort. Basically, you have to know all the appropriate encoding that Word is performing in order to create a file with the proper data structure to be recognized as a Word document and rendered by MS Word. In effect, you have to do everything that Word is already doing for you - rewriting (that part of) the programs functionality in your own program or DLL. There ARE other programs out there that will read/write documents in Word format, so a search on the internet might find something you can use.
 
I have done so many searches on the net and have not yet got a result

If you have any link like this then if you could post them up

regards Unicorn11
unicorn11@mailcity.com
[red]We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. --- Plato [red]
 
I ma not sure how much programming functionality this exposes to VB, but an alternative to Microsoft Office is Star Office (it can read and write Word documents). Even if it does not expose a function already to do what you want it is an open source product, so hopefully it will be useful to you. Check it out at:


Also, I think you may be able to find file format information at - you'll see links to that site on the Star Office website too.
 
I have done this with RTF, I wrote a component that reads from an RTF File (You can create one in word, and it will act very similar to the word Document, with images and all) Then all you need to do is a replace on the fields that you specify, in mine I used a special <<FieldName>> around the fields in the template. Then just return the string from the method. Do a Binary Write on the ASP page, and set the content type to &quot;Application/MSWord&quot;, and the ASP Page is rendered as a word document within the browser. Best of all, you don't need Word installed.

Hope this helps, Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top