jruby-poi 0.9.0 → 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +18 -4
- data/Gemfile +3 -6
- data/Gemfile.lock +20 -27
- data/README.markdown +49 -47
- data/Rakefile +20 -27
- data/jruby-poi.gemspec +7 -70
- data/lib/poi-jars/lib/commons-codec-1.10.jar +0 -0
- data/lib/poi-jars/lib/commons-collections4-4.1.jar +0 -0
- data/lib/poi-jars/lib/commons-logging-1.2.jar +0 -0
- data/lib/poi-jars/lib/junit-4.12.jar +0 -0
- data/lib/poi-jars/lib/log4j-1.2.17.jar +0 -0
- data/lib/poi-jars/ooxml-lib/curvesapi-1.04.jar +0 -0
- data/lib/{ooxml-lib/xmlbeans-2.3.0.jar → poi-jars/ooxml-lib/xmlbeans-2.6.0.jar} +0 -0
- data/lib/poi-jars/poi-3.15.jar +0 -0
- data/lib/poi-jars/poi-examples-3.15.jar +0 -0
- data/lib/poi-jars/poi-excelant-3.15.jar +0 -0
- data/lib/poi-jars/poi-ooxml-3.15.jar +0 -0
- data/lib/poi-jars/poi-ooxml-schemas-3.15.jar +0 -0
- data/lib/poi-jars/poi-scratchpad-3.15.jar +0 -0
- data/lib/poi.rb +13 -7
- data/lib/poi/version.rb +11 -0
- data/lib/poi/workbook/area.rb +20 -17
- data/lib/poi/workbook/cell.rb +28 -42
- data/lib/poi/workbook/row.rb +1 -1
- data/lib/poi/workbook/workbook.rb +3 -7
- data/lib/poi/workbook/worksheet.rb +2 -2
- data/spec/data/1904_window_dates.xls +0 -0
- data/spec/data/various_samples.xlsx +0 -0
- data/spec/facade_spec.rb +35 -35
- data/spec/spec_helper.rb +10 -0
- data/spec/support/matchers/cell_matcher.rb +3 -3
- data/spec/workbook_spec.rb +368 -385
- data/spec/writing_spec.rb +144 -144
- metadata +111 -121
- data/VERSION +0 -1
- data/lib/ooxml-lib/dom4j-1.6.1.jar +0 -0
- data/lib/ooxml-lib/stax-api-1.0.1.jar +0 -0
- data/lib/poi-3.8-20120326.jar +0 -0
- data/lib/poi-examples-3.8-20120326.jar +0 -0
- data/lib/poi-excelant-3.8-20120326.jar +0 -0
- data/lib/poi-ooxml-3.8-20120326.jar +0 -0
- data/lib/poi-ooxml-schemas-3.8-20120326.jar +0 -0
- data/lib/poi-scratchpad-3.8-20120326.jar +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 50df8568c0c364eb968db03083b01b77777ae6be
|
4
|
+
data.tar.gz: 644e0ace7c040171ee7fcca280a9565bb7f99a6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0cf0d99304082a784879209fb01bb223580a259fe9410ebbf6f9ca8bf178e633dc50a198b76ac64b9fab5d4cc77232b9f0c95ebdb97b990e912eafa40c316ad6
|
7
|
+
data.tar.gz: 3251d3d8f7f0a31c8dadd5b6dc309d0e0234ad6453f73868604fdde357c312ba241da7d34d93e220ca488d49858dfe68325ce375fb89bc60112e1f5ef170c226
|
data/.gitignore
ADDED
data/.travis.yml
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
|
4
|
-
-
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
os:
|
4
|
+
- linux
|
5
|
+
- osx
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- jruby-1.7.23
|
9
|
+
- jruby-9.1.5.0
|
10
|
+
|
11
|
+
script:
|
12
|
+
bundle exec rake spec
|
13
|
+
|
14
|
+
before_install:
|
15
|
+
- gem install bundler
|
16
|
+
|
17
|
+
cache:
|
18
|
+
- bundler
|
data/Gemfile
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
gem "rspec", ">= 2.11.0"
|
7
|
-
gem "jeweler", ">= 1.8.4"
|
8
|
-
gem "jruby-openssl"
|
3
|
+
group :test do
|
4
|
+
gem "rake", "> 10.0"
|
5
|
+
gem "rspec", "~> 3.0"
|
9
6
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,28 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
rspec (2.11.0)
|
20
|
-
rspec-core (~> 2.11.0)
|
21
|
-
rspec-expectations (~> 2.11.0)
|
22
|
-
rspec-mocks (~> 2.11.0)
|
23
|
-
rspec-core (2.11.1)
|
24
|
-
rspec-expectations (2.11.1)
|
25
|
-
diff-lcs (~> 1.1.3)
|
26
|
-
rspec-mocks (2.11.1)
|
4
|
+
diff-lcs (1.2.5)
|
5
|
+
rake (10.1.0)
|
6
|
+
rspec (3.5.0)
|
7
|
+
rspec-core (~> 3.5.0)
|
8
|
+
rspec-expectations (~> 3.5.0)
|
9
|
+
rspec-mocks (~> 3.5.0)
|
10
|
+
rspec-core (3.5.4)
|
11
|
+
rspec-support (~> 3.5.0)
|
12
|
+
rspec-expectations (3.5.0)
|
13
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
14
|
+
rspec-support (~> 3.5.0)
|
15
|
+
rspec-mocks (3.5.0)
|
16
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
17
|
+
rspec-support (~> 3.5.0)
|
18
|
+
rspec-support (3.5.0)
|
27
19
|
|
28
20
|
PLATFORMS
|
29
21
|
java
|
30
|
-
ruby
|
31
22
|
|
32
23
|
DEPENDENCIES
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
rake (> 10.0)
|
25
|
+
rspec (~> 3.0)
|
26
|
+
|
27
|
+
BUNDLED WITH
|
28
|
+
1.13.6
|
data/README.markdown
CHANGED
@@ -8,56 +8,58 @@ This little gem provides an alternative interface to the Apache POI java library
|
|
8
8
|
INSTALL
|
9
9
|
=======
|
10
10
|
|
11
|
-
|
11
|
+
```
|
12
|
+
$ gem install jruby-poi
|
13
|
+
```
|
12
14
|
|
13
15
|
USAGE
|
14
16
|
=====
|
15
|
-
It's pretty simple really, create
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
17
|
+
It's pretty simple really, create an instance of `POI::Workbook` and access its sheets, rows, and cells. You can read from the spreadsheet, save it (as the filename with which you created or as a new spreadsheet via `Workbook#save_as`).
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require 'poi'
|
21
|
+
|
22
|
+
# given an Excel spreadsheet whose first sheet (Sheet 1) has this data:
|
23
|
+
# A B C D E
|
24
|
+
# 1 4 A 2010-01-04
|
25
|
+
# 2 3 B =DATE(YEAR($E$1), MONTH($E$1), A2)
|
26
|
+
# 3 2 C =DATE(YEAR($E$1), MONTH($E$1), A3)
|
27
|
+
# 4 1 D =DATE(YEAR($E$1), MONTH($E$1), A4)
|
28
|
+
|
29
|
+
workbook = POI::Workbook.open('spreadsheet.xlsx')
|
30
|
+
sheet = workbook.worksheets["Sheet 1"]
|
31
|
+
rows = sheet.rows
|
32
|
+
|
33
|
+
# get a cell's value -- returns the value as its proper type, evaluating formulas if need be
|
34
|
+
rows[0][0].value # => 4.0
|
35
|
+
rows[0][1].value # => nil
|
36
|
+
rows[0][2].value # => 'A'
|
37
|
+
rows[0][3].value # => nil
|
38
|
+
rows[0][4].value # => 2010-01-04 as a Date instance
|
39
|
+
rows[1][4].value # => 2010-01-03 as a Date instance
|
40
|
+
rows[2][4].value # => 2010-01-02 as a Date instance
|
41
|
+
rows[3][4].value # => 2010-01-01 as a Date instance
|
42
|
+
|
43
|
+
# you can access a cell in array style as well... these snippets are all equivalent
|
44
|
+
workbook.sheets[0][2][2] # => 'C'
|
45
|
+
workbook[0][2][2] # => 'C'
|
46
|
+
workbook.sheets['Sheet 1'][2][2] # => 'C'
|
47
|
+
workbook['Sheet 1'][2][2] # => 'C'
|
48
|
+
|
49
|
+
# you can access a cell in 3D cell format too
|
50
|
+
workbook['Sheet 1!A1'] # => 4.0
|
51
|
+
|
52
|
+
# you can even refer to ranges of cells
|
53
|
+
workbook['Sheet 1!A1:A3'] # => [4.0, 3.0, 2.0]
|
54
|
+
|
55
|
+
# if cells E1 - E4 were a named range, you could refer to those cells by its name
|
56
|
+
# eg. if the cells were named "dates"...
|
57
|
+
workbook['dates'] # => dates from E1 - E4
|
58
|
+
|
59
|
+
# to get the Cell instance, instead of its value, just use the Workbook#cell method
|
60
|
+
workbook.cell('dates') # => cells that contain dates from E1 to E4
|
61
|
+
workbook['Sheet 1!A1:A3'] # => cells that contain 4.0, 3.0, and 2.0
|
62
|
+
```
|
61
63
|
|
62
64
|
TODO
|
63
65
|
====
|
data/Rakefile
CHANGED
@@ -1,35 +1,28 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'bundler'
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
|
1
|
+
require 'bundler/setup'
|
12
2
|
require 'rake'
|
13
|
-
require '
|
14
|
-
require 'rspec/core'
|
3
|
+
require 'rake/clean'
|
15
4
|
require 'rspec/core/rake_task'
|
5
|
+
require_relative './lib/poi/version'
|
6
|
+
|
7
|
+
NAME = 'jruby-poi'
|
8
|
+
VERSION = POI.version
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
gemspec.summary = "Apache POI class library for jruby"
|
21
|
-
gemspec.description = "A rubyesque library for manipulating spreadsheets and other document types for jruby, using Apache POI."
|
22
|
-
gemspec.license = "Apache"
|
23
|
-
gemspec.email = ["sdeming@makefile.com", "jacaetevha@gmail.com"]
|
24
|
-
gemspec.homepage = "http://github.com/kameeoze/jruby-poi"
|
25
|
-
gemspec.authors = ["Scott Deming", "Jason Rogers"]
|
10
|
+
desc "Build gem"
|
11
|
+
task :package=>[:clean] do |p|
|
12
|
+
sh %{#{FileUtils::RUBY} -S gem build jruby-poi.gemspec}
|
26
13
|
end
|
27
|
-
Jeweler::RubygemsDotOrgTasks.new
|
28
14
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
15
|
+
desc "Publish gem"
|
16
|
+
task :release=>[:package] do
|
17
|
+
sh %{#{FileUtils::RUBY} -S gem push ./#{NAME}-#{VERSION}.gem}
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Run all tests"
|
21
|
+
RSpec::Core::RakeTask.new('spec')
|
22
|
+
|
23
|
+
desc "Print version"
|
24
|
+
task :version do
|
25
|
+
puts VERSION
|
33
26
|
end
|
34
27
|
|
35
28
|
task :default => :spec
|
data/jruby-poi.gemspec
CHANGED
@@ -1,85 +1,22 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/poi/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
5
|
s.name = "jruby-poi"
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.version = POI.version
|
11
7
|
s.authors = ["Scott Deming", "Jason Rogers"]
|
12
|
-
s.date = "
|
8
|
+
s.date = "2016-11-04"
|
13
9
|
s.description = "A rubyesque library for manipulating spreadsheets and other document types for jruby, using Apache POI."
|
14
10
|
s.email = ["sdeming@makefile.com", "jacaetevha@gmail.com"]
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
|
17
|
-
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".travis.yml",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE",
|
24
|
-
"NOTICE",
|
25
|
-
"README.markdown",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"jruby-poi.gemspec",
|
29
|
-
"lib/ooxml-lib/dom4j-1.6.1.jar",
|
30
|
-
"lib/ooxml-lib/stax-api-1.0.1.jar",
|
31
|
-
"lib/ooxml-lib/xmlbeans-2.3.0.jar",
|
32
|
-
"lib/poi-3.8-20120326.jar",
|
33
|
-
"lib/poi-examples-3.8-20120326.jar",
|
34
|
-
"lib/poi-excelant-3.8-20120326.jar",
|
35
|
-
"lib/poi-ooxml-3.8-20120326.jar",
|
36
|
-
"lib/poi-ooxml-schemas-3.8-20120326.jar",
|
37
|
-
"lib/poi-scratchpad-3.8-20120326.jar",
|
38
|
-
"lib/poi.rb",
|
39
|
-
"lib/poi/workbook.rb",
|
40
|
-
"lib/poi/workbook/area.rb",
|
41
|
-
"lib/poi/workbook/cell.rb",
|
42
|
-
"lib/poi/workbook/named_range.rb",
|
43
|
-
"lib/poi/workbook/row.rb",
|
44
|
-
"lib/poi/workbook/workbook.rb",
|
45
|
-
"lib/poi/workbook/worksheet.rb",
|
46
|
-
"spec/data/simple_with_picture.ods",
|
47
|
-
"spec/data/simple_with_picture.xls",
|
48
|
-
"spec/data/spreadsheet.ods",
|
49
|
-
"spec/data/timesheet.xlsx",
|
50
|
-
"spec/data/various_samples.xlsx",
|
51
|
-
"spec/facade_spec.rb",
|
52
|
-
"spec/io_spec.rb",
|
53
|
-
"spec/spec_helper.rb",
|
54
|
-
"spec/support/java/jrubypoi/MockOutputStream.java",
|
55
|
-
"spec/support/java/support.jar",
|
56
|
-
"spec/support/matchers/cell_matcher.rb",
|
57
|
-
"spec/workbook_spec.rb",
|
58
|
-
"spec/writing_spec.rb",
|
59
|
-
"spec_debug.sh"
|
60
|
-
]
|
11
|
+
s.extra_rdoc_files = [ "LICENSE", "README.markdown" ]
|
12
|
+
s.files = `git ls-files -z`.split("\0")
|
13
|
+
s.test_files = `git ls-files -z spec/`.split("\0")
|
61
14
|
s.homepage = "http://github.com/kameeoze/jruby-poi"
|
62
15
|
s.licenses = ["Apache"]
|
63
16
|
s.require_paths = ["lib"]
|
64
17
|
s.rubygems_version = "1.8.24"
|
65
18
|
s.summary = "Apache POI class library for jruby"
|
66
19
|
|
67
|
-
|
68
|
-
s.specification_version = 3
|
69
|
-
|
70
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
71
|
-
s.add_development_dependency(%q<rspec>, [">= 2.11.0"])
|
72
|
-
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
73
|
-
s.add_development_dependency(%q<jruby-openssl>, [">= 0"])
|
74
|
-
else
|
75
|
-
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
76
|
-
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
77
|
-
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
78
|
-
end
|
79
|
-
else
|
80
|
-
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
81
|
-
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
82
|
-
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
83
|
-
end
|
20
|
+
s.add_development_dependency('rspec', '~> 3.0')
|
84
21
|
end
|
85
22
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/poi.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
JRUBY_POI_LIB_PATH=File.expand_path(File.dirname(__FILE__))
|
2
2
|
|
3
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi', 'version')
|
4
|
+
|
3
5
|
# Java
|
4
6
|
require 'java'
|
5
|
-
require File.join(JRUBY_POI_LIB_PATH, 'poi-
|
6
|
-
require File.join(JRUBY_POI_LIB_PATH, 'poi-
|
7
|
-
require File.join(JRUBY_POI_LIB_PATH, 'poi-ooxml-
|
8
|
-
require File.join(JRUBY_POI_LIB_PATH, 'poi-
|
9
|
-
require File.join(JRUBY_POI_LIB_PATH, '
|
10
|
-
require File.join(JRUBY_POI_LIB_PATH, 'ooxml-lib', '
|
11
|
-
require File.join(JRUBY_POI_LIB_PATH, 'ooxml-lib', '
|
7
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'lib', 'commons-collections4-4.1.jar')
|
8
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-3.15.jar')
|
9
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-ooxml-3.15.jar')
|
10
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-ooxml-schemas-3.15.jar')
|
11
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-scratchpad-3.15.jar')
|
12
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'ooxml-lib', 'xmlbeans-2.6.0.jar')
|
13
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'ooxml-lib', 'curvesapi-1.04.jar')
|
14
|
+
|
15
|
+
#commons-codec-1.10.jar commons-collections4-4.1.jar commons-logging-1.2.jar junit-4.12.jar log4j-1.2.17.jar
|
12
16
|
|
13
17
|
# Ruby
|
18
|
+
require File.join(JRUBY_POI_LIB_PATH, 'poi', 'version')
|
14
19
|
require File.join(JRUBY_POI_LIB_PATH, 'poi', 'workbook')
|
20
|
+
require 'date' # required for Date.parse
|
data/lib/poi/version.rb
ADDED
data/lib/poi/workbook/area.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
module POI
|
2
2
|
class Area
|
3
|
-
def initialize reference
|
3
|
+
def initialize reference, version
|
4
4
|
@ref = reference
|
5
|
+
@version = version
|
5
6
|
end
|
6
|
-
|
7
|
+
|
7
8
|
def in workbook
|
8
9
|
if single_cell_reference?
|
9
10
|
ref = area.all_referenced_cells.first
|
10
11
|
return [workbook.single_cell(ref)]
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
begin
|
14
15
|
by_column = {}
|
15
16
|
# refs = area.all_referenced_cells
|
@@ -20,7 +21,7 @@ module POI
|
|
20
21
|
# first = workbook.worksheets[cell_ref.sheet_name].first_row
|
21
22
|
# last = workbook.worksheets[cell_ref.sheet_name].last_row
|
22
23
|
# next unless cell_ref.row >= first && cell_ref.row <= last
|
23
|
-
#
|
24
|
+
#
|
24
25
|
# # ref = POI::CELL_REF.new(c.format_as_string)
|
25
26
|
# cell = workbook.single_cell cell_ref
|
26
27
|
# (by_column[cell_ref.cell_ref_parts.collect.last] ||= []) << cell
|
@@ -32,16 +33,16 @@ module POI
|
|
32
33
|
first = workbook.worksheets[cell_ref.sheet_name].first_row
|
33
34
|
last = workbook.worksheets[cell_ref.sheet_name].last_row
|
34
35
|
next unless cell_ref.row >= first && cell_ref.row <= last
|
35
|
-
|
36
|
+
|
36
37
|
# ref = POI::CELL_REF.new(c.format_as_string)
|
37
38
|
cell = workbook.single_cell cell_ref
|
38
39
|
(by_column[cell_ref.cell_ref_parts.to_a.last] ||= []) << cell
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
by_column.each do |key, cells|
|
42
43
|
by_column[key] = cells.compact
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
if by_column.length == 1
|
46
47
|
by_column.values.flatten
|
47
48
|
else
|
@@ -51,31 +52,33 @@ module POI
|
|
51
52
|
[]
|
52
53
|
end
|
53
54
|
end
|
54
|
-
|
55
|
+
|
55
56
|
def single_cell_reference?
|
56
57
|
area.single_cell? #@ref == getFirstCell.formatAsString rescue false
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
private
|
60
61
|
def area
|
61
62
|
@area ||= new_area_reference
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
def new_area_reference
|
65
66
|
begin
|
66
|
-
return
|
67
|
+
return column_reference
|
68
|
+
rescue => x
|
69
|
+
return POI::AREA_REF.new(@ref, @version)
|
67
70
|
rescue
|
68
|
-
|
71
|
+
raise "could not determine area reference for #{@ref}: #{$!.message}"
|
69
72
|
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def column_reference
|
70
76
|
sheet_parts = @ref.split('!')
|
71
77
|
area_parts = sheet_parts.last.split(':')
|
72
78
|
area_start = "#{sheet_parts.first}!#{area_parts.first}"
|
73
79
|
area_end = area_parts.last
|
74
|
-
|
75
|
-
|
76
|
-
rescue
|
77
|
-
raise "could not determine area reference for #{@ref}: #{$!.message}"
|
78
|
-
end
|
80
|
+
|
81
|
+
POI::AREA_REF.getWholeColumn(@version, area_start, area_end)
|
79
82
|
end
|
80
83
|
end
|
81
84
|
end
|