Sha256: a0d69b4e2ffc166b930f4ff0eb539c9eddc4e69c1ed608a6602099dc6ceb7ac0

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8
#
# To style all the table cells you can use the <code>:cell_style</code> option
# with the table methods. It accepts a hash with the cell style options.
#
# Some straightforward options are <code>width</code>, <code>height</code>,
# and <code>padding</code>. All three accept numeric values to set the property.
#
# <code>padding</code> also accepts a four number array that defines the padding
# in a CSS like syntax setting the top, right, bottom, left sequentially. The
# default is 5pt for all sides.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  data = [ ["Look at how the cells will look when styled", "", ""],
           ["They probably won't look the same", "", ""]
         ]

  {:width => 160, :height => 50, :padding => 12}.each do |property, value|
    text "Cell's #{property}: #{value}"
    table(data, :cell_style => {property => value})
    move_down 20
  end

  text "Padding can also be set with an array: [0, 0, 0, 30]"
  table(data, :cell_style => {:padding => [0, 0, 0, 30]})
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
prawn-table-0.2.2 manual/table/cell_dimensions.rb
prawn-table-0.2.1 manual/table/cell_dimensions.rb
prawn-table-0.2.0 manual/table/cell_dimensions.rb
prawn-table-0.1.2 manual/table/cell_dimensions.rb
prawn-table-0.1.1 manual/table/cell_dimensions.rb
prawn-table-0.1.0 manual/table/cell_dimensions.rb
prawn-table-0.0.4 manual/table/cell_dimensions.rb
prawn-table-0.0.3 manual/table/cell_dimensions.rb
prawn-table-0.0.2 manual/table/cell_dimensions.rb
prawn-table-0.0.1 manual/table/cell_dimensions.rb
prawn-1.1.0 manual/table/cell_dimensions.rb