Skip to content

mezza/rodf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

ODF generation library for Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%