How to make a bold header in a Prawn table
Asked Answered
K

3

9

I'm using Prawn and need to make the Header row bold but I can't find any solution in the API.

Here you can see my current table with normal text Headers

pdf.table (Data, :header => true) do
  table.header=(["Header1", "Header2", "Header3", "Header4"])        
end
Killick answered 19/7, 2011 at 9:1 Comment(0)
K
14

Its just as simple as I thought

pdf.table Data, {:header => true} do |table|
    table.header=(["Header1", "Header2", "Header3", "Header4"])     
    table.row(0).font_style = :bold
end
Killick answered 22/7, 2011 at 4:16 Comment(0)
G
0
pdf.text "your header.", :size => 9.8, :style => :bold, :spacing => 1.5, :align => :right
Grecoroman answered 19/7, 2011 at 9:36 Comment(0)
C
0
pdf.table(
  data, 
  :headers => [
    "Header1", 
    {:text => "Header2", :font_size => :bold}, 
    "Header3", 
    "Header4"]
)

other options:

:align_headers :header_text_color :header_color

see http://rubydoc.info/gems/prawn-layout/0.8.4/Prawn/Table

Cockshy answered 27/7, 2011 at 9:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.