Sha256: 17e9bd7fb44bc1713a706766dd4aad4145d327cdee0871c7a93a22c03bbabcbe
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
# Docx::Builder Gem used to create docx files based on a template. Our idea is quite similar to an erb file (in fact, we use an erb file behind :P) The only difference is: * When we want to write conditions and loops, we write the code between "{{" and "}}" * When we want to print a variable, we write it between "{{%" and "%}}" For example, in our template file example.docx we could have: ``` {{ items.each do |item| }} Insert here some text: {{% item.property %}} {{ end }} ``` ## Installation Add this line to your application's Gemfile: ```ruby gem 'docx-builder' ``` And then execute: $ bundle install Or install it yourself as: $ gem install docx-builder ## Usage ```ruby builder = Docx::Builder::Template.new('/path/to/input.docx') new_xml = builder.render(variables_hash) builder.save('/path/to/output.docx', new_xml) # or memory_stream = builder.save_as_buffer(new_xml) ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/docx-builder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/docx-builder/blob/master/CODE_OF_CONDUCT.md). ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Docx::Builder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/docx-builder/blob/master/CODE_OF_CONDUCT.md).
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
docx-builder-0.3.1 | README.md |
docx-builder-0.3.0 | README.md |