.Net Word (docx) generation tool

o3h
o3h used Ask the Experts™
on
Hi Im building a ASP.NET webapp. I need generate DOCX-files from code (not HTML).
Tips? Tutorials?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Luis PérezSoftware Architect in .Net

Commented:
Use Office automation.

http://support.microsoft.com/kb/316383/en-us

Hope that helps.
Commented:
Since you are building a webapp, I assume that  using automation is not an option (my servers don't get a license of Office because no-one is supposed to be working there).
Luckily, docx-files are pretty easy to create since it is essentially a set of xml-files (http://en.wikipedia.org/wiki/Office_Open_XML)
http://openxmldeveloper.org/forums/thread/907.aspx points to a library that you can use.
 
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
You should never use Office Automation on a web server (it is a recommmandation of Microsoft).
You better use http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Top Expert 2005

Commented:
Welcome to the Open XML SDK 2.0 for Microsoft Office
"This content set provides documentation and guidance for the strongly-typed classes in the Open XML SDK 2.0 for Microsoft Office."

http://msdn.microsoft.com/en-us/library/bb448854.aspx 
o3h

Author

Commented:
My needs to generate PDFs too.
Is it possible to first generate to DOCx and then PDF (to make sure they look the same)?
Luis PérezSoftware Architect in .Net

Commented:
Well... that's the theory. I've installed and used office automation in a web server. I've made automation for both Word and Excel applications without any major problem. It's true that in the very first days we had to deal with some many permission issues, but once resolved, all is OK until now.
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
>>Is it possible to first generate to DOCx and then PDF (to make sure they look the same)?
If you use Aspose.Words which I have proposed in your other question, it can save the document as a PDF also.
o3h

Author

Commented:
Ok, so I shouldnt use Office automation, and Aspose is to expensive.
More suggestions?
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial