cell colspan

49 views
Skip to first unread message

sk

unread,
Jul 13, 2009, 6:03:39 AM7/13/09
to Prawn
Hi
I tried the code

table [["This is", "a normal row" ],
[ :text => "This is a colspan row", :colspan => 2 ],
[ Prawn::Table::Cell.new(:text => "This is a colspan
row", :colspan => 2,:background_color=>"8DB3E2") ],
]

What I expected is the background color fills the two columns But it
fills only one column although I have specified colspan = 2 What
might be the reason?

Thanks in advance
sk

Gregory Brown

unread,
Jul 13, 2009, 9:27:58 AM7/13/09
to prawn...@googlegroups.com

Your syntax is incorrect.

sk

unread,
Jul 13, 2009, 11:55:53 PM7/13/09
to Prawn
Hi
Could you please correct it?I cant figure it out

Thanks
sk

Gregory Brown

unread,
Jul 14, 2009, 1:02:49 AM7/14/09
to prawn...@googlegroups.com
On Mon, Jul 13, 2009 at 11:55 PM, sk<sijov...@gmail.com> wrote:
>
> Hi
>    Could you please correct it?I cant figure it out

Yes, you can figure it out. Look at the examples or read the source.

-greg

Gregory Brown

unread,
Jul 14, 2009, 1:18:32 AM7/14/09
to prawn...@googlegroups.com

Actually, I misread your initial question. Here are some details
that may help:

Prawn::Table::Cell does not have knowledge of colspan, and never will.
This is because cell can be used outside of a table, so colspan
doesn't make sense there.
Really, what happens is when you have { :text => "....", :colspan => 2
} in your data array, Prawn's table code creates a double width cell
for you.

But no more options are exposed there. Passing :background_color does
nothing, because it's never passed on to the Cell constructor. This
is something I am open to amending. Please file a ticket with a
request on github, and if someone provides a relatively simple patch
that enables:

{ :text => "...", :colspan => k, :background_color => "..." }

I will pull it in. Sorry for the initial confusion, but in the
future, be sure to dive in and read the source. It really helps with
situations like this.

-greg

Reply all
Reply to author
Forward
0 new messages