View Full Version : fetching dat from database and posting to word document

12-29-2004, 12:15 PM
iam able to get the data from database but not able to post them to a word document, is anyone there who knows how to do this? and i am using back end as sql server and front end as asp.

12-29-2004, 04:37 PM
1. You have the data.

2. Now you need to pass it into word automatically. Correct?

There are a lot of ways of doing this. I've done office automation before, but with powerpoint and excel, but I think I can help. You create some program that sucks out the data and creates the appropriate document.

Possible options (and there will be more)

1. If you have Office 2003, this will be easier, at least that's my initial guess. Office 2003 has a lot more xml built into it and the schemas are available. This means that you can create a word xml file from the data that you've gathered. Now, this all presumes that you know some xml programming. This can be done in any language, though I like java and c# for this.

2. If you know c++, you can tap right into the power of word. You can create a .doc document and fill it in with the info you want. Google something like microsoft word c++ automation. You'll find links that'll help. There are msdn docs out there on this. That's how I did the excel and pp code.

3. Google java and office automation. I know there were some wrappers developed for this as well. I cannot remember the names, and to be quite honest found writing my own jni code to be easier and more stable. I easily could've been using the packages incorrectly, in any case you'll learn much more by doing it yourself. With this you'll have to be familiar with c++ and java.

4. You might be able to use vba. Not sure about this approach. An idea though.

There are probably more. There are. You could look into the html output of a saved html file from word and crack it. This would take a bit, but would be possible. The other options are better. Anyways, check these out and I'll be glad to assist you. This shoudn't be that bad. Just a lot of options and you have to choose what will work best for you. Good luck.