Sha256: 04afc72a06b1f3669de0ac47e46b3c5e0faa88669daadde3ef92e2fa7644c29f

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

# encoding: utf-8

$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require "prawn"
require "rubygems"
   
headers, body = nil, nil   
     
ruby_18 do        
  require "fastercsv" 
  headers, *body = FasterCSV.read("#{Prawn::BASEDIR}/examples/addressbook.csv")   
end

ruby_19 do            
  require "csv"
  headers, *body = CSV.read("#{Prawn::BASEDIR}/examples/addressbook.csv")
  headers.map! { |e| e.encode("UTF-8") }
  body.map! { |e| e.map! { |x| x.encode("UTF-8") } }
end
                                                                                  
Prawn::Document.generate("top_and_bottom_cells.pdf", :page_layout => :portrait) do
  
  table(body, :headers => headers, :align => :center, :border_style => :top_and_bottom)
  
  move_down(50)
  
  table(body, :headers => headers, :align => :center, :border_style => :top_and_bottom, :header_border_style => :sides)

  move_down(50)
  
  table(body, :headers => headers, :align => :center, :border_style => :grid, :header_border_style => :bottom_only)

  
  # cell([500,300], :text => "This free flowing textbox shows how you can use Prawn's "+
  #     "cells outside of a table with ease.  Think of a 'cell' as " +
  #     "simply a limited purpose bounding box that is meant for laying " +
  #     "out blocks of text and optionally placing a border around it",
  #   :width => 225, :padding => 10, :border_width => 2, :border_style => :top_and_bottom)

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
fullcirclegroup-fullcirclegroup-prawn-0.2.99.2 examples/top_and_bottom_cells.rb
fullcirclegroup-prawn-0.2.99.3 examples/top_and_bottom_cells.rb