Generating Word document from information in Database



Hi all, I'm a novice VB.NET and VBA programmer and am wondering if there is a tutorial out there on how to create a word document based on data in a database and then return that document to a web user. I'm using Visual Studio .Net 2003 for my IDE

I am familiar enough with VBA to be able to write all the code to generate the document, it is just that I'm not certain how to create the word document in memory and not have Office pop-up on the server. So my first question is
1. What code do I write in VB (and what imports do I use) such that office doesn't pop-up on the server

I'm also wondering whether I should just do the following

Response.ContentType = "application/msword
and then just iterate over the word document line by line and do a
for each line of the documen

or whether I should actually generate the file on the server and cache it in the file system and then redirect the user to the location of that file on the server. So my second question is
2. Should I write the response directly to the output stream or should I cache the file and redirect the user

I suppose question 2 really depends on how static the content is and whether there is any value in caching the data - in all likelyhood there would be no real value in caching it since it changes so ofte

Lastly, I also have to look into generating PDF's - for now I suppose I can do a binding using Crystal Reports to generate them



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question