ruby-docx / docx

a ruby library/gem for interacting with .docx files
MIT License
431 stars 170 forks source link

RFC: Ability to create a new document file #141

Open alvinpeters opened 12 months ago

alvinpeters commented 12 months ago

Problem

This gem provides you no way of generating a .docx file, which would have been nice to have to give the user a blank slate to work on. There are gems that can generate a .docx file like puredocx (https://github.com/jetruby/puredocx) and caracal (https://github.com/urvin-compliance/caracal) but they are kinda mothballed right now.

Requesting for comments because I don't know whether this gem should even bother with document generation, but I reckon it'd be a nice feature to have. Guess this will somehow solve #54 lol

Solution

Give the Document.new or a new Document.create method the ability to create a new .docx file either by using the template XMLs shipped with the gem like puredocx (https://github.com/jetruby/puredocx/tree/master/lib/template) or through whatever caracal uses (haven't read much of its code yet lol.) I can submit a prototype PR next week I reckon.

Alternative solutions

None, maybe it's just out of scope then that's alright too.

jeremedia commented 9 months ago

Would also appreciate and use a new document option.