├── .gitignore ├── VERSION.yml ├── test ├── bbu.ods ├── bbu.xls ├── ric.ods ├── bbu.xlsx ├── no_spreadsheet_file.txt ├── style.ods ├── style.xls ├── time-test.csv ├── boolean.ods ├── boolean.xls ├── boolean.xlsx ├── borders.ods ├── borders.xls ├── borders.xlsx ├── datetime.ods ├── datetime.xls ├── formula.ods ├── formula.xls ├── formula.xlsx ├── numbers1.ods ├── numbers1.xls ├── style.xlsx ├── 1900_base.xls ├── 1904_base.xls ├── Bibelbund.ods ├── Bibelbund.xls ├── Bibelbund.xlsx ├── Bibelbund1.ods ├── datetime.xlsx ├── numbers1.xlsx ├── paragraph.ods ├── paragraph.xls ├── paragraph.xlsx ├── time-test.ods ├── time-test.xls ├── time-test.xlsx ├── whitespace.ods ├── whitespace.xls ├── bode-v1.ods.zip ├── bode-v1.xls.zip ├── emptysheets.ods ├── emptysheets.xls ├── html-escape.ods ├── whitespace.xlsx ├── bad_excel_date.xls ├── false_encoding.xls ├── only_one_sheet.ods ├── only_one_sheet.xls ├── only_one_sheet.xlsx ├── datetime_floatconv.xls ├── simple_spreadsheet.ods ├── simple_spreadsheet.xls ├── formula_parse_error.xls ├── simple_spreadsheet.xlsx ├── bug-row-column-fixnum-float.xls ├── simple_spreadsheet_from_italo.ods ├── simple_spreadsheet_from_italo.xls ├── test_helper.rb ├── numbers1.csv ├── only_one_sheet.xml ├── boolean.xml ├── emptysheets.xml ├── bug-row-column-fixnum-float.xml ├── formula.xml ├── time-test.xml ├── paragraph.xml ├── datetime_floatconv.xml ├── borders.xml ├── false_encoding.xml ├── style.xml ├── datetime.xml ├── bbu.xml ├── whitespace.xml ├── simple_spreadsheet.xml ├── simple_spreadsheet_from_italo.xml └── numbers1.xml ├── lib ├── roo │ ├── version.rb │ ├── roo_rails_helper.rb │ ├── google.rb │ ├── excel2003xml.rb │ ├── excel.rb │ └── openoffice.rb └── roo.rb ├── examples ├── roo_soap_server.rb ├── write_me.rb └── roo_soap_client.rb ├── License.txt ├── Rakefile ├── website ├── template.rhtml └── stylesheets │ └── screen.css ├── Manifest.txt ├── scripts └── txt2html ├── README.markdown ├── roo.gemspec ├── History.txt └── base64include.rb /.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | -------------------------------------------------------------------------------- /VERSION.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :minor: 4 3 | :patch: 0 4 | :major: 1 5 | -------------------------------------------------------------------------------- /test/bbu.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bbu.ods -------------------------------------------------------------------------------- /test/bbu.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bbu.xls -------------------------------------------------------------------------------- /test/ric.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/ric.ods -------------------------------------------------------------------------------- /test/bbu.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bbu.xlsx -------------------------------------------------------------------------------- /test/no_spreadsheet_file.txt: -------------------------------------------------------------------------------- 1 | this is intentionally not a spreadsheet file 2 | -------------------------------------------------------------------------------- /test/style.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/style.ods -------------------------------------------------------------------------------- /test/style.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/style.xls -------------------------------------------------------------------------------- /test/time-test.csv: -------------------------------------------------------------------------------- 1 | "Mittags:",12:13:14,15:16:00,23:00:00 2 | 2007-11-21,,, 3 | -------------------------------------------------------------------------------- /test/boolean.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/boolean.ods -------------------------------------------------------------------------------- /test/boolean.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/boolean.xls -------------------------------------------------------------------------------- /test/boolean.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/boolean.xlsx -------------------------------------------------------------------------------- /test/borders.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/borders.ods -------------------------------------------------------------------------------- /test/borders.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/borders.xls -------------------------------------------------------------------------------- /test/borders.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/borders.xlsx -------------------------------------------------------------------------------- /test/datetime.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/datetime.ods -------------------------------------------------------------------------------- /test/datetime.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/datetime.xls -------------------------------------------------------------------------------- /test/formula.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/formula.ods -------------------------------------------------------------------------------- /test/formula.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/formula.xls -------------------------------------------------------------------------------- /test/formula.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/formula.xlsx -------------------------------------------------------------------------------- /test/numbers1.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/numbers1.ods -------------------------------------------------------------------------------- /test/numbers1.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/numbers1.xls -------------------------------------------------------------------------------- /test/style.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/style.xlsx -------------------------------------------------------------------------------- /test/1900_base.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/1900_base.xls -------------------------------------------------------------------------------- /test/1904_base.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/1904_base.xls -------------------------------------------------------------------------------- /test/Bibelbund.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/Bibelbund.ods -------------------------------------------------------------------------------- /test/Bibelbund.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/Bibelbund.xls -------------------------------------------------------------------------------- /test/Bibelbund.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/Bibelbund.xlsx -------------------------------------------------------------------------------- /test/Bibelbund1.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/Bibelbund1.ods -------------------------------------------------------------------------------- /test/datetime.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/datetime.xlsx -------------------------------------------------------------------------------- /test/numbers1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/numbers1.xlsx -------------------------------------------------------------------------------- /test/paragraph.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/paragraph.ods -------------------------------------------------------------------------------- /test/paragraph.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/paragraph.xls -------------------------------------------------------------------------------- /test/paragraph.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/paragraph.xlsx -------------------------------------------------------------------------------- /test/time-test.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/time-test.ods -------------------------------------------------------------------------------- /test/time-test.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/time-test.xls -------------------------------------------------------------------------------- /test/time-test.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/time-test.xlsx -------------------------------------------------------------------------------- /test/whitespace.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/whitespace.ods -------------------------------------------------------------------------------- /test/whitespace.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/whitespace.xls -------------------------------------------------------------------------------- /test/bode-v1.ods.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bode-v1.ods.zip -------------------------------------------------------------------------------- /test/bode-v1.xls.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bode-v1.xls.zip -------------------------------------------------------------------------------- /test/emptysheets.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/emptysheets.ods -------------------------------------------------------------------------------- /test/emptysheets.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/emptysheets.xls -------------------------------------------------------------------------------- /test/html-escape.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/html-escape.ods -------------------------------------------------------------------------------- /test/whitespace.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/whitespace.xlsx -------------------------------------------------------------------------------- /test/bad_excel_date.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bad_excel_date.xls -------------------------------------------------------------------------------- /test/false_encoding.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/false_encoding.xls -------------------------------------------------------------------------------- /test/only_one_sheet.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/only_one_sheet.ods -------------------------------------------------------------------------------- /test/only_one_sheet.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/only_one_sheet.xls -------------------------------------------------------------------------------- /test/only_one_sheet.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/only_one_sheet.xlsx -------------------------------------------------------------------------------- /test/datetime_floatconv.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/datetime_floatconv.xls -------------------------------------------------------------------------------- /test/simple_spreadsheet.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/simple_spreadsheet.ods -------------------------------------------------------------------------------- /test/simple_spreadsheet.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/simple_spreadsheet.xls -------------------------------------------------------------------------------- /test/formula_parse_error.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/formula_parse_error.xls -------------------------------------------------------------------------------- /test/simple_spreadsheet.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/simple_spreadsheet.xlsx -------------------------------------------------------------------------------- /test/bug-row-column-fixnum-float.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/bug-row-column-fixnum-float.xls -------------------------------------------------------------------------------- /test/simple_spreadsheet_from_italo.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/simple_spreadsheet_from_italo.ods -------------------------------------------------------------------------------- /test/simple_spreadsheet_from_italo.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigeya/roo/master/test/simple_spreadsheet_from_italo.xls -------------------------------------------------------------------------------- /lib/roo/version.rb: -------------------------------------------------------------------------------- 1 | module Roo #:nodoc: 2 | module VERSION #:nodoc: 3 | MAJOR = 1 4 | MINOR = 3 5 | TINY = 9 6 | 7 | STRING = [MAJOR, MINOR, TINY].join('.') 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | require File.dirname(__FILE__) + '/../lib/roo' 3 | 4 | # helper method 5 | def after(d) 6 | yield if DateTime.now > d 7 | end 8 | 9 | # helper method 10 | def before(d) 11 | yield if DateTime.now <= d 12 | end 13 | 14 | # helper method 15 | def local_only 16 | if ENV["roo_local"] == "thomas-p" 17 | yield 18 | end 19 | end -------------------------------------------------------------------------------- /test/numbers1.csv: -------------------------------------------------------------------------------- 1 | 1,2,3,4,10,, 2 | 5,6,7,8,9,"test",11 3 | ,,,,,, 4 | 10,11,12,13,14,, 5 | 1961-11-21,,,,,, 6 | "tata",,,,,, 7 | ,,,,,, 8 | ,,"thisisc8",,,, 9 | ,,,"thisisd9",,, 10 | ,,,,,, 11 | "thisisa11",,,,,, 12 | 41,42,43,44,45,, 13 | ,,,,,, 14 | ,,,,,, 15 | 41,42,43,44,45,, 16 | "einundvierzig","zweiundvierzig","dreiundvierzig","vierundvierzig","fuenfundvierzig",, 17 | ,,,,,, 18 | 2007-05-31,"dies hier als Date-Objekt",,,,, 19 | -------------------------------------------------------------------------------- /lib/roo.rb: -------------------------------------------------------------------------------- 1 | module Roo 2 | class Spreadsheet 3 | class << self 4 | def open(file) 5 | case File.extname(file) 6 | when '.xls' 7 | Excel.new(file) 8 | when '.xlsx' 9 | Excelx.new(file) 10 | when '.ods' 11 | Openoffice.new(file) 12 | when '.xml' 13 | Excel2003XML.new(file) 14 | when '' 15 | Google.new(file) 16 | else 17 | raise ArgumentError, "Don't know how to open file #{file}" 18 | end 19 | end 20 | end 21 | end 22 | end 23 | 24 | require 'roo/version' 25 | # require 'roo/spreadsheetparser' TODO: 26 | require 'roo/generic_spreadsheet' 27 | require 'roo/openoffice' 28 | require 'roo/excel' 29 | require 'roo/excelx' 30 | require 'roo/google' 31 | require 'roo/excel2003xml' 32 | require 'roo/roo_rails_helper' 33 | -------------------------------------------------------------------------------- /examples/roo_soap_server.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'roo' 3 | require 'soap/rpc/standaloneServer' 4 | 5 | NS = "spreadsheetserver" # name of your service = namespace 6 | class Server2 < SOAP::RPC::StandaloneServer 7 | 8 | def on_init 9 | spreadsheet = Openoffice.new("./Ferien-de.ods") 10 | add_method(spreadsheet, 'cell', 'row', 'col') 11 | add_method(spreadsheet, 'officeversion') 12 | add_method(spreadsheet, 'first_row') 13 | add_method(spreadsheet, 'last_row') 14 | add_method(spreadsheet, 'first_column') 15 | add_method(spreadsheet, 'last_column') 16 | add_method(spreadsheet, 'sheets') 17 | #add_method(spreadsheet, 'default_sheet=', 's') 18 | # method with '...=' did not work? alias method 'set_default_sheet' created 19 | add_method(spreadsheet, 'set_default_sheet', 's') 20 | end 21 | 22 | end 23 | 24 | PORT = 12321 25 | puts "serving at port #{PORT}" 26 | svr = Server2.new('Roo', NS, '0.0.0.0', PORT) 27 | 28 | trap('INT') { svr.shutdown } 29 | svr.start 30 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Thomas Preymesser 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /examples/write_me.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'roo' 3 | 4 | #-- create a new spreadsheet within your google-spreadsheets and paste 5 | #-- the 'key' parameter in the spreadsheet URL 6 | MAXTRIES = 1000 7 | print "what's your name? " 8 | my_name = gets.chomp 9 | print "where do you live? " 10 | my_location = gets.chomp 11 | print "your message? (if left blank, only your name and location will be inserted) " 12 | my_message = gets.chomp 13 | spreadsheet = Google.new('ptu6bbahNZpY0N0RrxQbWdw') 14 | spreadsheet.default_sheet = 'Sheet1' 15 | success = false 16 | MAXTRIES.times do 17 | col = rand(10)+1 18 | row = rand(10)+1 19 | if spreadsheet.empty?(row,col) 20 | if my_message.empty? 21 | text = Time.now.to_s+" "+"Greetings from #{my_name} (#{my_location})" 22 | else 23 | text = Time.now.to_s+" "+"#{my_message} from #{my_name} (#{my_location})" 24 | end 25 | spreadsheet.set_value(row,col,text) 26 | puts "message written to row #{row}, column #{col}" 27 | success = true 28 | break 29 | end 30 | puts "Row #{row}, column #{col} already occupied, trying again..." 31 | end 32 | puts "no empty cell found within #{MAXTRIES} tries" if !success 33 | 34 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift('lib') 2 | 3 | require 'rake/testtask' 4 | 5 | begin 6 | require 'jeweler' 7 | Jeweler::Tasks.new do |s| 8 | s.name = 'roo' 9 | s.rubyforge_project = 'roo' 10 | s.platform = Gem::Platform::RUBY 11 | s.email = 'hugh_mcgowan@yahoo.com' 12 | s.homepage = "http://roo.rubyforge.org" 13 | s.summary = "roo" 14 | s.description = "roo can access the contents of OpenOffice-, Excel- or Google-Spreadsheets" 15 | s.authors = ['Hugh McGowan','Thomas Preymesser'] 16 | s.files = FileList[ "{lib,test}/**/*"] 17 | s.has_rdoc = true 18 | s.extra_rdoc_files = ["README.markdown", "History.txt"] 19 | s.rdoc_options = ["--main","README.markdown"] 20 | s.add_dependency "spreadsheet", [">= 0.6.4"] 21 | s.add_dependency "rubyzip", [">= 0.9.1"] 22 | s.add_dependency "hpricot", [">= 0.6"] 23 | s.add_dependency "GData", [">= 0.0.4"] 24 | s.add_dependency "libxml-ruby", [">= 1.1.3"] 25 | end 26 | rescue LoadError 27 | puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" 28 | end 29 | 30 | Rake::TestTask.new do |t| 31 | t.libs << "test" 32 | t.test_files = FileList['test/test_roo.rb'] 33 | t.verbose = true 34 | end 35 | 36 | 37 | task :default => :test 38 | -------------------------------------------------------------------------------- /website/template.rhtml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | <%= title %> 9 | 10 | 11 | 14 | 29 | 30 | 31 |
32 | 33 |

<%= title %>

34 |
35 | Get Version 36 | <%= version %> 37 |
38 | <%= body %> 39 |

40 | Thomas Preymesser, <%= modified.pretty %>
41 | Theme extended from Paul Battley 42 |

43 |
44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | License.txt 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | base64include.rb 7 | examples/roo_soap_server.rb 8 | examples/roo_soap_client.rb 9 | examples/write_me.rb 10 | lib/roo.rb 11 | lib/roo/version.rb 12 | lib/roo/generic_spreadsheet.rb 13 | lib/roo/openoffice.rb 14 | lib/roo/excel.rb 15 | lib/roo/excelx.rb 16 | lib/roo/google.rb 17 | lib/roo/roo_rails_helper.rb 18 | scripts/txt2html 19 | setup.rb 20 | test/false_encoding.xls 21 | test/Bibelbund1.ods 22 | test/Bibelbund.ods 23 | test/Bibelbund.xls 24 | test/Bibelbund.xlsx 25 | test/Bibelbund.csv 26 | test/bbu.xls 27 | test/bbu.xlsx 28 | test/bbu.ods 29 | test/no_spreadsheet_file.txt 30 | test/simple_spreadsheet.ods 31 | test/simple_spreadsheet.xls 32 | test/simple_spreadsheet.xlsx 33 | test/simple_spreadsheet_from_italo.ods 34 | test/simple_spreadsheet_from_italo.xls 35 | test/test_helper.rb 36 | test/test_roo.rb 37 | test/time-test.ods 38 | test/time-test.xls 39 | test/time-test.xlsx 40 | test/time-test.csv 41 | test/numbers1.csv 42 | test/numbers1_excel.csv 43 | test/numbers1.ods 44 | test/numbers1.xls 45 | test/numbers1.xlsx 46 | test/borders.ods 47 | test/borders.xls 48 | test/borders.xlsx 49 | test/formula.ods 50 | test/formula.xls 51 | test/formula.xlsx 52 | test/only_one_sheet.ods 53 | test/only_one_sheet.xls 54 | test/only_one_sheet.xlsx 55 | test/bode-v1.xls.zip 56 | test/bode-v1.ods.zip 57 | test/ric.ods 58 | test/bug-row-column-fixnum-float.xls 59 | test/emptysheets.ods 60 | test/emptysheets.xls 61 | test/datetime.ods 62 | test/datetime.xls 63 | test/datetime.xlsx 64 | website/index.html 65 | website/index.txt 66 | website/javascripts/rounded_corners_lite.inc.js 67 | website/stylesheets/screen.css 68 | website/template.rhtml 69 | -------------------------------------------------------------------------------- /examples/roo_soap_client.rb: -------------------------------------------------------------------------------- 1 | require 'soap/rpc/driver' 2 | 3 | def ferien_fuer_region(proxy, region, year=nil) 4 | proxy.first_row.upto(proxy.last_row) { |row| 5 | if proxy.cell(row, 2) == region 6 | jahr = proxy.cell(row,1).to_i 7 | if year == nil || jahr == year 8 | bis_datum = proxy.cell(row,5) 9 | if DateTime.now > bis_datum 10 | print '(' 11 | end 12 | print jahr.to_s+" " 13 | print proxy.cell(row,2)+" " 14 | print proxy.cell(row,3)+" " 15 | print proxy.cell(row,4).to_s+" " 16 | print bis_datum.to_s+" " 17 | print (proxy.cell(row,6) || '')+" " 18 | if DateTime.now > bis_datum 19 | print ')' 20 | end 21 | puts 22 | end 23 | end 24 | } 25 | end 26 | 27 | proxy = SOAP::RPC::Driver.new("http://localhost:12321","spreadsheetserver") 28 | proxy.add_method('cell','row','col') 29 | proxy.add_method('officeversion') 30 | proxy.add_method('last_row') 31 | proxy.add_method('last_column') 32 | proxy.add_method('first_row') 33 | proxy.add_method('first_column') 34 | proxy.add_method('sheets') 35 | proxy.add_method('set_default_sheet','s') 36 | proxy.add_method('ferien_fuer_region', 'region') 37 | 38 | sheets = proxy.sheets 39 | proxy.set_default_sheet(sheets.first) 40 | 41 | puts "first row: #{proxy.first_row}" 42 | puts "first column: #{proxy.first_column}" 43 | puts "last row: #{proxy.last_row}" 44 | puts "last column: #{proxy.last_column}" 45 | puts "cell: #{proxy.cell('C',8)}" 46 | puts "cell: #{proxy.cell('F',12)}" 47 | puts "officeversion: #{proxy.officeversion}" 48 | puts "Berlin:" 49 | 50 | ferien_fuer_region(proxy, "Berlin") 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /scripts/txt2html: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'rubygems' 4 | require 'redcloth' 5 | require 'syntax/convertors/html' 6 | require 'erb' 7 | require File.dirname(__FILE__) + '/../lib/roo/version.rb' 8 | 9 | version = Roo::VERSION::STRING 10 | download = 'http://rubyforge.org/projects/roo' 11 | 12 | class Fixnum 13 | def ordinal 14 | # teens 15 | return 'th' if (10..19).include?(self % 100) 16 | # others 17 | case self % 10 18 | when 1: return 'st' 19 | when 2: return 'nd' 20 | when 3: return 'rd' 21 | else return 'th' 22 | end 23 | end 24 | end 25 | 26 | class Time 27 | def pretty 28 | return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}" 29 | end 30 | end 31 | 32 | def convert_syntax(syntax, source) 33 | return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^
|
$!,'') 34 | end 35 | 36 | if ARGV.length >= 1 37 | src, template = ARGV 38 | template ||= File.dirname(__FILE__) + '/../website/template.rhtml' 39 | 40 | else 41 | puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html") 42 | exit! 43 | end 44 | 45 | template = ERB.new(File.open(template).read) 46 | 47 | title = nil 48 | body = nil 49 | File.open(src) do |fsrc| 50 | title_text = fsrc.readline 51 | body_text = fsrc.read 52 | syntax_items = [] 53 | body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)!m){ 54 | ident = syntax_items.length 55 | element, syntax, source = $1, $2, $3 56 | syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}" 57 | "syntax-temp-#{ident}" 58 | } 59 | title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip 60 | body = RedCloth.new(body_text).to_html 61 | body.gsub!(%r!(?:
)?syntax-temp-(d+)(?:
)?!){ syntax_items[$1.to_i] } 62 | end 63 | stat = File.stat(src) 64 | created = stat.ctime 65 | modified = stat.mtime 66 | 67 | $stdout << template.result(binding) 68 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | I'm no longer maintaining this code. It's under active development here and new releases should be coming from that repository: 2 | 3 | https://github.com/Empact/roo 4 | 5 | 6 | 7 | 8 | # README for Roo 9 | 10 | Roo is available here and on Rubyforge. You can install the official release with 'gem install roo' or refer to the installation instructions below for the latest development gem. 11 | 12 | Homepage: http://roo.rubyforge.org/ 13 | 14 | Gemcutter: http://rubygems.org/gems/roo 15 | 16 | ## Installation 17 | 18 | # Run the following if you haven't done so before: 19 | gem sources -a http://gems.github.com/ 20 | 21 | # Install the gem: 22 | sudo gem install roo 23 | 24 | ## Usage: 25 | 26 | require 'rubygems' 27 | require 'roo' 28 | 29 | s = Openoffice.new("myspreadsheet.ods") # creates an Openoffice Spreadsheet instance 30 | s = Excel.new("myspreadsheet.xls") # creates an Excel Spreadsheet instance 31 | s = Google.new("myspreadsheetkey_at_google") # creates an Google Spreadsheet instance 32 | s = Excelx.new("myspreadsheet.xlsx") # creates an Excel Spreadsheet instance for Excel .xlsx files 33 | 34 | s.default_sheet = s.sheets.first # first sheet in the spreadsheet file will be used 35 | 36 | # s.sheet is an array which holds the names of the sheets within 37 | # a spreadsheet. 38 | # you can also write 39 | # s.default_sheet = s.sheets[3] or 40 | # s.default_sheet = 'Sheet 3' 41 | 42 | s.cell(1,1) # returns the content of the first row/first cell in the sheet 43 | s.cell('A',1) # same cell 44 | s.cell(1,'A') # same cell 45 | s.cell(1,'A',s.sheets[0]) # same cell 46 | 47 | # almost all methods have an optional argument 'sheet'. 48 | # If this parameter is omitted, the default_sheet will be used. 49 | 50 | s.info # prints infos about the spreadsheet file 51 | 52 | s.first_row # the number of the first row 53 | s.last_row # the number of the last row 54 | s.first_column # the number of the first column 55 | s.last_column # the number of the last column 56 | 57 | # limited font information is available 58 | 59 | s.font(1,1).bold? 60 | s.font(1,1).italic? 61 | s.font(1,1).underline? 62 | 63 | 64 | see http://roo.rubyforge.org for a more complete tutorial 65 | 66 | -------------------------------------------------------------------------------- /test/only_one_sheet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | Licensed User 10 | 2009-12-22T17:40:00Z 11 | 12.00 12 | 13 | 14 | 8190 15 | 16380 16 | 0 17 | 0 18 | 395 19 | False 20 | False 21 | 22 | 23 | 31 | 32 | 33 | 35 | 36 | 42 37 | 43 38 | 44 39 | 40 |
41 | 42 | 43 | 44 |
45 |