As part of an investigation into enterprise level server side document generation I have come across Open XML.
- For those that have used this, how successful were you? Would you recommend it?
- Can you save the OpenXML to PDF directly or would I need to make use of a 3rd party component?
- If a 3rd Party component is required, which one did you use and which one would you recommend?
Thanks
Gineer
The nice thing about the Office OpenXML is that it's the language of Microsoft Office -- if you live your "office life" in Word and Excel (2007 and later), that's the format you want.
Can you "save" OpenXML directly to PDF? No, it needs to be rendered by some third-party component.
If you're doing document generation on the server side and you don't need to be working with Office documents as output, you'd generally use something like iText or iTextSharp, which would render the PDFs directly.
I haven't worked with a server-side component that will do the translation from Office OpenXML to PDF, though.
There are various third party components for the OpenXML to PDF piece. I maintain the open source docx4j, which is one option.
If you are doing document generation, you may find you need repeats and conditionals. For suggestions on how to do this, see http://dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.html
For converting DOCX to PDF even with placeholders, I have created a free "Report-From-DocX-HTML-To-PDF-Converter" library with .NET CORE under the MIT license, because I was so unnerved that no simple solution existed and all the commercial solutions were super expensive. You can find it here with an extensive description and an example project: https://github.com/smartinmedia/Net-Core-DocX-HTML-To-PDF-Converter
It can perform these conversions (alongside a template / report engine, which replaces placeholders):
- DOCX to DOCX
- DOCX to PDF
- DOCX to HTML
- HTML to HTML
- HTML to PDF
- HTML to DOCX
You can add placeholders for:
- texts
- repeating table rows
- images
来源:https://stackoverflow.com/questions/3651880/save-open-xml-as-pdf