forked from bogdan/datagrid
-
Notifications
You must be signed in to change notification settings - Fork 0
PDF export
bogdan edited this page Oct 31, 2011
·
1 revision
Datagrid provides you a table like structure with data:
report = MyGrid.new(
report.header # => ["Group", "Name", "Activated"]
report.rows # => [
# ["Steve", "Spammers", true],
# [ "John", "Spoilers", true],
# ["Berry", "Good people", false]
# ]
report.data # => [ header, *rows]You can use this data for export.
There are some gems available that can give you export.
Easy way (using ruport):
require 'ruport' # gem install ruport
f = File.new("report.pdf", "w")
f.write Ruport::Data::Table(:column_names =>report.header, :data => report.rows).to_pdf
f.closeHard way with custom formatting: https://github.com/mileszs/wicked_pdf
Anyway I think PDF export is not under scope of this gem.