Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As has been noted, there don't appear to be any libraries to manipulate Open XML documents in Ruby, but <a href="http://openxmldeveloper.org/" rel="noreferrer">OpenXML Developer</a> has complete documentation on the format of Open XML documents.</p> <p>If what you want is to send a copy of a standard document (like a form letter) customized for each user, it should be fairly simple given that a DOCX is a ZIP file that contains various parts in a directory hierarchy. Have a DOCX "template" that contains all the parts and tree structure that you want to send to <code>all</code> users (with no real content), then simply create new (or modify existing) pieces that contain the user-specific content you want and inject it into the ZIP (DOCX file) before sending it to the user.</p> <p>For example: You could have <code>document-template.xml</code> that contains <em>Dear [USER-PLACEHOLDER]:</em>. When a user requests the document, you replace <code>[USER-PLACEHOLDER]</code> with the user's name, then add the resulting <code>document.xml</code> to the <code>your-template.docx</code> ZIP file (which would contain all the images and other parts you want in the Word document) and send that resulting document to the user.</p> <p>Note that if you rename a <code>.docx</code> file to <code>.zip</code> it is trivial to explore the structure and format of the parts inside. You can remove or replace images or other parts very easily with any ZIP manipulation tools or programmatically with code.</p> <p>Generating a brand new Word document with completely custom content from raw XML would be very difficult without access to an API to make the job easier. If you really need to do that, you might consider installing <a href="http://www.mono-project.com/Main_Page" rel="noreferrer">Mono</a>, then use VB.NET, C# or <a href="http://www.ironruby.net/" rel="noreferrer">IronRuby</a> to create your Open XML documents using the <a href="http://msdn.microsoft.com/en-us/library/bb448854.aspx" rel="noreferrer">Open XML Format SDK 1.0</a>. Since you would just be using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.documentformat.openxml.packaging.aspx" rel="noreferrer">Microsoft.Office.DocumentFormat.OpenXml.Packaging Namespace</a> to manipulate Open XML documents, it should work okay in Mono, which seems to support everything the SDK requires.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload