column_box doesn't flow between columns when displaying tables instead of text #7

Closed
rnhurt opened this Issue May 11, 2009 · 4 comments

3 participants

@rnhurt

While trying to work with column_box I found out that plain text works well but tables don't flow properly.

This works fine:

column_box [0,cursor], :width => bounds.width, :columns => 2 do
  text " This is a test " * 100
end

This just causes the tables to continue in the first column over multiple pages, never flowing into the second column:

column_box [0,cursor], :width => bounds.width, :columns => 2 do
  table data, :headers => headers,
    :header_color => 'C0C0C0',
    :font_size    => 7,
    :border_style => :grid,
    :border_width => 0.5,
    :width        => bounds.width-10
end 
@practicingruby

Note to self: See if this reduces to the problem of using tables in stretchy bounding boxes...

@bradediger
Collaborator

Deferred for 0.7. Here's a failing spec:

describe "A table, in a column box" do

  it "should flow to the next column rather than always the next page" do
    pdf = Prawn::Document.new do
      column_box [0, cursor], :width => bounds.width, :columns => 2 do
        # 35 rows fit on two columns but not one
        table [["data"]] * 35
      end
    end

    pdf.page_count.should == 1
  end

end

Two issues to fix here:

  • Change @document.start_new_page to @parent_bounds.move_past_bottom so that we just tell the ColumnBox to move to the next column.

  • CellBlock currently draws based on the absolute_left of the page's (outermost) bounds. It should rather draw based on the left_side of the innermost bounds (those enclosing the table), but it has no knowledge of those bounds, only @document. Refactor CellBlock so that it knows the bounds it is drawing into.

@rnhurt

Did this ever get any love? I'm running 0.7.1 right now and it still looks broken.

@bradediger
Collaborator

Make tables work in column boxes. Closed by 53e381d.

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