每当我在:align => {0 => :left, 1 => :right}
中设置Prawn-table
时,我都会收到此错误:
未定义的方法`+'代表nil:NilClass
我的表设置如下:
conds = [[{:content => "<b><font size='20'>Condensers</font></b>", :colspan => 2}], [ "Model #", "Price"]]
conds += @customer.condensers.map do |condenser|
[
condenser.model_number,
number_to_currency(condenser.price / 0.55)
]
end
pdf.table conds,
row_colors: ["FFFFFF","d8edff"],
:header => true,
:width => 300,
:cell_style => { :inline_format => true, :rotate => 0, :overflow => :shrink_to_fit, :min_font_size => 8, :align => {0 => :left, 1 => :right} }
答案 0 :(得分:0)
我在Andrey Deineko的帖子中找到了答案,效果很好!
pdf.table(conds) do
style(column(1), align: :right)
end