Sha256: 41e5db12a49868fda5aeb80f080b257d78f12f95d32d799abfc17bf1381baf0d

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 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

3 entries across 3 versions & 1 rubygems

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