Sha256: a399ca27eb5e4eaa46eb17cfe6fffc739e899a5c9537a936c9aa2a62c5c94560

Contents?: true

Size: 777 Bytes

Versions: 11

Compression:

Stored size: 777 Bytes

Contents

# encoding: utf-8
#
# We've seen how to apply styles to a selection of cells by setting the
# individual properties. Another option is to use the <code>style</code> method
#
# <code>style</code> lets us define multiple properties at once with a hash. It
# also accepts a block that will be called for each cell and can be used for
# some complex styling.
#
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
  table([[""] * 8] * 8) do
    cells.style(:width => 24, :height => 24)

    cells.style do |c|
      c.background_color = ((c.row + c.column) % 2).zero? ? '000000' : 'ffffff'
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

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