Sha256: 76935ce0981c72d8b2c2d8c060753d7b44ddb62865b9cebf599e6a7650febcd4

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8
#
# Creating tables with Prawn is fairly easy. There are two methods that will
# create tables for us <code>table</code> and <code>make_table</code>.
#
# Both are wrappers that create a new <code>Prawn::Table</code> object. The
# difference is that <code>table</code> calls the <code>draw</code> method
# after creating the table and <code>make_table</code> only returns the created
# table, so you have to call the <code>draw</code> method yourself.
#
# The most simple table can be created by providing only an array of arrays
# containing your data where each inner array represents one row.
#
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
  t = make_table([ ["this is the first row"],
                   ["this is the second row"] ])
  t.draw
  move_down 20

  table([ ["short", "short", "loooooooooooooooooooong"],
          ["short", "loooooooooooooooooooong", "short"],
          ["loooooooooooooooooooong", "short", "short"] ])
end

Version data entries

11 entries across 11 versions & 2 rubygems

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