Giter Site home page Giter Site logo

jawspeak / ruby-docx-templater Goto Github PK

View Code? Open in Web Editor NEW
144.0 144.0 52.0 281 KB

A Ruby library to template Microsoft Word .docx files. Generates new Word .docx files based on a template file. Does templating entirely in memory.

License: Apache License 2.0

Ruby 100.00%

ruby-docx-templater's People

Contributors

btucker avatar craftzdog avatar jawspeak avatar tamird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-docx-templater's Issues

uninitialized constant DocxTemplater::DocxCreator::Zip

Hello,

This project looks really interesting !

I'm trying to test it independently to determine if it does what I need :
https://github.com/aurels/ruby-docx-templater-example

When running with file :
https://github.com/aurels/ruby-docx-templater-example/blob/master/run.rb

I get this NameError :

bundle exec ruby run.rb 
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in `read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError)
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:in `generate_docx_bytes'
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in `generate_docx_file'
  from run.rb:14:in `<main>'
aurels@ruby-docs-templater-test[]: bundle exec ruby run.rb 
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in `read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError)
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:in `generate_docx_bytes'
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in `generate_docx_file'
  from run.rb:13:in `<main>'    

Is something missing in the Gemfile ?
https://github.com/aurels/ruby-docx-templater-example/blob/master/Gemfile

Thanks,

Aurélien

Nested tables?

Is it possible to have a nested table?

e.g. for the example to have an array for attendence -- and create an inner table with another #BEGIN_ROW:ATTENDENCE# ?

Unmatched Template Error

<w:p>
  <w:pPr>
    <w:pStyle w:val="Body 2"/>
    <w:bidi w:val="0"/>
  </w:pPr>
  <w:r>
    <w:t>#BEGIN_ROW:EXPERIENCES_TITLE#</w:t>
  </w:r>
</w:p>
<w:p>
  <w:pPr>
    <w:pStyle w:val="Heading"/>
    <w:bidi w:val="0"/>
  </w:pPr>
  <w:r>
    <w:rPr>
      <w:rFonts w:ascii="Didot" w:cs="Arial Unicode MS" w:hAnsi="Arial Unicode MS" w:eastAsia="Arial Unicode MS"/>
      <w:rtl w:val="0"/>
    </w:rPr>
    <w:t>$EACH:EXPERIENCE_TITLE$</w:t>
  </w:r>
</w:p>
<w:p>
  <w:pPr>
    <w:pStyle w:val="Body 2"/>
    <w:bidi w:val="0"/>
  </w:pPr>
  <w:r>
    <w:t>#END_ROW:EXPERIENCES_TITLE#</w:t>
  </w:r>
</w:p>

I'm zipping the following xml into a docx template. (I'm not posting the entire xml doc)

And I'm inserting the following data into the template:
{'experiences_title' => [{'experience_title' => "Experience"}}

It doesn't seem to recognize any of my row markers. When I try to generate the doc, I'm getting:

unmatched template markers: #BEGIN_ROW:EXPERIENCES_TITLE# nil: true, #END_ROW:EXPERIENCES_TITLE# nil: true. This could be because word broke up tags with it's own xml entries. See README.

Documentation

Hey, would it be possible to get a quick docu or how to guide for using this gem? Would be great, thanks!

Looping without table

Hi. Looping works when I use within the table. When I'm not using table and do looping, it's not working and m getting error... Let me know if any further details are required

All caps for keys. Why?

Just a question:
Is there a reason for using all caps on the keys?
In my forked repo I removed all upcase methods and it works for now.

I did that to get keys that are more human readable ...so i could display it in a web frontend.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.