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

1

6

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?

Analysand answered 29/9, 2013 at 3:33 Comment(0)
C
13

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
Coprophilous answered 29/9, 2013 at 3:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.