Last post Jun 21, 2009 12:54 PM by whighfield
Jun 21, 2009 03:17 AM|My Crystal|LINK
In a web form, i need to read the data from the database and let the user print out the data with a MS word document.
i desided to paste the data to the word document using c# in the server-side. To do this, i need to add the "Microsoft Word 11.0 Object Library" reference to the project. But there are some problems:
1. In some development environment PCs, the reference to the "Microsoft Word 11.0 Object Library" fails indicated by a yellow mark in the "References" folder in VS 2008. The pc is XP and has installed office 2003. In the Add Reference window, the "Microsoft
Word 11.0 Object Library" is there and its path is C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB.
2. When the web site is running in the production environment, the word processing C# code fails to run because there is no Microsoft Word 11.0 Object Library in the production environment servers. I can't just use the "copy and paste" deployment because the
Interop.Microsoft.Office.Core.dll in the bin folder is just a managed wrapper of the office COM. Does the production environment server must install office 2003? Is there any easier way than installing office 2003 in the server?
3. The ready-to-print word document's version is office word 2003, some of the user's the PCs install office 2000 rather than 2003, these PCs can't correctly open the word document.
How can i solve the problems above? Your suggestions or hints are highly appcreciated. Thank you.
Jun 21, 2009 12:54 PM|whighfield|LINK
I hate to say this but don't even bother using Word, as you have found it is problematic at best. Also Microsoft does not even recommend using Word on production servers (to create and update documents) due to how you have to implement the security permissions
for it. So what are your options?
If your data is in a SQL 2005 / 2008 database what about using Reporting Service to generate your print friendly data?
WebSuperGoo has a pdf component that will convert HTML to PDF on the fly
http://www.websupergoo.com/abcpdf-1.htm ( free version with some limitations)