使用Prawn创建稍微困难的表-Ruby

路易吉

我有下表:

关联

我需要使用ruby和Prawn gem重新创建此表。我很难将“ Time In”和“ Time Out”单元分解成原来的样子。我曾尝试在表中创建子表,但是代码非常丑陋,它几乎是一个猜测游戏,试图找出正确的单元格宽度。

请注意第1行中的第一列和最后一列。它们是单个单元格,但其他“日”列都包含多个单元格。

有人可以给我一些有关如何使用Prawn重新创建上图中的表的提示吗?

编辑:

另外,值得注意的是:

table(table_data, :width => 500, :cell_style => { :inline_format => true })

如果表中有表,则不起作用。我需要能够使用:inline_format,但是如果table_data表中包含子表,则会引发错误

zrl3dx

那这样的东西呢?

table([
            [{content: "First Name", borders: [:left, :top]}, {:content => "Monday", :colspan => 2},{:content => "Tuesday and so on", :colspan => 2}, {content: 'Signatures...', rowspan: 3}],
            [{content: '', borders: [:left]},'Time In', 'Time Out', 'Time In', 'Time Out'],
            [{content: '(as it appears<br/> on PBF)', borders: [:left, :bottom], align: :right, inline_format: true }, 'Initials', 'Initials', 'Initials', 'Initials']
          ])

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章