ThinReports Generator
<img src=“https://secure.travis-ci.org/thinreports/thinreports-generator.png” /> <img src=“https://codeclimate.com/github/thinreports/thinreports-generator.png” /> <img src=“https://gemnasium.com/thinreports/thinreports-generator.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.3, 2.0.0, 2.1.0
-
JRuby 1.6, 1.7.0 (Only 1.8 mode)
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(:filename => 'report.pdf')
Or,
ThinReports::Report.generate(:filename => '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.list.add_row do |row|
row.item(:no).value(n)
end
end
report.generate(:filename => 'list.tlf')
Or,
10.times do |n|
report.list.add_row :no => n
end
Or,
report.list(:other_list_id) do |list|
10.times do |n|
list.add_row :no => 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
0.7.0 and earlier:
report = ThinReports::Report.new :layout => 'list.tlf'
10.times do |n|
report.page.list(:default).add_row do |row|
row.item(:no).value(n)
end
end
Rails3, 4
-
Rails Template handler for ThinReports DSL: thinreports-rails
For more information
Release information
Documentation
Support
Author
Matsukei Co.,Ltd.
-
twitter: @thinreports_org
-
email: [email protected]
Contributing
-
Pull request
-
Feedback from here
License
See LICENSE file.