Skip to content

Commit

Permalink
Updated to poi 3.15. Adjusted specs where appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdeming committed Nov 5, 2016
1 parent 2ce078e commit 3a31724
Show file tree
Hide file tree
Showing 31 changed files with 650 additions and 608 deletions.
118 changes: 82 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,54 +1,97 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.3.2)
bouncy-castle-java (1.5.0146.1)
diff-lcs (1.1.3)
ffi (1.1.5-java)
git (1.2.5)
highline (1.6.15)
httparty (0.9.0)
multi_json (~> 1.0)
multi_xml
jeweler (1.8.4)
bundler (~> 1.0)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
bouncy-castle-java (1.5.0147)
builder (3.2.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.2.5)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.14-java)
git (1.3.0)
github_api (0.11.3)
addressable (~> 2.3)
descendants_tracker (~> 0.0.1)
faraday (~> 0.8, < 0.10)
hashie (>= 1.2)
multi_json (>= 1.7.5, < 2.0)
nokogiri (~> 1.6.0)
oauth2
hashie (3.4.6)
highline (1.7.8)
httpclient (2.8.2.4)
jeweler (2.1.2)
builder
bundler (>= 1.0)
git (>= 1.2.5)
github_api (~> 0.11.0)
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
rake
rdoc
jruby-openssl (0.7.7)
bouncy-castle-java (>= 1.5.0146.1)
json (1.7.3)
json (1.7.3-java)
launchy (2.1.2)
semver
jruby-openssl (0.9.4)
bouncy-castle-java (>= 1.5.0147)
json (1.8.3)
json (1.8.3-java)
jwt (1.5.6)
launchy (2.4.3)
addressable (~> 2.3)
launchy (2.1.2-java)
launchy (2.4.3-java)
addressable (~> 2.3)
ffi (~> 1.1.1)
spoon (~> 0.0.1)
multi_json (1.3.6)
multi_xml (0.5.1)
rake (0.9.2.2)
rdoc (3.12)
mini_portile2 (2.1.0)
multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
nayutaya-msgpack-pure (0.0.2)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
nokogiri (1.6.8.1-java)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
public_suffix (2.0.3)
rack (2.0.1)
rake (11.3.0)
rdoc (4.2.2)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
spoon (0.0.1)
tddium (1.5.8)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
semver (1.0.1)
spoon (0.0.6)
ffi
tddium (1.25.5)
github_api
highline
json
launchy
tddium_client (~> 0.2.0)
nayutaya-msgpack-pure (~> 0.0.2)
tddium_client (~> 0.4.2)
thor
tddium_client (0.2.0)
httparty (>= 0.8.1)
tddium_client (0.4.3)
httpclient (>= 2.2.5)
json
thor (0.16.0)
thor (0.19.1)
thread_safe (0.3.5)
thread_safe (0.3.5-java)

PLATFORMS
java
Expand All @@ -59,3 +102,6 @@ DEPENDENCIES
jruby-openssl
rspec (>= 2.11.0)
tddium

BUNDLED WITH
1.13.6
Binary file removed lib/ooxml-lib/dom4j-1.6.1.jar
Binary file not shown.
Binary file removed lib/ooxml-lib/stax-api-1.0.1.jar
Binary file not shown.
Binary file removed lib/poi-3.10.1-20140818.jar
Binary file not shown.
Binary file removed lib/poi-examples-3.10.1-20140818.jar
Binary file not shown.
Binary file removed lib/poi-excelant-3.10.1-20140818.jar
Binary file not shown.
Binary file added lib/poi-jars/lib/commons-codec-1.10.jar
Binary file not shown.
Binary file added lib/poi-jars/lib/commons-collections4-4.1.jar
Binary file not shown.
Binary file added lib/poi-jars/lib/commons-logging-1.2.jar
Binary file not shown.
Binary file added lib/poi-jars/lib/junit-4.12.jar
Binary file not shown.
Binary file added lib/poi-jars/lib/log4j-1.2.17.jar
Binary file not shown.
Binary file added lib/poi-jars/ooxml-lib/curvesapi-1.04.jar
Binary file not shown.
File renamed without changes.
Binary file added lib/poi-jars/poi-3.15.jar
Binary file not shown.
Binary file added lib/poi-jars/poi-examples-3.15.jar
Binary file not shown.
Binary file added lib/poi-jars/poi-excelant-3.15.jar
Binary file not shown.
Binary file added lib/poi-jars/poi-ooxml-3.15.jar
Binary file not shown.
Binary file added lib/poi-jars/poi-ooxml-schemas-3.15.jar
Binary file not shown.
Binary file added lib/poi-jars/poi-scratchpad-3.15.jar
Binary file not shown.
Binary file removed lib/poi-ooxml-3.10.1-20140818.jar
Binary file not shown.
Binary file removed lib/poi-ooxml-schemas-3.10.1-20140818.jar
Binary file not shown.
Binary file removed lib/poi-scratchpad-3.10.1-20140818.jar
Binary file not shown.
16 changes: 9 additions & 7 deletions lib/poi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

# Java
require 'java'
require File.join(JRUBY_POI_LIB_PATH, 'poi-3.10.1-20140818.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-ooxml-3.10.1-20140818.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-ooxml-schemas-3.10.1-20140818.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-scratchpad-3.10.1-20140818.jar')
require File.join(JRUBY_POI_LIB_PATH, 'ooxml-lib', 'xmlbeans-2.6.0.jar')
require File.join(JRUBY_POI_LIB_PATH, 'ooxml-lib', 'dom4j-1.6.1.jar')
require File.join(JRUBY_POI_LIB_PATH, 'ooxml-lib', 'stax-api-1.0.1.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'lib', 'commons-collections4-4.1.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-3.15.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-ooxml-3.15.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-ooxml-schemas-3.15.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-scratchpad-3.15.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'ooxml-lib', 'xmlbeans-2.6.0.jar')
require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'ooxml-lib', 'curvesapi-1.04.jar')

#commons-codec-1.10.jar commons-collections4-4.1.jar commons-logging-1.2.jar junit-4.12.jar log4j-1.2.17.jar

# Ruby
require File.join(JRUBY_POI_LIB_PATH, 'poi', 'workbook')
Expand Down
9 changes: 5 additions & 4 deletions lib/poi/workbook/area.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module POI
class Area
def initialize reference
def initialize reference, version
@ref = reference
@version = version
end

def in workbook
Expand Down Expand Up @@ -64,8 +65,8 @@ def area
def new_area_reference
begin
return column_reference
rescue
return POI::AREA_REF.new(@ref)
rescue => x
return POI::AREA_REF.new(@ref, @version)
rescue
raise "could not determine area reference for #{@ref}: #{$!.message}"
end
Expand All @@ -77,7 +78,7 @@ def column_reference
area_start = "#{sheet_parts.first}!#{area_parts.first}"
area_end = area_parts.last

POI::AREA_REF.getWholeColumn(area_start, area_end)
POI::AREA_REF.getWholeColumn(@version, area_start, area_end)
end
end
end
3 changes: 2 additions & 1 deletion lib/poi/workbook/cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def formula_evaluator
end

def error_value_from(cell_value)
org.apache.poi.ss.usermodel.ErrorConstants.get_text(cell_value)
#org.apache.poi.ss.usermodel.ErrorConstants.get_text(cell_value)
org.apache.poi.ss.usermodel.FormulaError.forInt(cell_value).getString
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions lib/poi/workbook/workbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def single_cell ref
end

def cells_in_area reference
area = Area.new(reference)
area = Area.new(reference, self.get_spreadsheet_version)
area.in(self)
end

Expand Down Expand Up @@ -242,13 +242,9 @@ def all_cells_in_column reference
area_start = "#{sheet_parts.first}!#{area_parts.first}"
area_end = area_parts.last

area = org.apache.poi.ss.util.AreaReference.getWholeColumn(area_start, area_end)
area = AREA_REF.getWholeColumn(get_worksheet_version, area_start, area_end)
full_ref = "#{area.first_cell.format_as_string}:#{area.last_cell.format_as_string}"
Area.new(full_ref).in(self)
# cell_reference = org.apache.poi.ss.util.CellReference.new( reference + "1" )
# column = cell_reference.get_col
# sheet = cell_reference.get_sheet_name
# worksheets[sheet].rows.collect{|row| row[column]}
end

private
Expand Down
70 changes: 35 additions & 35 deletions spec/facade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@
it "should create specialized methods for boolean methods, getters, and setters" do
book = POI::Workbook.create('foo.xlsx')
sheet = book.create_sheet
sheet.respond_to?(:column_broken?).should be_true
sheet.respond_to?(:column_hidden?).should be_true
sheet.respond_to?(:display_formulas?).should be_true
sheet.respond_to?(:display_gridlines?).should be_true
sheet.respond_to?(:selected?).should be_true
sheet.respond_to?(:column_breaks).should be_true
sheet.respond_to?(:column_break=).should be_true
sheet.respond_to?(:autobreaks?).should be_true
sheet.respond_to?(:autobreaks=).should be_true
sheet.respond_to?(:autobreaks!).should be_true
sheet.respond_to?(:column_broken?).should be_true
sheet.respond_to?(:fit_to_page).should be_true
sheet.respond_to?(:fit_to_page?).should be_true
sheet.respond_to?(:fit_to_page=).should be_true
sheet.respond_to?(:fit_to_page!).should be_true
sheet.respond_to?(:column_broken?).should be true
sheet.respond_to?(:column_hidden?).should be true
sheet.respond_to?(:display_formulas?).should be true
sheet.respond_to?(:display_gridlines?).should be true
sheet.respond_to?(:selected?).should be true
sheet.respond_to?(:column_breaks).should be true
sheet.respond_to?(:column_break=).should be true
sheet.respond_to?(:autobreaks?).should be true
sheet.respond_to?(:autobreaks=).should be true
sheet.respond_to?(:autobreaks!).should be true
sheet.respond_to?(:column_broken?).should be true
sheet.respond_to?(:fit_to_page).should be true
sheet.respond_to?(:fit_to_page?).should be true
sheet.respond_to?(:fit_to_page=).should be true
sheet.respond_to?(:fit_to_page!).should be true

sheet.respond_to?(:array_formula).should_not be_true
sheet.respond_to?(:array_formula=).should_not be_true
sheet.respond_to?(:array_formula).should_not be true
sheet.respond_to?(:array_formula=).should_not be true

row = sheet[0]
row.respond_to?(:first_cell_num).should be_true
row.respond_to?(:height).should be_true
row.respond_to?(:height=).should be_true
row.respond_to?(:height_in_points).should be_true
row.respond_to?(:height_in_points=).should be_true
row.respond_to?(:zero_height?).should be_true
row.respond_to?(:zero_height!).should be_true
row.respond_to?(:zero_height=).should be_true
row.respond_to?(:first_cell_num).should be true
row.respond_to?(:height).should be true
row.respond_to?(:height=).should be true
row.respond_to?(:height_in_points).should be true
row.respond_to?(:height_in_points=).should be true
row.respond_to?(:zero_height?).should be true
row.respond_to?(:zero_height!).should be true
row.respond_to?(:zero_height=).should be true

cell = row[0]
cell.respond_to?(:boolean_cell_value).should be_true
cell.respond_to?(:boolean_cell_value?).should be_true
cell.respond_to?(:cached_formula_result_type).should be_true
cell.respond_to?(:cell_error_value=).should be_true
cell.respond_to?(:cell_value=).should be_true
cell.respond_to?(:hyperlink=).should be_true
cell.respond_to?(:cell_value!).should be_true
cell.respond_to?(:remove_cell_comment!).should be_true
cell.respond_to?(:cell_style).should be_true
cell.respond_to?(:cell_style=).should be_true
cell.respond_to?(:boolean_cell_value).should be true
cell.respond_to?(:boolean_cell_value?).should be true
cell.respond_to?(:cached_formula_result_type).should be true
cell.respond_to?(:cell_error_value=).should be true
cell.respond_to?(:cell_value=).should be true
cell.respond_to?(:hyperlink=).should be true
cell.respond_to?(:cell_value!).should be true
cell.respond_to?(:remove_cell_comment!).should be true
cell.respond_to?(:cell_style).should be true
cell.respond_to?(:cell_style=).should be true
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

RSpec.configure do |c|
c.filter_run_excluding :unimplemented => true
c.expect_with(:rspec) { |expect_config| expect_config.syntax = :should }
end

require File.expand_path('../lib/poi', File.dirname(__FILE__))
Expand Down
4 changes: 2 additions & 2 deletions spec/support/matchers/cell_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
actual == expected
end

failure_message_for_should do |actual|
failure_message do |actual|
"expected #{actual} to equal #{expected} (row:#{row}, cell:#{col})"
end

failure_message_for_should_not do |actual|
failure_message_when_negated do |actual|
"expected #{actual} not to equal #{expected} (row:#{row}, cell:#{col})"
end

Expand Down
Loading

0 comments on commit 3a31724

Please sign in to comment.