Skip to content

emiko/thinreports-generator

 
 

Repository files navigation

ThinReports Generator

<img src=“https://secure.travis-ci.org/thinreports/thinreports-generator.png” /> <img src=“https://codeclimate.com/badge.png” />

ThinReports is Open Source Reporting Solution for Ruby.

  • ThinReports Editor (GUI Designer)

  • ThinReports Generator (Report Generator for Ruby)

Generator’s features

Editor’s features is here.

Easy to generate PDF file

Design the layout using Editor, then embed values to text field in layout. That’s it!

Simple runtime environments

Ruby, RubyGems, Prawn and Generator.

Dynamic

Generator can be dynamically operated …

  • value of TextBlock

  • image of ImageBlock

  • styles (border, fill, visibility, position, color, font) of shape

For Japan

  • Japanese OK

  • External characters (Gaiji)

Supported Versions

  • Ruby 1.8.7, 1.9.2, 1.9.3

  • JRuby 1.6.5+ (Only 1.8mode)

Install

Add the following line in your Gemfile:

gem 'thinreports'

Then bundle:

$ bundle

Or:

$ gem install thinreports

Usage

Caution: In order to use the Generator, you must need the layout file(*.tlf) created with ThinReportsEditor.

Basic format

require 'thinreports'

report = ThinReports::Report.new :layout => 'report.tlf'
# Page 1
report.start_new_page do
  item(:title).value('ThinReports')
end

# Page 2
report.start_new_page do |page|
  page.item(:title).value('Pure Ruby')
  page.item(:title).style(:color, 'red')
end

report.generate_file('report.pdf')

Or,

ThinReports::Report.generate_file('report.pdf', :layout => 'report.tlf') do
  start_new_page

  page.item(:title).value('ThinReports')

  start_new_page

  page.item(:title).value('Pure Ruby').style(:color, '#ff0000')
end

List format

report = ThinReports::Report.new :layout => 'list.tlf'
report.start_new_page

10.times do |n|
  report.page.list(:default).add_row do |row|
    row.item(:no).value(n)
  end
end

report.generate_file('list.tlf')

Or,

report.page.list(:default) do |list|
  10.times do |n|
    list.add_row :no => n
  end
end

Since 0.7.5:

report = ThinReports::Report.new :layout => 'list.tlf'

10.times do |n|
  report.list.add_row do |row|
    row.item(:no).value(n)
  end
end

More simply,

report.list do |list|
  10.times do |n|
    list.add_row :title => n
  end
end
  • #start_new_page can be omitted because it is created new page automatically when #list is called

  • id argument of #list can be omitted if is :default

Learn more.

Rails3

For more information

Release information

News / Changelog

Documentation

Getting Started / Examples / HowTos

Support

Open Forum

Author

Matsukei Co.,Ltd.

Contributing

  • Pull request

  • Feedback from here

License

See LICENSE file.

About

Report(PDF) Generator for ThinReports

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
MIT-LICENSE

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%