Prawn::Document.generate("test.pdf") do |pdf|
table_data = [[Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>1. Row example text</b> \n\nExample Text Not Bolded", :inline_format => true), "433"],
[Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>2. Row example text</b>", :inline_format => true), "2343"],
[Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>3. Row example text</b>", :inline_format => true), "342"],
[Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>4. Row example text</b>", :inline_format => true), "36"]]
pdf.table(table_data,:width => 500)
end
你也可以做
Prawn::Document.generate("test.pdf") do |pdf|
table_data = [["<b>1. Row example text</b>\n\nExample Text Not Bolded", "<b>433<b>"],
["<b>2. Row example text</b>", "<b>2343</b>"],
["<i>3. Row example text</i>", "<i>342</i>"],
["<b>4. Row example text</b>", "<sub>36</sub>"]]
pdf.table(table_data, :width => 500, :cell_style => { :inline_format => true })
end
大虾的 inline_format 支持<b>, <i>, <u>, <strikethrough>, <sub>, <sup>, <font>, <color> and <link>