-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Row spans in multi-row table header are lost after page break #721
Comments
@hbrandl: Please investigate |
Assigned to myself. I'll look into this issue. |
The initial bug report contains the complete source to a simple failing test case. |
I was thinking of an rspec test but nevermind, I found the time to create one. describe "headers should allow for rowspan" do
it "should remember rowspans accross multiple pages", :unresolved, :issue => 721 do
pdf = Prawn::Document.new({:page_size => "A4", :page_layout => :portrait})
rows = [ [{:content=>"The\nNumber", :rowspan=>2}, {:content=>"Prefixed", :colspan=>2} ],
["A's", "B's"] ]
(1..50).each do |n|
rows.push( ["#{n}", "A#{n}", "B#{n}"] )
end
pdf.table( rows, :header=>2 ) do
row(0..1).style :background_color=>"FFFFCC"
end
#ensure that the header on page 1 is identical to the header on page 0
output = PDF::Inspector::Page.analyze(pdf.render)
output.pages[0][:strings][0..4].should == output.pages[1][:strings][0..4]
end
end I'll keep you posted. |
@hbrandl Yes, I've verified this patch works in the real application where I had detected this bug, and which is more complicated than the very simple test case I made for this bug report. The Prawn manual should probably be updated to note that the :header option to the table can be a number-of-rows, and not just true or false. Also, how easy would it be to automatically determine the number of header rows, based on any rowspans within it, if :header is passed as true rather than a specific number? |
If you render a table that has a header of more than one row, say :header=>2, any rowspans within that header will not be preserved when re-drawing that header on the second and following pages. It is as if the :rowspan property gets reset to 1.
Also, it might be nice to automatically infer the number of header rows when :header is passed as true, based on any rowspans.
Consider this simple example with a two-row header which does not render the second page correctly (with Prawn 1.0.0):
The text was updated successfully, but these errors were encountered: