ODF generation library for Ruby
Ruby
Pull request Compare This branch is 120 commits behind thiagoarrais:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/odf
spec
.darcsboring
.gitignore
CHANGELOG
LICENSE.LGPL
Manifest
README.rdoc
Rakefile
rodf.gemspec

README.rdoc

rODF

This is a library for writing to ODF output with Ruby. It currently only supports creating spreadsheets (ODS). Text documents (ODT) and slide shows (ODP) may be added some time in the future.

This is NOT an ODF reading library.

Installation

You should be able to install the latest stable version by saying something like

sudo gem install rodf

How do I use it?

rODF works pretty much like Builder, but with ODF-aware constructs. Try this:

require 'odf/spreadsheet'

ODF::SpreadSheet.file("my-spreadsheet.ods") do |spreadsheet|
  spreadsheet.table 'My first table from Ruby' do |table|
    table.row {|row|  row.cell 'Hello, rODF world!' }
  end
end

Some basic formatting is also possible:

require 'odf/spreadsheet'

ODF::SpreadSheet.file("my-spreadsheet.ods") do |spreadsheet|
  spreadsheet.style 'red-cell', :family => :cell do |style|
    style.property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
  end
  spreadsheet.table 'Red text table' do |table|
    table.row {|row|  row.cell 'Red', :style => 'red-cell' }
  end
end

Gotchas

The ODF spec doesn't allow :type to be set for cells with no values or formulas. It's up to users to ensure that cells are not passed nil values for :type s other than :string