Skip to content

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

Closed

Description

@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 

Activity

  1. practicingruby commented on May 11, 2009

    @practicingruby
    Owner

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

  2. bradediger commented on Nov 9, 2009

    @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.
  3. rnhurt commented on Jan 7, 2010

    @rnhurt
    Author

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

  4. bradediger commented on Jan 11, 2010

    @bradediger
    Collaborator

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions