我有正确的代码,但Prawn抱怨它:
class MyClass < Prawn::Document
# ....
def def123
table main_table , width: bounds.width
end
def main_table
[[
"0","1", "2", "3", "4"
]] +
[
[{content: "data1", colspan: 4}, "111"],
[{content: "data2", colspan: 4}, "222"],
[{content:"data3", colspan: 4}, "333"]
]
end
end
说:
undefined method colspan= for Prawn::Table::Cell::Text:0x007fb86c3e7020
请注意,我需要使用width: bounds.width
才能让表格填满整页。
大虾(0.12.0)
答案 0 :(得分:2)
我建议您更新Gem文件,直接从git存储库中提取虾。大多数undefined method
错误是使用过期版本的结果:
gem 'prawn', :git => "https://github.com/prawnpdf/prawn.git"