Sha256: 8a06cd186de4ad1e3bf6f82c9c4f4d4f3192fc99dd4523b2c87a85643791aec5

Contents?: true

Size: 698 Bytes

Versions: 10

Compression:

Stored size: 698 Bytes

Contents

# encoding: utf-8
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"
 
Prawn::Document.generate("simple_table.pdf") do 

  table([["foo", "bar " * 15, "baz"], 
         ["baz", "bar", "foo " * 15]], :cell_style => { :padding => 12 }) do
    cells.borders = []

    # Use the row() and style() methods to select and style a row.
    style row(0), :border_width => 2, :borders => [:bottom]

    # The style method can take a block, allowing you to customize properties
    # per-cell.
    style(columns(0..1)) { |cell| cell.borders |= [:right] }
  end

  move_down 12

  table([%w[foo bar bazbaz], %w[baz bar foofoo]], 
        :cell_style => { :padding => 12 }, :width => bounds.width)

end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/table/simple_table.rb
piglop-prawn-0.10.2.2 examples/table/simple_table.rb
piglop-prawn-0.10.2.1 examples/table/simple_table.rb
prawn-0.11.1.pre examples/table/simple_table.rb
goodwill-prawn-edge-0.10.0 examples/table/simple_table.rb
alphasights-prawn-0.10.4 examples/table/simple_table.rb
alphasights-prawn-0.10.3 examples/table/simple_table.rb
alphasights-prawn-0.10.2 examples/table/simple_table.rb
alphasights-prawn-0.10.1 examples/table/simple_table.rb
alphasights-prawn-0.10.0 examples/table/simple_table.rb