0

我有以下大虾文档布局

define_grid(:columns => 5, :rows => 8, :gutter => 10)

repeat(:all) do
    draw_text "bottom-left - text on all pages", :at => bounds.bottom_left
end

repeat(:all) do
    grid([0,0], [0,2]).bounding_box do
        text "TOP LEFT"
    end

    grid([0,3], [0,4]).bounding_box do
        text "TOP RIGHT"
    end
end

repeat(:all) do
    grid([1,0], [1,4]).bounding_box do
         text "ADDRESSES"
     end
end

grid([2,0], [6,4]).bounding_box do
    text "LINE ITEMS TABLE"
    data = [["This row should be repeated on every new page"]]
    data += [["..."]] * 30
    table(data, :header => true, :position => :center)
    move_down 2
    text "TOTALS"
end    


repeat(:all) do
    grid([7,0], [7,4]).bounding_box do
        text "FOOTER"
    end
end


string = "page <page> #{t(:of)} <total>"
options = { :at => [bounds.right - 150, 0],
          :width => 150,
          :align => :right,
          :start_count_at => 1,
          :color => "000000" }
number_pages string, options

这很好,但这是一张发票,所以我希望 ADDRESSES 块只在第一页上,而 LINE ITEMS TABLE 在网格中([1,0],[6,4]).bounding_box on ll后续页面...有可能吗?我尝试了很多选择,但都没有成功..

4

1 回答 1

0

将 2 个边界框合并为一个,并在“地址”上添加条件重复(仅第 1 页)

grid([1,0], [6,4]).bounding_box do
    repeat(lambda { |pg| pg == 1 }) do
        text "ADDRESSES"
    end
    text "LINE ITEMS TABLE"
    data = [["This row should be repeated on every new page"]]
    data += [["..."]] * 30
    table(data, :header => true, :position => :center)
    move_down 2
    text "TOTALS"
end    
于 2013-04-12T06:17:55.060 回答