I am running Rails 3.0.1 with prawn-0.11.1.pre
I just did some basic tests to see if I can get Prawn to create a simple table that includes some formatted text:
data = ["Cell 1", formatted_text([{:text => "Cell 2"}])],
["Cell 3","Cell 4"]
table(data)
render
The PDF renders like this
Cell 2
[Cell 1][ ]
[Cell 3][Cell 4]
(a nice table but with the text "Cell 2" outside the table)
My goal is to get the formatted text "Cell 2" inside Cell #2...
How should I do this?
formatted_text
doesn't return formatted text, it renders it. So, when
you call formatted_text
while building your data for table
, "Cell 2"
is rendered before the table and the cell at row 1 and column 2 is
empty. I think you want to put at Prawn::Table::Cell::Text object
where you have your formatted_text
call. If Prawn::Table::Cell::Text
doesn't support everything you need then you'll probably have to make your
subclass of Prawn::Table::Cell
and do it all by hand.