DEV Community

Discussion on: How does one create MS Office documents programmatically?

Collapse
 
ewbi profile image
ewbi

In addition to slaying the OpenXML beast, we have in the past also gen'd documents in HTML and RTF formats, both of which Word is quite good at opening and are both significantly easier to target. In fact, you can give an HTML file a DOC extension and/or return it from the server with a content-type of application/msword, and Word will happily open it.

The right approach will depend in part on how complex the documents are, whether they include complex elements like sections, headers/footers, columns, fields, etc., which suggests OpenXML (or a library to do the same), or if it's just paragraphs and styling, in which case HTML (or RTF) might suffice more easily.

Good luck!