是否可以使用 Prawn 混合实线和虚线单元格边框样式?
我正在使用 Ruby on Rails 3.1 构建一个网站,其中我还需要某些数据的 PDF 版本。为此,我使用 Prawn (master) 和 Prawnto gem。效果非常好。然而,只有一件事我不知道如何完成。
PDF 包含表格数据,我想以不同方式更改单元格边框样式,以更好地可视化某些部分。目前,我的行可以是单个行,也可以是多个行。单行或组的周围应有实心边框,以表明这是一个组。
-----------------------------------------------------------------
| Row 1 |
-----------------------------------------------------------------
-----------------------------------------------------------------
| Row 1 |
| |
| Row 2 |
-----------------------------------------------------------------
现在我想要的是在第二组中的第 1 行和第 2 行之间有一条虚线/点线。在某些情况下,我还需要在单元格中具有垂直(左/右)虚线/点线边框。
-----------------------------------------------------------------
| Row 1 |
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
| Row 2 |
-----------------------------------------------------------------
我一直在网上寻找例子,但一点运气都没有。这怎么能做到呢?我唯一能做的就是划掉表格中的所有边框,但这不是我想要的。
pdf.dash 4, :space => 3
pdf.table data
我希望能够为每个单元格单独设置边框样式,而且单元格可以为不同的边框设置不同的样式。即顶部是实线,底部是虚线。
有什么建议或帮助我如何实现这一目标?使用文本框或边界框代替使用表格会有帮助吗?
提前致谢!
I'm building a site with Ruby on Rails 3.1 where I also need to have PDF versions of certain data. For this I use Prawn (master) with the Prawnto gem. Works really well. However, there is just this one thing that I cannot see how to get done.
The PDF contains tabular data where I would like to change the cell border styles differently to better visualize certain parts. At the moment I have rows that can be single or multiple grouped together. The single line or group should have a solid border around it to show that this is a group.
-----------------------------------------------------------------
| Row 1 |
-----------------------------------------------------------------
-----------------------------------------------------------------
| Row 1 |
| |
| Row 2 |
-----------------------------------------------------------------
Now what I'd like is to have a dashed/dotted line between row 1 and row 2 in the second group. I'd also need to in certain cases have vertical (left/right) dashed/dotted borders in cells.
-----------------------------------------------------------------
| Row 1 |
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
| Row 2 |
-----------------------------------------------------------------
I've been trawling the web for examples, but no luck at all. How can this be done? The only thing I can do is to dash all borders in the table, but this is not what I want.
pdf.dash 4, :space => 3
pdf.table data
I would like to be able to set the border styles individually for each cell, but also in a way where a cell can have different styles for different borders. I.e. top is solid and bottom is dashed.
Any suggestions or help how I can achieve this? Would a text box or bounding box help instead of using a table?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,目前这是不可能的。
我做了一个虾叉,并添加了必要的代码,允许在表格中混合实线、虚线和点线单元格边框。
您可以在此处找到该分支。
创建表格单元格时的用法示例:
No, this is not possible currently.
I have made a fork of prawn and added the necessary code that allows to mix solid, dashed and dotted cell borders in a table.
You can find the fork here.
Example usage when creating a table cell: