Sha256: e51082f18b43362543970438bbd0870849b0eb182298347ff143d8f11efd40d0

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8
#
# Demonstrates the use of the :rowspan option when using Document#table
#
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))

require "rubygems"
gem 'prawn-core'
require "prawn"
require "prawn/layout"

Prawn::Document.generate "table_rowspan.pdf" do
  data = [ [ { :rowspan => 10, :text => '01/01/2008' },
             { :rowspan => 5,  :text => 'John Doe'   },
             '4.2', '125.00', '525.00' ],
           [ '4.2', '125.00', '525.00' ], 
           [ '4.2', '125.00', '525.00' ], 
           [ '4.2', '125.00', '525.00' ], 
           [ '4.2', '125.00', '525.00' ],
           [ Prawn::Table::Cell.new( :rowspan => 5, :text => 'Jane Doe' ),
             '3.2', '75.50', '241.60'  ],
           [ '3.2', '75.50', '241.60'  ],
           [ '3.2', '75.50', '241.60'  ],
           [ '3.2', '75.50', '241.60'  ],
           [ '3.2', '75.50', '241.60'  ] ]
  
 data << [{:text => 'Total', :colspan => 2}, '37.0', '1002.5', '3833']
  
  table data,
    :position => :center,
    :headers => ['Date', 'Employee', 'Hours', 'Rate', 'Total'],
    :border_style => :grid
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-flexible-table-0.1.2 examples/table_rowspan.rb
prawn-flexible-table-0.1.1 examples/table_rowspan.rb
prawn-flexible-table-0.1 examples/table_rowspan.rb