Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Library to create ODF Spreadsheet files
Ruby
branch: master
Failed to load latest commit information.
lib
samples Added samples of simple and rich tables.
MIT-LICENSE Added spreadsheet builder with libxml and builder xml generation back…
README Updated code example in README: fixed typo, adjusted column widths.

README

Spreadsheet
===========

Library to generate OpenDocument Spreadsheet documents.

Example
=======

  sheet = Spreadsheet::Builder.new
  sheet.spreadsheet do
    sheet.table 'Time report (simple)' do
      sheet.row {
        sheet.cell 'Developing spreadsheet library'
        sheet.cell 80.0
      }
      sheet.row {
        sheet.cell 'Writing spreadsheet library documentation'
        sheet.cell 2.0
      }
    end
  
    sheet.table 'Time report (rich)' do
      sheet.column :width => '4in'
      sheet.column :width => '0.5in'
    
      sheet.header {
        sheet.row {
          sheet.cell 'Time report', :span => 2, :style => 'title'
        }
        sheet.row {
          sheet.cell 'Activity', :align => :left
          sheet.cell 'Hours'
        }
      }
    
      sheet.row {
        sheet.string_cell 'Developing spreadsheet library'
        sheet.numeric_cell 80.0
      }
      sheet.row {
        sheet.string_cell 'Writing spreadsheet library documentation'
        sheet.numeric_cell 2.0
      }
    end
  end

  File.open('time_report.ods', 'wb') { |f| f.write sheet.content! }


Copyright (c) 2009 Maxim Kulkin, released under the MIT license
Something went wrong with that request. Please try again.