Sha256: 91d99b2161a7bc69dccfc885ec0c09109c888a7f5d3af0199c130929ab517b36

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 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 by specifying values for all sides: [0, 0, 0, 30]"
  table(data, :cell_style => {:padding => [0, 0, 0, 30]}) # top, right, bottom, left

  text "Padding can also be set by specifying only vertical and horizontal values: [0,30]"
  table(data, :cell_style => {:padding => [0, 30]}) # vertical, horizontal

  text "Padding can also be set by specifying top, horizontal and bottom values: [0,30,10]"
  table(data, :cell_style => {:padding => [0, 30, 10]}) # top, horizontal, bottom
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-table-continued-1.0.0.rc3 manual/table/cell_dimensions.rb
prawn-table-continued-1.0.0.rc2 manual/table/cell_dimensions.rb
prawn-table-continued-1.0.0.rc1 manual/table/cell_dimensions.rb