prawn PDF: I need to generate nested tables

2019-02-17 17:33发布

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?

3条回答
Rolldiameter
2楼-- · 2019-02-17 18:05

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.

查看更多
小情绪 Triste *
3楼-- · 2019-02-17 18:10

Subtables are now supported:

Prawn::Document.generate("subtable.pdf") do |pdf|
  subtable = pdf.make_table([["sub"], ["table"]])
  pdf.table([[subtable, "original"]])
end
查看更多
贪生不怕死
4楼-- · 2019-02-17 18:14

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.

查看更多
登录 后发表回答