jruby-poi 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/jruby-poi.gemspec +2 -2
- data/lib/poi/workbook/cell.rb +17 -10
- data/specs/workbook_spec.rb +34 -18
- metadata +3 -3
data/README.markdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/jruby-poi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jruby-poi}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Scott Deming", "Jason Rogers"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-01}
|
13
13
|
s.description = %q{A rubyesque library for manipulating spreadsheets and other document types for jruby, using Apache POI.}
|
14
14
|
s.email = ["sdeming@makefile.com", "jacaetevha@gmail.com"]
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/poi/workbook/cell.rb
CHANGED
@@ -35,6 +35,10 @@ module POI
|
|
35
35
|
@cell = cell
|
36
36
|
end
|
37
37
|
|
38
|
+
def error_value
|
39
|
+
@error_value
|
40
|
+
end
|
41
|
+
|
38
42
|
def value
|
39
43
|
return nil if @cell.nil?
|
40
44
|
value_of(cell_value_for_type(@cell.getCellType))
|
@@ -81,16 +85,19 @@ module POI
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def cell_value_for_type(cell_type)
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
begin
|
89
|
+
case cell_type
|
90
|
+
when CELL_TYPE_BLANK: nil
|
91
|
+
when CELL_TYPE_BOOLEAN: CELL_VALUE.valueOf(@cell.getBooleanCellValue)
|
92
|
+
when CELL_TYPE_FORMULA: cell_value_for_type(@cell.getCachedFormulaResultType)
|
93
|
+
when CELL_TYPE_STRING: CELL_VALUE.new(@cell.getStringCellValue)
|
94
|
+
when CELL_TYPE_ERROR, CELL_TYPE_NUMERIC: CELL_VALUE.new(@cell.getNumericCellValue)
|
95
|
+
else
|
96
|
+
raise "unhandled cell type[#{@cell.getCellType}]"
|
97
|
+
end
|
98
|
+
rescue
|
99
|
+
@error_value = $!
|
100
|
+
nil
|
94
101
|
end
|
95
102
|
end
|
96
103
|
end
|
data/specs/workbook_spec.rb
CHANGED
@@ -150,25 +150,41 @@ describe POI::Cells do
|
|
150
150
|
sheet = book.worksheets["bools & errors"]
|
151
151
|
rows = sheet.rows
|
152
152
|
|
153
|
-
rows[6][0].value.should == '~CIRCULAR~REF~'
|
154
|
-
rows[
|
155
|
-
|
156
|
-
rows[
|
157
|
-
rows[
|
158
|
-
|
159
|
-
rows[
|
160
|
-
rows[
|
161
|
-
|
153
|
+
rows[6][0].value.should == 0.0 #'~CIRCULAR~REF~'
|
154
|
+
rows[6][0].error_value.should be_nil
|
155
|
+
|
156
|
+
rows[7][0].value.should be_nil #'#DIV/0!'
|
157
|
+
rows[7][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
158
|
+
|
159
|
+
rows[8][0].value.should be_nil #'#N/A'
|
160
|
+
rows[8][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
161
|
+
|
162
|
+
rows[9][0].value.should be_nil #'#NAME?'
|
163
|
+
rows[9][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
164
|
+
|
165
|
+
rows[10][0].value.should be_nil #'#NULL!'
|
166
|
+
rows[10][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
167
|
+
|
168
|
+
rows[11][0].value.should be_nil #'#NUM!'
|
169
|
+
rows[11][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
170
|
+
|
171
|
+
rows[12][0].value.should be_nil #'#REF!'
|
172
|
+
rows[12][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
173
|
+
|
174
|
+
rows[13][0].value.should be_nil #'#VALUE!'
|
175
|
+
rows[13][0].error_value.should == 'java.lang.NumberFormatException: For input string: "#N/A"'
|
176
|
+
|
177
|
+
lambda{ rows[14][0].value }.should_not raise_error(Java::java.lang.RuntimeException)
|
162
178
|
|
163
|
-
rows[6][0].to_s.should == '~CIRCULAR~REF~'
|
164
|
-
rows[7][0].to_s.should == '#DIV/0!'
|
165
|
-
rows[8][0].to_s.should == '#N/A'
|
166
|
-
rows[9][0].to_s.should == '#NAME?'
|
167
|
-
rows[10][0].to_s.should == '#NULL!'
|
168
|
-
rows[11][0].to_s.should == '#NUM!'
|
169
|
-
rows[12][0].to_s.should == '#REF!'
|
170
|
-
rows[13][0].to_s.should == '#VALUE!'
|
171
|
-
|
179
|
+
rows[6][0].to_s.should == '0.0' #'~CIRCULAR~REF~'
|
180
|
+
rows[7][0].to_s.should == '' #'#DIV/0!'
|
181
|
+
rows[8][0].to_s.should == '' #'#N/A'
|
182
|
+
rows[9][0].to_s.should == '' #'#NAME?'
|
183
|
+
rows[10][0].to_s.should == '' #'#NULL!'
|
184
|
+
rows[11][0].to_s.should == '' #'#NUM!'
|
185
|
+
rows[12][0].to_s.should == '' #'#REF!'
|
186
|
+
rows[13][0].to_s.should == '' #'#VALUE!'
|
187
|
+
rows[14][0].to_s.should == ''
|
172
188
|
end
|
173
189
|
|
174
190
|
it "should provide booleans for boolean cells" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Scott Deming
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-01 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|