Ruport combing tables and writing to PDF

Hi there,

I’m still learning my way through Ruby and recently I’m really
struggling with Ruport. I’ve referred to the lulu book, api docs,
examples and I…just can’t get my head around this…

I want to specifically understand how to:
how to combine tables,
how to send more than 1 table to PDF
how to send a jpeg inbetween each of the tables (assuming mulitple
tables are sent)

I was successful in adding an image using the
ChunkyBacon example…but woudld like to understand how to insert an
image in between tables…

What I’ve tried…
Using Groupings…using pivot tables (pretty neat)…

Here’s something nasty that I’d have to call my code…

require “ruport”
table = Testrun.report_table_by_sql(“some embarrasing sql here…”)
table2 = Testrun.report_table_by_sql(“further embarrasing sql”)

sorted_table = table.sort_rows_by("Name", :order => :descending)

sorted_table2 = table2.sort_rows_by(“Name”, :order => :descending)



group1 = sorted_table.to_group(“build_number”)
group2 = sorted_table2.to_group(“build_number”)

grouping = Grouping(group1, :by => “build_number”), Grouping(group2,
:by => “build_number”)

puts group1
puts group2

#ok at this point I have two tables but I’ve only figured out how to
send one to the PDF using save_as only
#which comes out badly formatted in terms of padding and spacing…

#I’ve tried using the formatters, and setting up stages but I can
never get them working…
#I want to be able to print each group (really the tables) and if
possible to insert an image inbetween

each of the groups…


I realize I"m asking more than one question I’ve sat ont his for a few
days…felt even worse after reading
James’s comments regarding the Ruport book and how straight forward it
is…I’ve read it through and I’m still confused. I even went to
freenode…couldnt find anyone on there last night…

Can someone point me in the right direction?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs