Skip to content

Instantly share code, notes, and snippets.

@hidakatsuya
Last active September 26, 2015 19:58
Show Gist options
  • Save hidakatsuya/1150974 to your computer and use it in GitHub Desktop.
Save hidakatsuya/1150974 to your computer and use it in GitHub Desktop.
ThinReports Example: Basic List
# coding: utf-8
require 'rubygems'
require 'thinreports'
report = ThinReports::Report.new :layout => 'basic_list.tlf'
30.times do |t|
# Internaly #start_new_page() method is called,
# the page break automatically.
#
# [NOTE] In thinreports < 0.7.5:
# report.page.list(:default).add_row do |row|
# :
report.list.add_row do |row|
row.item(:detail).value("row##{t}")
end
end
# [NOTE] In thinreports < 0.7.7:
# report.generate_file 'basic_list.pdf'
report.generate :filename => 'basic_list.pdf'
@nunopato
Copy link

This basic list code is not coherent with the tlf file example:

'report.list' expects a list with default id and in the template you just have a list with basic_list id.

row.item(:detail) expects an item with id detail but, again, in the template you have an item with a different id: default.

@hidakatsuya
Copy link
Author

Thank you pointed out. I have made ​​corrections to the basic_list.tlf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment