Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first pass at excel2003 xml spport

  • Loading branch information...
commit 4750e5b6d52319d3386d582faaaad085257763f9 1 parent 9ad018c
@hmcgowan authored
View
3  lib/roo.rb
@@ -9,6 +9,8 @@ def open(file)
Excelx.new(file)
when '.ods'
Openoffice.new(file)
+ when '.xml'
+ Excel2003.new(file)
when ''
Google.new(file)
else
@@ -26,4 +28,5 @@ def open(file)
require 'roo/excel'
require 'roo/excelx'
require 'roo/google'
+require 'roo/excel2003'
require 'roo/roo_rails_helper'
View
3  lib/roo/generic_spreadsheet.rb
@@ -366,9 +366,10 @@ def file_type_check(filename, ext, name)
'.ods' => 'Openoffice.new',
'.xls' => 'Excel.new',
'.xlsx' => 'Excelx.new',
+ '.xml' => 'Excel2003.new'
}
case ext
- when '.ods', '.xls', '.xlsx'
+ when '.ods', '.xls', '.xlsx', '.xml'
correct_class = "use #{new_expression[ext]} to handle #{ext} spreadsheet files"
else
raise "unknown file type: #{ext}"
View
4 roo.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Hugh McGowan", "Thomas Preymesser"]
- s.date = %q{2009-08-31}
+ s.date = %q{2009-12-21}
s.description = %q{roo can access the contents of OpenOffice-, Excel- or Google-Spreadsheets}
s.email = %q{hugh_mcgowan@yahoo.com}
s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.files = [
"lib/roo.rb",
"lib/roo/excel.rb",
+ "lib/roo/excel2003.rb",
"lib/roo/excelx.rb",
"lib/roo/generic_spreadsheet.rb",
"lib/roo/google.rb",
@@ -51,6 +52,7 @@ Gem::Specification.new do |s|
"test/datetime_floatconv.xls",
"test/emptysheets.ods",
"test/emptysheets.xls",
+ "test/excel2003.xml",
"test/false_encoding.xls",
"test/formula.ods",
"test/formula.xls",
View
14 test/test_roo.rb
@@ -128,10 +128,10 @@ def minutes
class TestRoo < Test::Unit::TestCase
- OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
+ OPENOFFICE = false # do Openoffice-Spreadsheet Tests?
EXCEL = true # do Excel Tests?
GOOGLE = false # do Google-Spreadsheet Tests?
- EXCELX = true # do Excel-X Tests? (.xlsx-files)
+ EXCELX = false # do Excel-X Tests? (.xlsx-files)
ONLINE = true
LONG_RUN = false
@@ -155,6 +155,7 @@ def with_each_spreadsheet(options)
yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xls')) if EXCEL && options[:format].include?(:excel)
yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xlsx')) if EXCELX && options[:format].include?(:excelx)
yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.ods')) if OPENOFFICE && options[:format].include?(:openoffice)
+ yield Roo::Spreadsheet.open(File.join(TESTDIR, options[:name] + '.xml')) if EXCEL && options[:format].include?(:excel2003)
yield Roo::Spreadsheet.open(key_of(options[:name]) || options[:name]) if GOOGLE && options[:format].include?(:google)
end
@@ -1800,6 +1801,15 @@ def test_bad_excel_date
}
end
end
+
+ def test_foo
+ with_each_spreadsheet(:name=>'excel2003', :format=>:excel2003) do |oo|
+ oo.default_sheet = 'SiteData'
+ puts oo.cell(1,1)
+ puts oo.cell(1,2)
+ end
+ end
+
def test_public_google_doc
with_public_google_spreadsheet do
Please sign in to comment.
Something went wrong with that request. Please try again.