prawn PDF: I need to generate nested tables

浪子不回头ぞ 提交于 2019-12-01 03:53:10

问题


I need a table where rows are actually 2 rows tables, a nested table that is.. How can I do that in prawn? Maybe I need an extension.. but which one?


回答1:


No support for this exists in released versions, but in the master branch of http://github.com/sandal/prawn you'll find our revamped table support which has nested tables. Take a look at the examples/ dir.




回答2:


Subtables are now supported:

Prawn::Document.generate("subtable.pdf") do |pdf|
  subtable = pdf.make_table([["sub"], ["table"]])
  pdf.table([[subtable, "original"]])
end



回答3:


Table nesting was actually the major inspiration for Crayfish.
As far as I know Prawn still can't do proper sizing and cell placements on more sophisticated tables.



来源:https://stackoverflow.com/questions/2379124/prawn-pdf-i-need-to-generate-nested-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!