how to generate a Ms word document with C# from sql server data base

Posted by Leoppina under ASP.NET on 8/25/2011 | Points: 10 | Views : 7477 | Status : [Member] | Replies : 4
Hi everybody!

I'm a new Web developper, i've just started working with asp.net on Visual studio.i'm working on a web application wich when i clic on a button on my page go select some information from my SQL server data base and write it on MS Word and Excel documents.
I'm stuck in here, i dont really know how to deal with this.
thx for giving some help! :(




Responses

Posted by: Dhirendra on: 8/26/2011 [Member] Starter | Points: 25

Up
0
Down
IN order to create word document/excel document from web application you have to add reference to com DLL of excel and word (it depends on which version of excel/word installed on your machine)
Once it is done then you can access the word document object model by adding namespace...

Leoppina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 8/26/2011 [Member] Starter | Points: 25

Up
0
Down
here is an examle of word document
http://www.codeproject.com/KB/aspnet/wordapplication.aspx

another example to creating word document through http response..
http://www.dotnetfunda.com/articles/article9.aspx

Leoppina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Leoppina on: 8/26/2011 [Member] Starter | Points: 25

Up
0
Down
Hi;
Thx for ansewering, actually i found that some poeple are talking about "Crystal Report".
what do you think about it?

Leoppina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kukurice on: 4/1/2012 [Member] Starter | Points: 25

Up
0
Down
Crystal reports is a reporting not a document generation toolkit. You must first decide what you need. If you need to create reports and export them as MS Word documents then Crystal reports will do just fine.

But if you want to create documents where you want to use a word-processing editor like MS Word to design and edit them then you will find that reporting toolkits like Crystal reports are quite limited in terms of design. For such scenarios I would recommend you to check out http://www.docentric.com . It is not a free solution but it will save you a lot of time and you don't need to code a lot to produce complex reports and documents.

Just do not use MS Word automation with Office COM. Its not just a bad thing to do. It is wrong, because if you go that direction you will end up with a non responsive, non stable application with memory and process leaks. I'm telling you this because I've already been there. Microsoft itself also strongly discourage developers from doing it.

Leoppina, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response