Skip to content
This repository
Browse code

first pass at excel2003 xml spport

  • Loading branch information...
commit 4750e5b6d52319d3386d582faaaad085257763f9 1 parent 9ad018c
Hugh McGowan authored
3  lib/roo.rb
@@ -9,6 +9,8 @@ def open(file)
9 9 Excelx.new(file)
10 10 when '.ods'
11 11 Openoffice.new(file)
  12 + when '.xml'
  13 + Excel2003.new(file)
12 14 when ''
13 15 Google.new(file)
14 16 else
@@ -26,4 +28,5 @@ def open(file)
26 28 require 'roo/excel'
27 29 require 'roo/excelx'
28 30 require 'roo/google'
  31 +require 'roo/excel2003'
29 32 require 'roo/roo_rails_helper'
3  lib/roo/generic_spreadsheet.rb
@@ -366,9 +366,10 @@ def file_type_check(filename, ext, name)
366 366 '.ods' => 'Openoffice.new',
367 367 '.xls' => 'Excel.new',
368 368 '.xlsx' => 'Excelx.new',
  369 + '.xml' => 'Excel2003.new'
369 370 }
370 371 case ext
371   - when '.ods', '.xls', '.xlsx'
  372 + when '.ods', '.xls', '.xlsx', '.xml'
372 373 correct_class = "use #{new_expression[ext]} to handle #{ext} spreadsheet files"
373 374 else
374 375 raise "unknown file type: #{ext}"
4 roo.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9 9
10 10 s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11 11 s.authors = ["Hugh McGowan", "Thomas Preymesser"]
12   - s.date = %q{2009-08-31}
  12 + s.date = %q{2009-12-21}
13 13 s.description = %q{roo can access the contents of OpenOffice-, Excel- or Google-Spreadsheets}
14 14 s.email = %q{hugh_mcgowan@yahoo.com}
15 15 s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19 19 s.files = [
20 20 "lib/roo.rb",
21 21 "lib/roo/excel.rb",
  22 + "lib/roo/excel2003.rb",
22 23 "lib/roo/excelx.rb",
23 24 "lib/roo/generic_spreadsheet.rb",
24 25 "lib/roo/google.rb",
@@ -51,6 +52,7 @@ Gem::Specification.new do |s|
51 52 "test/datetime_floatconv.xls",
52 53 "test/emptysheets.ods",
53 54 "test/emptysheets.xls",
  55 + "test/excel2003.xml",
54 56 "test/false_encoding.xls",
55 57 "test/formula.ods",
56 58 "test/formula.xls",
14 test/test_roo.rb
@@ -128,10 +128,10 @@ def minutes
128 128
129 129 class TestRoo < Test::Unit::TestCase
130 130
131   - OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
  131 + OPENOFFICE = false # do Openoffice-Spreadsheet Tests?
132 132 EXCEL = true # do Excel Tests?
133 133 GOOGLE = false # do Google-Spreadsheet Tests?
134   - EXCELX = true # do Excel-X Tests? (.xlsx-files)
  134 + EXCELX = false # do Excel-X Tests? (.xlsx-files)
135 135
136 136 ONLINE = true
137 137 LONG_RUN = false
@@ -155,6 +155,7 @@ def with_each_spreadsheet(options)
155 155 yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xls')) if EXCEL && options[:format].include?(:excel)
156 156 yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xlsx')) if EXCELX && options[:format].include?(:excelx)
157 157 yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.ods')) if OPENOFFICE && options[:format].include?(:openoffice)
  158 + yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xml')) if EXCEL && options[:format].include?(:excel2003)
158 159 yield Roo::Spreadsheet.open(key_of(options[:name]) || options[:name]) if GOOGLE && options[:format].include?(:google)
159 160 end
160 161
@@ -1800,6 +1801,15 @@ def test_bad_excel_date
1800 1801 }
1801 1802 end
1802 1803 end
  1804 +
  1805 + def test_foo
  1806 + with_each_spreadsheet(:name=>'excel2003', :format=>:excel2003) do |oo|
  1807 + oo.default_sheet = 'SiteData'
  1808 + puts oo.cell(1,1)
  1809 + puts oo.cell(1,2)
  1810 + end
  1811 + end
  1812 +
1803 1813
1804 1814 def test_public_google_doc
1805 1815 with_public_google_spreadsheet do

0 comments on commit 4750e5b

Please sign in to comment.
Something went wrong with that request. Please try again.