docxtor2

Build Status Coverage Status Dependency Status Gem Version

Summary

Ruby docx generator

Installation

Add this line to your application's Gemfile:

gem 'docxtor2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install 'docxtor2'

Usage

stream = Docxtor2.generate do
  table_of_contents "Contents"
  h 1, "heading1"

  p "text1", :b => true do
    style 'p1'
    spacing :before => 80, :after => 240
    italic; u

    w "text2"
    br
    write "text3"
  end

  h 2 do
    w "heading2"
    line_break
    write "some text"
    br
    write "another text"
  end

  p "content", :style => 'p2', :i => true, :align => 'center'
end

file = File.new('test.docx', 'w')
file.write(stream.string)
file.close

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

run tests:

turn -Itest test/lib