Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify styling (font, in particular) for a certain cell in Prawn

I want to specify a font style for a certain cell. What I found in the documentation is the capacity to do it for all the cell, but not for one I need:

table data, :cell_style => { :font => "Times-Roman", :font_style => :italic }

How do I do that for only one cell?

like image 869
Alan Coromano Avatar asked Sep 29 '13 03:09

Alan Coromano


1 Answers

Turn your table into a block to do more configuration and then you can find it by row and column. See line 2 for your font, I included a couple other examples to set styles by rows & columns:

table(invoice_header_data, width: 210) do
  style(row(0).column(0), font: "Times-Roman")
  style(rows(0..-1), :padding => [2, 10, 2, 10], :borders => [])
  style(row(4), padding: [12, 10], :font_style => :bold)
  style(columns(1..3), :align => :right)
end
like image 190
Helios de Guerra Avatar answered Oct 27 '22 22:10

Helios de Guerra