表格单元格边框

时间:2009-12-07 13:42:30

标签: ruby-on-rails pdf ruby-on-rails-plugins prawn prawnto

这是我需要生成的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表格!

有人提示吗?

1 个答案:

答案 0 :(得分:0)

这里有一个解决方案,称为解决方法:

#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”] 你避免使用带下划线的标题。