Class Prawn::Document
In: lib/prawn/table/cell.rb
lib/prawn/table.rb
Parent: Object

Methods

cell   table  

Public Instance methods

Builds and renders a Table::Cell. A cell is essentially a special-purpose bounding box designed for flowing text within a bordered area. For available options, see Table::Cell#new.

   Prawn::Document.generate("cell.pdf") do
      cell [100,500],
        :width => 200,
        :text  => "The rain in Spain falls mainly on the plains"
   end

Builds and renders a Document::Table object from raw data. For details on the options that can be passed, see Document::Table.new

  data = [["Gregory","Brown"],["James","Healy"],["Jia","Wu"]]

  Prawn::Document.generate("table.pdf") do

    # Default table, without headers
    table(data)

    # Default table with headers
    table data, :headers => ["First Name", "Last Name"]

    # Very close to PDF::Writer's default SimpleTable output
    table data, :headers            => ["First Name", "Last Name"],
                :font_size          => 10,
                :vertical_padding   => 2,
                :horizontal_padding => 5,
                :position           => :center,
                :row_colors         => :pdf_writer,

    # Grid border style with explicit column widths.
    table data, :border_style => :grid,
                :column_widths       => { 0 => 100, 1 => 150 }

  end

  Will raise <tt>Prawn::Errors::EmptyTable</tt> given
  a nil or empty <tt>data</tt> paramater.

[Validate]