I need to output a file in the format of a Word document from a Ruby-based web app (Rails/Sinatra) based on some textual content in the app. Is there library support in Ruby for creating and structuring a Word document?
views:
359answers:
3
+2
Q:
What's the best way to programmatically output a file in the format of a Word document in Ruby?
+4
A:
Take a look at WordML, the XML format for Word files.
John Durant's blog has a useful list of WordML and FAQ resources
Walkthrough: Word 2007 XML Format
Useful tool for creating XSLT transforms: Office 2003 Tool: WordprocessingML Transform Inference Tool
These SO posts might also be of interest:
Mitch Wheat
2009-05-02 01:26:58
+2
A:
You don't specify what "a Word document" means exactly. Is it a Word 2003-style doc file? Is it a Word 2007 docx file? Is it just something Word can open than supports styling?
If the latter is what you want, you could use RTF, which is somewhat easier than the doc format. There is a library called Ruby RTF that should do what you want, though I've honestly never used it myself.
Chuck
2009-05-02 02:02:42