开发者

Formatting Tables in Prawn (this seems to be a common problem)

I"m having no luck formatting a table in a PDF 开发者_开发技巧served from a Rails action using Prawn.

Here's the code, but it doesn't apply any of the formatting:

p = Prawn::Document.new(:page_size => "A4")
data = []
data << ["alpha", "brava", "charlie"]
data << ["delta", "echo", "foxtrot"]
p.table(data) do
   row(0).style(:background_color => 'dddddd', :size => 9, :align => :center, :font_style => :bold)
   cells[0,0].background_color = '999999'        
end
p.render

Any clues?


Which version of prawn are you using? I had all sorts of issues with things not working as expected, then I upgraded to prawn 0.11.1.pre and it sorted it all.

See Prawn Tables: Block is not executing which is pretty much the same question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜