表格单元格边框

发布于 2024-08-13 23:24:02 字数 433 浏览 5 评论 0原文

这是我需要生成的 2x2 表格:

r1c1  r1c2
r2c1  r2c1
      ----

换句话说,我应该打印右下单元格的下边框。这是我的代码:

show.pdf.prawn

#This is a two dimensional array:
my_array = [["r1c1","r1c2"],["r2c1",Prawn::Table::Cell.new(:text => "r2c2", :border_width => 1 , :borders => :bottom)]]

#Table
pdf.table my_array, :border_width => 0

好吧,用这个代码我有一个没有边框的 2x2 表格!

有人有任何提示吗?

This is the 2x2 table I need to generate:

r1c1  r1c2
r2c1  r2c1
      ----

In other words I should print the bottom border of the bottom right cell. This is my code:

show.pdf.prawn

#This is a two dimensional array:
my_array = [["r1c1","r1c2"],["r2c1",Prawn::Table::Cell.new(:text => "r2c2", :border_width => 1 , :borders => :bottom)]]

#Table
pdf.table my_array, :border_width => 0

Well, with this code I have a 2x2 table with no borders!

Has someone any tip?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆光下的微笑 2024-08-20 23:24:02

这里有一个更广为人知的解决方案:

#This is a two dimensional array:
my_array = [["r1c1","r1c2"],["r2c1",Prawn::Table::Cell.new(:text => "r2c2", :border_width => 1 , :borders => [:bottom])]]

#Table
pdf.table my_array, 
#:headers => ["h1","h2"],
:border_style => :underline_header

省略 headers => [“h1”,“h2”]您避免使用带下划线的标题。

Here one solution better known as workaround:

#This is a two dimensional array:
my_array = [["r1c1","r1c2"],["r2c1",Prawn::Table::Cell.new(:text => "r2c2", :border_width => 1 , :borders => [:bottom])]]

#Table
pdf.table my_array, 
#:headers => ["h1","h2"],
:border_style => :underline_header

Omitting headers => ["h1","h2"] you avoid the underlined header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文