oxcelix 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README.md +7 -12
- data/README.rdoc +5 -10
- data/lib/oxcelix/numformats.rb +1 -1
- data/oxcelix.gemspec +3 -3
- metadata +4 -4
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.3.2
|
2
|
+
* The numeric method in numformats will now try to gsub the correct format value and not the format index.
|
3
|
+
* Required rubyzip version number is now >=1.1.0. 0.9.9 which was apparently
|
4
|
+
enough did not load - thanks to Fredrik Persen Fostvedt for spotting that out.
|
5
|
+
* Clarification added to the readme: Thanks again to Fredrik!
|
6
|
+
|
1
7
|
0.3.1
|
2
8
|
* Sheet now has its very own to_ru and to_fmt methods. Also a to_m method has been added, which returns a Matrix of raw data.
|
3
9
|
* Documentation changes.
|
data/README.md
CHANGED
@@ -35,6 +35,7 @@ Synopsis
|
|
35
35
|
`w = Oxcelix::Workbook.new('whatever.xlsx', :copymerge => true)`
|
36
36
|
|
37
37
|
Convert a Sheet object into a collection of ruby values or formatted ruby strings:
|
38
|
+
|
38
39
|
`require 'oxcelix'`
|
39
40
|
`w = Oxcelix::Workbook.new('whatever.xlsx', :copymerge => true)`
|
40
41
|
`w.sheets[0].to_ru # returns a Matrix of DateTime, Integer, etc objects`
|
@@ -49,20 +50,14 @@ Installation
|
|
49
50
|
Advantages over other Excel parsers
|
50
51
|
-----------------------------------
|
51
52
|
|
52
|
-
Excel file processing involves XML document parsing. Usually, this is achieved by
|
53
|
-
|
54
|
-
|
55
|
-
The main drawbacks of this approach are memory usage and speed. The resulting object tree will be roughly as big
|
56
|
-
as the original file, and during the parsing, they will both be stored in the memory, which can
|
57
|
-
cause quite some complications when processing huge files. Also, interpreting every bit of an excel spreadsheet
|
58
|
-
will slow down unnecessarily the process, if we only need the data stored in that file.
|
59
|
-
|
60
|
-
|
61
|
-
The solution for the memory-consumption problem is SAX stream parsing.
|
53
|
+
Excel file processing involves XML document parsing. Usually, this is achieved by DOM-parsing the data with a suitable XML library.
|
62
54
|
|
55
|
+
The main drawbacks of this approach are memory usage and speed. The resulting object tree will be roughly as big as the original file, and during the parsing, they will both be stored in the memory, which can cause quite some complications when processing huge files. Also, interpreting every bit of an excel spreadsheet will slow down unnecessarily the process, if we only need the data stored in that file.
|
63
56
|
|
64
|
-
|
57
|
+
The solution for the memory-consumption problem is SAX stream parsing. This ensures that only the relevant XML elements get processed,
|
58
|
+
without having to load the whole XML file in memory.
|
65
59
|
|
60
|
+
Oxcelix uses the SAX parser offered by Peter Ohler's Ox gem. I found Ox SAX parser quite fast, so to further speed up the parsing.
|
66
61
|
|
67
62
|
For a comparison of XML parsers, please consult the Ox homepage[http://www.ohler.com/dev/xml_with_ruby/xml_with_ruby.html].
|
68
63
|
|
@@ -72,4 +67,4 @@ TODO
|
|
72
67
|
* include/exclude mechanism should extend to cell areas inside Sheet objects
|
73
68
|
* Possible speedups
|
74
69
|
* Further improvement to the formatting algorithms. Theoretically, to_fmt should be able to
|
75
|
-
split conditional-formatting strings and to display e.g. thousands separated number strings
|
70
|
+
split conditional-formatting strings and to display e.g. thousands separated number strings
|
data/README.rdoc
CHANGED
@@ -42,20 +42,15 @@ Convert a Sheet object into a collection of ruby values or formatted ruby string
|
|
42
42
|
gem install oxcelix
|
43
43
|
|
44
44
|
== Advantages over other Excel parsers
|
45
|
-
Excel file processing involves XML document parsing. Usually, this is achieved by some XML library such as Nokogiri[http://nokogiri.org].
|
46
45
|
|
46
|
+
Excel file processing involves XML document parsing. Usually, this is achieved by DOM-parsing the data with a suitable XML library.
|
47
47
|
|
48
|
-
The main drawbacks of this approach are memory usage and speed. The resulting object tree will be roughly as big
|
49
|
-
as the original file, and during the parsing, they will both be stored in the memory, which can
|
50
|
-
cause quite some complications when processing huge files. Also, interpreting every bit of an excel spreadsheet
|
51
|
-
will slow down unnecessarily the process, if we only need the data stored in that file.
|
48
|
+
The main drawbacks of this approach are memory usage and speed. The resulting object tree will be roughly as big as the original file, and during the parsing, they will both be stored in the memory, which can cause quite some complications when processing huge files. Also, interpreting every bit of an excel spreadsheet will slow down unnecessarily the process, if we only need the data stored in that file.
|
52
49
|
|
50
|
+
The solution for the memory-consumption problem is SAX stream parsing. This ensures that only the relevant XML elements get processed,
|
51
|
+
without having to load the whole XML file in memory.
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
Oxcelix uses the SAX parser offered by Peter Ohler's Ox gem. Ox is fast and powerful enough to solve the speed issue.
|
58
|
-
|
53
|
+
Oxcelix uses the SAX parser offered by Peter Ohler's Ox gem. I found Ox SAX parser quite fast, so to further speed up the parsing.
|
59
54
|
|
60
55
|
For a comparison of XML parsers, please consult the Ox homepage[http://www.ohler.com/dev/xml_with_ruby/xml_with_ruby.html].
|
61
56
|
|
data/lib/oxcelix/numformats.rb
CHANGED
@@ -37,7 +37,7 @@ module Oxcelix
|
|
37
37
|
# @return [String] a rubyish Kernel::Format string.
|
38
38
|
def numeric val
|
39
39
|
ostring = "%"
|
40
|
-
strippedfmt =
|
40
|
+
strippedfmt = val.gsub(/\?/, '0').gsub(',','')
|
41
41
|
prefix, decimals, sep, floats, expo, postfix=/(^[^\#0e].?)?([\#0]*)?(\.)?([\#0]*)?(e.?)?(.?[^\#0e]$)?/i.match(strippedfmt).captures
|
42
42
|
ostring.prepend prefix.to_s
|
43
43
|
if !decimals.nil? && decimals.size != 0
|
data/oxcelix.gemspec
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require 'rake'
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'oxcelix'
|
6
|
-
s.version = '0.3.
|
7
|
-
s.date = '
|
6
|
+
s.version = '0.3.2'
|
7
|
+
s.date = '2014-01-12'
|
8
8
|
s.summary = 'A fast Excel 2007/2010 file parser'
|
9
9
|
s.description = 'A fast Excel 2007/2010 (.xlsx) file parser that returns a collection of Matrix objects'
|
10
10
|
s.authors = 'Giovanni Biczo'
|
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.license = 'MIT'
|
22
22
|
|
23
23
|
s.add_runtime_dependency "ox", [">= 2.0.6"]
|
24
|
-
s.add_runtime_dependency "rubyzip", [">=
|
24
|
+
s.add_runtime_dependency "rubyzip", [">= 1.1.0"]
|
25
25
|
s.rdoc_options << '--all'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxcelix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ox
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 1.1.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.1.0
|
46
46
|
description: A fast Excel 2007/2010 (.xlsx) file parser that returns a collection
|
47
47
|
of Matrix objects
|
48
48
|
email:
|