roo-xls 1.1.0 → 2.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 +5 -5
- data/.github/issue_template.md +16 -0
- data/.github/pull_request_template.md +14 -0
- data/.github/workflows/release-please.yml +52 -0
- data/.github/workflows/ruby.yml +40 -0
- data/.gitignore +4 -0
- data/.release-please-manifest.json +3 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +5 -7
- data/README.md +5 -0
- data/Rakefile +8 -2
- data/lib/roo/xls/excel.rb +15 -5
- data/lib/roo/xls/excel_2003_xml.rb +45 -24
- data/lib/roo/xls/version.rb +1 -1
- data/release-please-config.json +12 -0
- data/roo-xls.gemspec +10 -8
- data/spec/lib/roo/xls/excel2003xml_spec.rb +196 -6
- data/test/files/font_colors.xml +203 -0
- data/test/files/font_colors_screenshot_in_Mac_Excel_16.10.png +0 -0
- data/test/test_excel_2003_xml.rb +5 -5
- data/test/test_roo_excel.rb +9 -9
- metadata +74 -19
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7b4b59a55cac5820c24bfd0ccf4bfb0edd18e88cc46516ea84157b8d92d9d399
|
|
4
|
+
data.tar.gz: 2c97afde22e182df8921f4435efd18ecaa63c6ab37d600fd4e5c88b1d34afffb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c776ca11c9f604871b78e9a6ea45c09314de98ec662ebefd47922ec6f366458c685094004fcfd14e7b99138c010fd5893d6ce10f6c1d6941a55f77a0d119254
|
|
7
|
+
data.tar.gz: 37f20fc518a273c1adf7f81e137d2d99b679670b69898dd4caf368716eebca6245252ca275eadf750ddacf7ba01a42eab3235723f841b76ede9aeb848f31e525
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Thanks for filing an issue. Following these instructions will help us solve your problem sooner.
|
|
2
|
+
|
|
3
|
+
### Steps to reproduce
|
|
4
|
+
|
|
5
|
+
1. Create an executable test case for this issue ([sample test case](https://gist.github.com/tgturner/4e2b590e0218d3b261269aa662b6a7cb))
|
|
6
|
+
2. You can share your executable test case as a [gist](https://gist.github.com), or simply paste the content into the issue description.
|
|
7
|
+
- You can execute the test case by running `ruby the_file.rb` in your terminal. If all goes well, you should see your test case failing.
|
|
8
|
+
3. Please provide a stripped down version of the offending spreadsheet.
|
|
9
|
+
|
|
10
|
+
### Issue
|
|
11
|
+
Describe the issue
|
|
12
|
+
|
|
13
|
+
### System configuration
|
|
14
|
+
**Roo::Xls version**:
|
|
15
|
+
|
|
16
|
+
**Ruby version**:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
### Summary
|
|
2
|
+
|
|
3
|
+
Provide a general description of the code changes in your pull
|
|
4
|
+
request... were there any bugs you had fixed? If so, mention them. If
|
|
5
|
+
these bugs have open GitHub issues, be sure to tag them here as well,
|
|
6
|
+
to keep the conversation linked together.
|
|
7
|
+
|
|
8
|
+
### Other Information
|
|
9
|
+
|
|
10
|
+
If there's anything else that's important and relevant to your pull
|
|
11
|
+
request, mention that information here. This could include
|
|
12
|
+
benchmarks, or other information.
|
|
13
|
+
|
|
14
|
+
Thanks for contributing to Roo!
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
release-please:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
outputs:
|
|
16
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
17
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
18
|
+
steps:
|
|
19
|
+
- uses: googleapis/release-please-action@v4
|
|
20
|
+
id: release
|
|
21
|
+
with:
|
|
22
|
+
config-file: release-please-config.json
|
|
23
|
+
manifest-file: .release-please-manifest.json
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: release-please
|
|
27
|
+
if: ${{ needs.release-please.outputs.release_created }}
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment: PUBLISH
|
|
30
|
+
permissions:
|
|
31
|
+
contents: write
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout repository
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
ref: ${{ needs.release-please.outputs.tag_name }}
|
|
38
|
+
fetch-tags: true
|
|
39
|
+
|
|
40
|
+
- name: Set up Ruby
|
|
41
|
+
uses: ruby/setup-ruby@v1
|
|
42
|
+
with:
|
|
43
|
+
ruby-version: '3.4'
|
|
44
|
+
bundler-cache: true
|
|
45
|
+
|
|
46
|
+
- name: Publish to RubyGems
|
|
47
|
+
uses: rubygems/release-gem@v1
|
|
48
|
+
|
|
49
|
+
- name: Upload Gem to GitHub Release
|
|
50
|
+
env:
|
|
51
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
run: gh release upload ${{ needs.release-please.outputs.tag_name }} ./*.gem --clobber
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
pull_request:
|
|
7
|
+
branches:
|
|
8
|
+
- master
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
ruby:
|
|
21
|
+
- '3.1'
|
|
22
|
+
- '3.2'
|
|
23
|
+
- '3.3'
|
|
24
|
+
- '3.4'
|
|
25
|
+
- '4.0'
|
|
26
|
+
- ruby-head
|
|
27
|
+
- jruby-9.4.10.0
|
|
28
|
+
include:
|
|
29
|
+
- ruby: ruby-head
|
|
30
|
+
env:
|
|
31
|
+
RUBYOPT: '--jit'
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- uses: ruby/setup-ruby@v1
|
|
35
|
+
with:
|
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
|
37
|
+
bundler-cache: true
|
|
38
|
+
- run: bundle exec rake
|
|
39
|
+
env:
|
|
40
|
+
LONG_RUN: true
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
|
@@ -3,21 +3,20 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Specify your gem's dependencies in roo-xls.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
if ENV['
|
|
6
|
+
if ENV['CI']
|
|
7
7
|
gem 'roo', '>= 2.0.0beta1', git: 'https://github.com/roo-rb/roo.git'
|
|
8
8
|
else
|
|
9
|
-
gem 'roo', '>= 2.0.0beta1',
|
|
9
|
+
gem 'roo', '>= 2.0.0beta1', '< 3'
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
gem 'activesupport', '~> 4.2.0' if RUBY_VERSION < '2.2'
|
|
13
|
-
|
|
14
12
|
group :test do
|
|
15
13
|
# additional testing libs
|
|
16
14
|
gem 'webmock'
|
|
17
15
|
gem 'shoulda'
|
|
18
16
|
gem 'rspec', '>= 3.0.0'
|
|
19
|
-
gem 'simplecov', '>= 0.
|
|
20
|
-
gem '
|
|
17
|
+
gem 'simplecov', '>= 0.21', require: false
|
|
18
|
+
gem 'simplecov-lcov', '>= 0.8', require: false
|
|
19
|
+
gem 'coveralls', require: false
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
group :local_development do
|
|
@@ -28,5 +27,4 @@ group :local_development do
|
|
|
28
27
|
gem 'guard-rubocop', require: false
|
|
29
28
|
gem 'guard-reek', git: 'https://github.com/pericles/guard-reek', require: false
|
|
30
29
|
gem 'pry'
|
|
31
|
-
gem 'transpec'
|
|
32
30
|
end
|
data/README.md
CHANGED
|
@@ -10,6 +10,11 @@ This library extends Roo to add support for handling class Excel files, includin
|
|
|
10
10
|
There is no support for formulas in Roo for .xls files - you can get the result
|
|
11
11
|
of a formula but not the formula itself.
|
|
12
12
|
|
|
13
|
+
## Limitations
|
|
14
|
+
|
|
15
|
+
Roo::Xls currently doesn't provide support for the following features in Roo:
|
|
16
|
+
* [Option `:expand_merged_ranged => true`](https://github.com/roo-rb/roo#expand_merged_ranges)
|
|
17
|
+
|
|
13
18
|
## License
|
|
14
19
|
|
|
15
20
|
While Roo and Roo::Xls are licensed under the MIT / Expat license, please note that the `spreadsheet` gem [is released under](https://github.com/zdavatz/spreadsheet/blob/master/LICENSE.txt) the GPLv3 license. Please be aware that the author of the `spreadsheet` gem [claims you need a commercial license](http://spreadsheet.ch/2014/10/24/using-ruby-spreadsheet-on-heroku-with-dynos/) to use it as part of a public-facing, closed-source service, an interpretation [at odds with the FSF's intent and interpretation of the license](http://www.gnu.org/licenses/gpl-faq.html#UnreleasedMods).
|
data/Rakefile
CHANGED
|
@@ -18,6 +18,12 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
18
18
|
Coveralls::RakeTask.new
|
|
19
19
|
|
|
20
20
|
default_task = [:test, :spec]
|
|
21
|
-
default_task << 'coveralls:push' if ENV['
|
|
21
|
+
default_task << 'coveralls:push' if ENV['CI']
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
if !ENV["APPRAISAL_INITIALIZED"] && !ENV['CI']
|
|
24
|
+
task :default do
|
|
25
|
+
sh "appraisal install && appraisal rake"
|
|
26
|
+
end
|
|
27
|
+
else
|
|
28
|
+
task default: default_task
|
|
29
|
+
end
|
data/lib/roo/xls/excel.rb
CHANGED
|
@@ -48,8 +48,6 @@ module Roo
|
|
|
48
48
|
@fonts = {}
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
attr_reader :workbook
|
|
52
|
-
|
|
53
51
|
def worksheets
|
|
54
52
|
@worksheets ||= workbook.worksheets
|
|
55
53
|
end
|
|
@@ -285,7 +283,7 @@ module Roo
|
|
|
285
283
|
format = row.format(idx)
|
|
286
284
|
if format.date_or_time?
|
|
287
285
|
cell = read_cell_content(row, idx)
|
|
288
|
-
true if Float(cell)
|
|
286
|
+
true if (Float(cell, exception: false) || 0) > 0
|
|
289
287
|
else
|
|
290
288
|
false
|
|
291
289
|
end
|
|
@@ -309,7 +307,13 @@ module Roo
|
|
|
309
307
|
else
|
|
310
308
|
datetime =
|
|
311
309
|
if row.at(idx).class == ::Spreadsheet::Formula
|
|
312
|
-
row.
|
|
310
|
+
if row.respond_to?(:set_datetime, true)
|
|
311
|
+
# 1.3.4+
|
|
312
|
+
row.send(:set_datetime, cell)
|
|
313
|
+
else
|
|
314
|
+
# 1.3.3-
|
|
315
|
+
row.send(:_datetime, cell)
|
|
316
|
+
end
|
|
313
317
|
else
|
|
314
318
|
row.datetime(idx)
|
|
315
319
|
end
|
|
@@ -322,7 +326,13 @@ module Roo
|
|
|
322
326
|
value_type = :date
|
|
323
327
|
value =
|
|
324
328
|
if row.at(idx).class == ::Spreadsheet::Formula
|
|
325
|
-
row.
|
|
329
|
+
if row.respond_to?(:set_date, true)
|
|
330
|
+
# 1.3.4+
|
|
331
|
+
row.send(:set_date, cell)
|
|
332
|
+
else
|
|
333
|
+
# 1.3.3-
|
|
334
|
+
row.send(:_date, cell)
|
|
335
|
+
end
|
|
326
336
|
else
|
|
327
337
|
row.date(idx)
|
|
328
338
|
end
|
|
@@ -21,7 +21,7 @@ class Roo::Excel2003XML < Roo::Base
|
|
|
21
21
|
end
|
|
22
22
|
@doc = ::Roo::Utils.load_xml(@filename)
|
|
23
23
|
end
|
|
24
|
-
namespace = @doc.namespaces.select{|
|
|
24
|
+
namespace = @doc.namespaces.select { |_, urn| urn == 'urn:schemas-microsoft-com:office:spreadsheet' }.keys.last
|
|
25
25
|
@namespace = (namespace.nil? || namespace.empty?) ? 'ss' : namespace.split(':').last
|
|
26
26
|
super(filename, options)
|
|
27
27
|
@formula = {}
|
|
@@ -58,7 +58,7 @@ class Roo::Excel2003XML < Roo::Base
|
|
|
58
58
|
alias_method :formula?, :formula
|
|
59
59
|
|
|
60
60
|
class Font
|
|
61
|
-
attr_accessor :bold, :italic, :underline
|
|
61
|
+
attr_accessor :bold, :italic, :underline, :color, :name, :size
|
|
62
62
|
|
|
63
63
|
def bold?
|
|
64
64
|
@bold == '1'
|
|
@@ -191,31 +191,49 @@ class Roo::Excel2003XML < Roo::Base
|
|
|
191
191
|
validate_sheet!(sheet)
|
|
192
192
|
return if @cells_read[sheet]
|
|
193
193
|
sheet_found = false
|
|
194
|
+
|
|
194
195
|
@doc.xpath("/#{@namespace}:Workbook/#{@namespace}:Worksheet[@#{@namespace}:Name='#{sheet}']").each do |ws|
|
|
195
196
|
sheet_found = true
|
|
196
|
-
|
|
197
|
+
column_styles = {}
|
|
198
|
+
|
|
199
|
+
# Column Styles
|
|
197
200
|
col = 1
|
|
198
|
-
column_attributes = {}
|
|
199
|
-
idx = 0
|
|
200
201
|
ws.xpath("./#{@namespace}:Table/#{@namespace}:Column").each do |c|
|
|
201
|
-
|
|
202
|
+
skip_to_col = c["#{@namespace}:Index"].to_i
|
|
203
|
+
col = skip_to_col if skip_to_col > 0
|
|
204
|
+
col_style_name = c["#{@namespace}:StyleID"]
|
|
205
|
+
column_styles[col] = col_style_name unless col_style_name.nil?
|
|
206
|
+
col += 1
|
|
202
207
|
end
|
|
208
|
+
|
|
209
|
+
# Rows
|
|
210
|
+
row = 1
|
|
203
211
|
ws.xpath("./#{@namespace}:Table/#{@namespace}:Row").each do |r|
|
|
204
|
-
skip_to_row = r[
|
|
212
|
+
skip_to_row = r["#{@namespace}:Index"].to_i
|
|
205
213
|
row = skip_to_row if skip_to_row > 0
|
|
206
|
-
|
|
214
|
+
|
|
215
|
+
# Excel uses a 'Span' attribute on a 'Row' to indicate the presence of
|
|
216
|
+
# empty rows to skip.
|
|
217
|
+
skip_next_rows = r["#{@namespace}:Span"].to_i
|
|
218
|
+
|
|
219
|
+
row_style_name = r["#{@namespace}:StyleID"]
|
|
220
|
+
|
|
221
|
+
# Cells
|
|
222
|
+
col = 1
|
|
207
223
|
r.xpath("./#{@namespace}:Cell").each do |c|
|
|
208
|
-
skip_to_col = c[
|
|
224
|
+
skip_to_col = c["#{@namespace}:Index"].to_i
|
|
209
225
|
col = skip_to_col if skip_to_col > 0
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
226
|
+
|
|
227
|
+
skip_next_cols = c["#{@namespace}:MergeAcross"].to_i
|
|
228
|
+
|
|
229
|
+
cell_style_name = c["#{@namespace}:StyleID"]
|
|
230
|
+
style_name = cell_style_name || row_style_name || column_styles[col]
|
|
231
|
+
|
|
232
|
+
# Cell Data
|
|
215
233
|
c.xpath("./#{@namespace}:Data").each do |cell|
|
|
216
234
|
formula = cell['Formula']
|
|
217
235
|
value_type = cell["#{@namespace}:Type"].downcase.to_sym
|
|
218
|
-
v =
|
|
236
|
+
v = cell.content
|
|
219
237
|
str_v = v
|
|
220
238
|
case value_type
|
|
221
239
|
when :number
|
|
@@ -234,10 +252,9 @@ class Roo::Excel2003XML < Roo::Base
|
|
|
234
252
|
end
|
|
235
253
|
set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)
|
|
236
254
|
end
|
|
237
|
-
col += 1
|
|
255
|
+
col += (skip_next_cols + 1)
|
|
238
256
|
end
|
|
239
|
-
row += 1
|
|
240
|
-
col = 1
|
|
257
|
+
row += (skip_next_rows + 1)
|
|
241
258
|
end
|
|
242
259
|
end
|
|
243
260
|
unless sheet_found
|
|
@@ -248,12 +265,16 @@ class Roo::Excel2003XML < Roo::Base
|
|
|
248
265
|
|
|
249
266
|
def read_styles
|
|
250
267
|
@doc.xpath("/#{@namespace}:Workbook/#{@namespace}:Styles/#{@namespace}:Style").each do |style|
|
|
251
|
-
style_id = style[
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
@style_definitions[style_id]
|
|
255
|
-
@style_definitions[style_id].
|
|
256
|
-
@style_definitions[style_id].
|
|
268
|
+
style_id = style["#{@namespace}:ID"]
|
|
269
|
+
font = style.at_xpath("./#{@namespace}:Font")
|
|
270
|
+
unless font.nil?
|
|
271
|
+
@style_definitions[style_id] = Roo::Excel2003XML::Font.new
|
|
272
|
+
@style_definitions[style_id].bold = font["#{@namespace}:Bold"]
|
|
273
|
+
@style_definitions[style_id].italic = font["#{@namespace}:Italic"]
|
|
274
|
+
@style_definitions[style_id].underline = font["#{@namespace}:Underline"]
|
|
275
|
+
@style_definitions[style_id].color = font["#{@namespace}:Color"]
|
|
276
|
+
@style_definitions[style_id].name = font["#{@namespace}:FontName"]
|
|
277
|
+
@style_definitions[style_id].size = font["#{@namespace}:Size"]
|
|
257
278
|
end
|
|
258
279
|
end
|
|
259
280
|
end
|
data/lib/roo/xls/version.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
+
"packages": {
|
|
4
|
+
".": {
|
|
5
|
+
"version-file": "lib/roo/xls/version.rb",
|
|
6
|
+
"release-type": "ruby",
|
|
7
|
+
"changelog-path": "CHANGELOG.md",
|
|
8
|
+
"include-component-in-tag": false,
|
|
9
|
+
"include-v-in-tag": true
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
data/roo-xls.gemspec
CHANGED
|
@@ -10,23 +10,25 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.email = ["ruby.ruby.ruby.roo@gmail.com"]
|
|
11
11
|
spec.summary = "Roo::Excel can access the contents of classic xls files."
|
|
12
12
|
spec.description = "Roo can access the contents of various spreadsheet files. It can handle\n* OpenOffice\n* Excel\n* Google spreadsheets\n* Excelx\n* LibreOffice\n* CSV"
|
|
13
|
-
spec.homepage = ""
|
|
13
|
+
spec.homepage = "https://github.com/roo-rb/roo-xls"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
+
spec.metadata["changelog_uri"] = spec.homepage + '/blob/master/CHANGELOG.md'
|
|
15
16
|
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0")
|
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
20
|
spec.require_paths = ["lib"]
|
|
20
21
|
|
|
21
|
-
spec.
|
|
22
|
-
spec.add_dependency "spreadsheet", "> 0.9.0"
|
|
22
|
+
spec.required_ruby_version = ">= 3.1.0"
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
spec.add_dependency "roo", ">= 2.0.0", "< 4"
|
|
25
|
+
spec.add_dependency "spreadsheet", ">= 1.3.4", "< 2"
|
|
26
|
+
spec.add_dependency "csv"
|
|
27
|
+
|
|
28
|
+
spec.add_dependency "nokogiri"
|
|
29
29
|
|
|
30
30
|
spec.add_development_dependency "bundler", ">= 1.7"
|
|
31
31
|
spec.add_development_dependency "rake", ">= 10.0"
|
|
32
|
+
spec.add_development_dependency "minitest", ">= 5.19.0"
|
|
33
|
+
spec.add_development_dependency "matrix"
|
|
32
34
|
end
|
|
@@ -1,14 +1,204 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Roo::Excel2003XML do
|
|
3
|
+
RSpec.describe Roo::Excel2003XML do
|
|
4
|
+
subject { instance }
|
|
5
|
+
|
|
6
|
+
let(:instance) { described_class.new(path) }
|
|
7
|
+
let(:path) { File.join(test_files_dir, test_file) }
|
|
8
|
+
let(:test_files_dir) { 'test/files' }
|
|
9
|
+
|
|
4
10
|
describe '.new' do
|
|
5
11
|
context 'with an xml file' do
|
|
6
|
-
let(:
|
|
12
|
+
let(:test_file) { 'datetime.xml' }
|
|
13
|
+
|
|
14
|
+
it 'loads the file without error' do
|
|
15
|
+
expect { subject }.to_not raise_error
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#cell' do
|
|
21
|
+
subject { super().cell(cell[:row], cell[:col]) }
|
|
22
|
+
|
|
23
|
+
before(:each) { instance.default_sheet = instance.sheets.first }
|
|
24
|
+
|
|
25
|
+
context 'with merged cells' do
|
|
26
|
+
# See font_colors_screenshot_in_Mac_Excel_16.10.png for a screenshot of
|
|
27
|
+
# this how this file looks in Mac Excel 16.10.
|
|
28
|
+
let(:test_file) { 'font_colors.xml' }
|
|
29
|
+
|
|
30
|
+
context 'the top-left cell in a merged cell' do
|
|
31
|
+
let(:cell) { { :row => 1, :col => 'A' } }
|
|
32
|
+
|
|
33
|
+
it 'returns the contents of the merged cell' do
|
|
34
|
+
is_expected.to eq 'Roo::Xls Test of Font Colors'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context 'the cell to the right of the top-left cell in a merged cell' do
|
|
39
|
+
let(:cell) { { :row => 2, :col => 'A' } }
|
|
40
|
+
it { is_expected.to be_nil }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context 'the cell below the top-left cell in a merged cell' do
|
|
44
|
+
let(:cell) { { :row => 2, :col => 'B' } }
|
|
45
|
+
it { is_expected.to be_nil }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context 'the first cell to the right of an entire merged cell' do
|
|
49
|
+
let(:cell) { { :row => 1, :col => 'K' } }
|
|
50
|
+
|
|
51
|
+
it 'returns the expected contents' do
|
|
52
|
+
is_expected.to eq 'This entire COLUMN should be ITALIC and GREEN'
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context 'the first cell below an entire merged cell' do
|
|
57
|
+
let(:cell) { { :row => 6, :col => 'A' } }
|
|
58
|
+
|
|
59
|
+
it 'returns the expected contents' do
|
|
60
|
+
is_expected.to eq '(The above should be font "Courier New", size 24)'
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe '#font' do
|
|
67
|
+
subject { super().font(cell[:row], cell[:col]) }
|
|
68
|
+
|
|
69
|
+
before(:each) { instance.default_sheet = instance.sheets.first }
|
|
70
|
+
|
|
71
|
+
# See font_colors_screenshot_in_Mac_Excel_16.10.png for a screenshot of
|
|
72
|
+
# this how this file looks in Mac Excel 16.10.
|
|
73
|
+
let(:test_file) { 'font_colors.xml' }
|
|
74
|
+
|
|
75
|
+
let(:default_attrs) do
|
|
76
|
+
{
|
|
77
|
+
:name => 'Arial',
|
|
78
|
+
:size => '12',
|
|
79
|
+
:color => '#000000',
|
|
80
|
+
:bold? => false,
|
|
81
|
+
:italic? => false,
|
|
82
|
+
:underline? => false
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
let(:expected_attrs) { default_attrs }
|
|
87
|
+
|
|
88
|
+
context 'with no font styling' do
|
|
89
|
+
let(:cell) { { :row => 6, :col => 'A' } }
|
|
90
|
+
|
|
91
|
+
it 'returns default font attributes' do
|
|
92
|
+
is_expected.to have_attributes(default_attrs)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
context 'with styling set on an individual cell' do
|
|
97
|
+
context 'when set font name and size' do
|
|
98
|
+
let(:cell) { { :row => 1, :col => 'A' } }
|
|
99
|
+
|
|
100
|
+
it 'returns expected font attributes including name and size' do
|
|
101
|
+
expects = default_attrs.merge({ :name => 'Courier New', :size => '24' })
|
|
102
|
+
is_expected.to have_attributes(expects)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context 'when colored BLACK' do
|
|
107
|
+
let(:cell) { { :row => 7, :col => 'A' } }
|
|
108
|
+
|
|
109
|
+
it 'returns default font attributes (which include black)' do
|
|
110
|
+
is_expected.to have_attributes(default_attrs)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
context 'when colored RED' do
|
|
115
|
+
let(:cell) { { :row => 8, :col => 'A' } }
|
|
116
|
+
|
|
117
|
+
it 'returns defaults plus red color' do
|
|
118
|
+
expects = default_attrs.merge({ :color => '#FF0000' })
|
|
119
|
+
is_expected.to have_attributes(expects)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
context 'when colored BLUE' do
|
|
124
|
+
let(:cell) { { :row => 9, :col => 'A' } }
|
|
125
|
+
|
|
126
|
+
it 'returns defaults plus blue color' do
|
|
127
|
+
expects = default_attrs.merge({ :color => '#0066CC' })
|
|
128
|
+
is_expected.to have_attributes(expects)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
context 'when BOLD' do
|
|
133
|
+
let(:cell) { { :row => 10, :col => 'A' } }
|
|
134
|
+
|
|
135
|
+
it 'returns defaults plus bold style' do
|
|
136
|
+
# somehow in Excel, this ended up "no color" rather than black...
|
|
137
|
+
expects = default_attrs.merge({ :bold? => true, :color => nil })
|
|
138
|
+
is_expected.to have_attributes(expects)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
context 'when ITALIC' do
|
|
143
|
+
let(:cell) { { :row => 11, :col => 'A' } }
|
|
144
|
+
|
|
145
|
+
it 'returns defaults plus italic style' do
|
|
146
|
+
# somehow in Excel, this ended up "no color" rather than black...
|
|
147
|
+
expects = default_attrs.merge({ :italic? => true, :color => nil })
|
|
148
|
+
is_expected.to have_attributes(expects)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
context 'when UNDERLINED' do
|
|
153
|
+
let(:cell) { { :row => 12, :col => 'A' } }
|
|
154
|
+
|
|
155
|
+
it 'returns defaults plus underlined style' do
|
|
156
|
+
# somehow in Excel, this ended up "no color" rather than black...
|
|
157
|
+
expects = default_attrs.merge({ :underline? => true, :color => nil })
|
|
158
|
+
is_expected.to have_attributes(expects)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
context 'when BOLD, ITALIC, UNDERLINED, and colored PURPLE' do
|
|
163
|
+
let(:cell) { { :row => 13, :col => 'A' } }
|
|
164
|
+
|
|
165
|
+
it 'returns defaults plus bold, italic, underlined, and purple color' do
|
|
166
|
+
expects = default_attrs.merge({
|
|
167
|
+
:color => '#666699',
|
|
168
|
+
:bold? => true,
|
|
169
|
+
:italic? => true,
|
|
170
|
+
:underline? => true
|
|
171
|
+
})
|
|
172
|
+
is_expected.to have_attributes(expects)
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
context 'with styling set on an entire row' do
|
|
178
|
+
let(:row_style) do
|
|
179
|
+
default_attrs.merge({ :color => '#ED7D31', :bold? => true })
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context 'when no cell styling' do
|
|
183
|
+
let(:cell) { { :row => 14, :col => 'L' } }
|
|
184
|
+
|
|
185
|
+
it 'returns the row style' do
|
|
186
|
+
is_expected.to have_attributes(row_style)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
context 'with styling set on an entire column' do
|
|
192
|
+
let(:col_style) do
|
|
193
|
+
default_attrs.merge({ :color => '#00FF00', :italic? => true })
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
context 'when no cell styling' do
|
|
197
|
+
let(:cell) { { :row => 20, :col => 'K' } }
|
|
7
198
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}.to_not raise_error
|
|
199
|
+
it 'returns the column style' do
|
|
200
|
+
is_expected.to have_attributes(col_style)
|
|
201
|
+
end
|
|
12
202
|
end
|
|
13
203
|
end
|
|
14
204
|
end
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<?mso-application progid="Excel.Sheet"?>
|
|
3
|
+
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
4
|
+
xmlns:o="urn:schemas-microsoft-com:office:office"
|
|
5
|
+
xmlns:x="urn:schemas-microsoft-com:office:excel"
|
|
6
|
+
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
|
7
|
+
xmlns:html="http://www.w3.org/TR/REC-html40">
|
|
8
|
+
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
|
|
9
|
+
<Author>Marc Siegel</Author>
|
|
10
|
+
<LastAuthor>Marc Siegel</LastAuthor>
|
|
11
|
+
<Created>2018-02-14T22:21:05Z</Created>
|
|
12
|
+
<LastSaved>2018-02-15T17:12:56Z</LastSaved>
|
|
13
|
+
<Version>16.00</Version>
|
|
14
|
+
</DocumentProperties>
|
|
15
|
+
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
|
|
16
|
+
<AllowPNG/>
|
|
17
|
+
</OfficeDocumentSettings>
|
|
18
|
+
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
|
|
19
|
+
<WindowHeight>16940</WindowHeight>
|
|
20
|
+
<WindowWidth>27640</WindowWidth>
|
|
21
|
+
<WindowTopX>3380</WindowTopX>
|
|
22
|
+
<WindowTopY>5080</WindowTopY>
|
|
23
|
+
<ProtectStructure>False</ProtectStructure>
|
|
24
|
+
<ProtectWindows>False</ProtectWindows>
|
|
25
|
+
</ExcelWorkbook>
|
|
26
|
+
<Styles>
|
|
27
|
+
<Style ss:ID="Default" ss:Name="Normal">
|
|
28
|
+
<Alignment ss:Vertical="Bottom"/>
|
|
29
|
+
<Borders/>
|
|
30
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>
|
|
31
|
+
<Interior/>
|
|
32
|
+
<NumberFormat/>
|
|
33
|
+
<Protection/>
|
|
34
|
+
</Style>
|
|
35
|
+
<Style ss:ID="s62">
|
|
36
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>
|
|
37
|
+
</Style>
|
|
38
|
+
<Style ss:ID="s63">
|
|
39
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#00FF00"
|
|
40
|
+
ss:Italic="1"/>
|
|
41
|
+
</Style>
|
|
42
|
+
<Style ss:ID="s65">
|
|
43
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
|
|
44
|
+
<Font ss:FontName="Courier New" x:Family="Roman" ss:Size="24" ss:Color="#000000"/>
|
|
45
|
+
</Style>
|
|
46
|
+
<Style ss:ID="s67">
|
|
47
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
|
|
48
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#00FF00"
|
|
49
|
+
ss:Italic="1"/>
|
|
50
|
+
</Style>
|
|
51
|
+
<Style ss:ID="s69">
|
|
52
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
53
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>
|
|
54
|
+
</Style>
|
|
55
|
+
<Style ss:ID="s71">
|
|
56
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
57
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#FF0000"/>
|
|
58
|
+
</Style>
|
|
59
|
+
<Style ss:ID="s73">
|
|
60
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
|
|
61
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#FF0000"
|
|
62
|
+
ss:Underline="Single"/>
|
|
63
|
+
</Style>
|
|
64
|
+
<Style ss:ID="s75">
|
|
65
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
66
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#0066CC"/>
|
|
67
|
+
</Style>
|
|
68
|
+
<Style ss:ID="s77">
|
|
69
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
70
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Bold="1"/>
|
|
71
|
+
</Style>
|
|
72
|
+
<Style ss:ID="s79">
|
|
73
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
74
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Italic="1"/>
|
|
75
|
+
</Style>
|
|
76
|
+
<Style ss:ID="s81">
|
|
77
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
78
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Underline="Single"/>
|
|
79
|
+
</Style>
|
|
80
|
+
<Style ss:ID="s83">
|
|
81
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
82
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#666699"
|
|
83
|
+
ss:Bold="1" ss:Italic="1" ss:Underline="Single"/>
|
|
84
|
+
</Style>
|
|
85
|
+
<Style ss:ID="s90">
|
|
86
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
|
|
87
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#00FF00"
|
|
88
|
+
ss:Bold="1" ss:Italic="1"/>
|
|
89
|
+
</Style>
|
|
90
|
+
<Style ss:ID="s91">
|
|
91
|
+
<Alignment ss:Vertical="Center" ss:WrapText="1"/>
|
|
92
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#008080"
|
|
93
|
+
ss:Bold="1" ss:Italic="1"/>
|
|
94
|
+
</Style>
|
|
95
|
+
<Style ss:ID="s97">
|
|
96
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
97
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#ED7D31"
|
|
98
|
+
ss:Bold="1"/>
|
|
99
|
+
</Style>
|
|
100
|
+
<Style ss:ID="s100">
|
|
101
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#ED7D31"
|
|
102
|
+
ss:Bold="1"/>
|
|
103
|
+
</Style>
|
|
104
|
+
<Style ss:ID="s110">
|
|
105
|
+
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
|
|
106
|
+
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Color="#FF0000"
|
|
107
|
+
ss:Underline="Single"/>
|
|
108
|
+
</Style>
|
|
109
|
+
</Styles>
|
|
110
|
+
<Worksheet ss:Name="Sheet1">
|
|
111
|
+
<Table ss:ExpandedColumnCount="13" ss:ExpandedRowCount="20" x:FullColumns="1"
|
|
112
|
+
x:FullRows="1" ss:StyleID="s62" ss:DefaultColumnWidth="65"
|
|
113
|
+
ss:DefaultRowHeight="16">
|
|
114
|
+
<Column ss:Index="10" ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="96"/>
|
|
115
|
+
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="173"/>
|
|
116
|
+
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="141"/>
|
|
117
|
+
<Row ss:AutoFitHeight="0">
|
|
118
|
+
<Cell ss:MergeAcross="9" ss:MergeDown="4" ss:StyleID="s65"><Data
|
|
119
|
+
ss:Type="String">Roo::Xls Test of Font Colors</Data></Cell>
|
|
120
|
+
<Cell ss:MergeDown="6" ss:StyleID="s67"><Data ss:Type="String">This entire COLUMN should be ITALIC and GREEN</Data></Cell>
|
|
121
|
+
</Row>
|
|
122
|
+
<Row ss:AutoFitHeight="0" ss:Span="3"/>
|
|
123
|
+
<Row ss:Index="6" ss:AutoFitHeight="0">
|
|
124
|
+
<Cell><Data ss:Type="String">(The above should be font "Courier New", size 24)</Data></Cell>
|
|
125
|
+
</Row>
|
|
126
|
+
<Row ss:AutoFitHeight="0">
|
|
127
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s69"><Data ss:Type="String">This font should be BLACK</Data></Cell>
|
|
128
|
+
</Row>
|
|
129
|
+
<Row ss:AutoFitHeight="0">
|
|
130
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s71"><Data ss:Type="String">This font should be RED</Data></Cell>
|
|
131
|
+
<Cell ss:MergeDown="5" ss:StyleID="s73"><Data ss:Type="String">…except this cell, which should be UNDERLINED and RED</Data></Cell>
|
|
132
|
+
</Row>
|
|
133
|
+
<Row ss:AutoFitHeight="0">
|
|
134
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s75"><Data ss:Type="String">This font should be BLUE</Data></Cell>
|
|
135
|
+
</Row>
|
|
136
|
+
<Row ss:AutoFitHeight="0">
|
|
137
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s77"><Data ss:Type="String">This font should be BOLD</Data></Cell>
|
|
138
|
+
</Row>
|
|
139
|
+
<Row ss:AutoFitHeight="0">
|
|
140
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s79"><Data ss:Type="String">This font should be ITALIC</Data></Cell>
|
|
141
|
+
</Row>
|
|
142
|
+
<Row ss:AutoFitHeight="0">
|
|
143
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s81"><Data ss:Type="String">This font should be UNDERLINED</Data></Cell>
|
|
144
|
+
</Row>
|
|
145
|
+
<Row ss:AutoFitHeight="0">
|
|
146
|
+
<Cell ss:MergeAcross="9" ss:StyleID="s83"><Data ss:Type="String">This font should be BOLD, ITALIC, UNDERLINED, and PURPLE</Data></Cell>
|
|
147
|
+
</Row>
|
|
148
|
+
<Row ss:AutoFitHeight="0" ss:StyleID="s100">
|
|
149
|
+
<Cell ss:MergeAcross="4" ss:StyleID="s97"><Data ss:Type="String">This entire ROW should be BOLD and ORANGE</Data></Cell>
|
|
150
|
+
<Cell ss:MergeAcross="4" ss:StyleID="s110"><Data ss:Type="String">…except this cell, which should be UNDERLINED and RED</Data></Cell>
|
|
151
|
+
<Cell ss:MergeDown="5" ss:StyleID="s90"><Data ss:Type="String">As the combination of ROW and COLUMN styles, this cell should be BOLD, ITALIC, and GREEN</Data></Cell>
|
|
152
|
+
<Cell><Data ss:Type="String">Just row style</Data></Cell>
|
|
153
|
+
</Row>
|
|
154
|
+
<Row ss:AutoFitHeight="0">
|
|
155
|
+
<Cell ss:Index="12" ss:StyleID="s91"/>
|
|
156
|
+
<Cell ss:StyleID="s91"/>
|
|
157
|
+
</Row>
|
|
158
|
+
<Row ss:AutoFitHeight="0">
|
|
159
|
+
<Cell ss:Index="12" ss:StyleID="s91"/>
|
|
160
|
+
<Cell ss:StyleID="s91"/>
|
|
161
|
+
</Row>
|
|
162
|
+
<Row ss:AutoFitHeight="0">
|
|
163
|
+
<Cell ss:Index="12" ss:StyleID="s91"/>
|
|
164
|
+
<Cell ss:StyleID="s91"/>
|
|
165
|
+
</Row>
|
|
166
|
+
<Row ss:AutoFitHeight="0">
|
|
167
|
+
<Cell ss:Index="12" ss:StyleID="s91"/>
|
|
168
|
+
<Cell ss:StyleID="s91"/>
|
|
169
|
+
</Row>
|
|
170
|
+
<Row ss:AutoFitHeight="0">
|
|
171
|
+
<Cell ss:Index="12" ss:StyleID="s91"/>
|
|
172
|
+
<Cell ss:StyleID="s91"/>
|
|
173
|
+
</Row>
|
|
174
|
+
<Row ss:AutoFitHeight="0">
|
|
175
|
+
<Cell ss:Index="11"><Data ss:Type="String">Just column style</Data></Cell>
|
|
176
|
+
<Cell ss:StyleID="s91"/>
|
|
177
|
+
<Cell ss:StyleID="s91"/>
|
|
178
|
+
</Row>
|
|
179
|
+
</Table>
|
|
180
|
+
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
|
|
181
|
+
<PageSetup>
|
|
182
|
+
<Header x:Margin="0.3"/>
|
|
183
|
+
<Footer x:Margin="0.3"/>
|
|
184
|
+
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
|
|
185
|
+
</PageSetup>
|
|
186
|
+
<Unsynced/>
|
|
187
|
+
<Print>
|
|
188
|
+
<ValidPrinterInfo/>
|
|
189
|
+
<VerticalResolution>0</VerticalResolution>
|
|
190
|
+
</Print>
|
|
191
|
+
<Selected/>
|
|
192
|
+
<Panes>
|
|
193
|
+
<Pane>
|
|
194
|
+
<Number>3</Number>
|
|
195
|
+
<ActiveRow>25</ActiveRow>
|
|
196
|
+
<ActiveCol>7</ActiveCol>
|
|
197
|
+
</Pane>
|
|
198
|
+
</Panes>
|
|
199
|
+
<ProtectObjects>False</ProtectObjects>
|
|
200
|
+
<ProtectScenarios>False</ProtectScenarios>
|
|
201
|
+
</WorksheetOptions>
|
|
202
|
+
</Worksheet>
|
|
203
|
+
</Workbook>
|
|
Binary file
|
data/test/test_excel_2003_xml.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class TestExcel2013XML < Minitest::Test
|
|
4
4
|
def with_xml_spreadsheet(name)
|
|
5
5
|
yield ::Roo::Excel2003XML.new(File.join(TESTDIR, "#{name}.xml"))
|
|
6
6
|
end
|
|
@@ -25,15 +25,15 @@ class TestRooExcel < MiniTest::Test
|
|
|
25
25
|
# This test just checks for that exception to make sure it's not raised in this case
|
|
26
26
|
def test_date_to_float_conversion
|
|
27
27
|
with_xml_spreadsheet('datetime_floatconv') do |oo|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end
|
|
28
|
+
oo.default_sheet = oo.sheets.first
|
|
29
|
+
assert oo.cell('a', 1)
|
|
30
|
+
assert oo.cell('a', 2)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
def test_ruby_spreadsheet_formula_bug
|
|
36
35
|
with_xml_spreadsheet('formula_parse_error') do |oo|
|
|
36
|
+
oo.default_sheet = oo.sheets.first
|
|
37
37
|
assert_equal '5026', oo.cell(2, 3)
|
|
38
38
|
assert_equal '5026', oo.cell(3, 3)
|
|
39
39
|
end
|
data/test/test_roo_excel.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
require 'test_helper'
|
|
3
3
|
require 'stringio'
|
|
4
4
|
|
|
5
|
-
class TestRooExcel <
|
|
5
|
+
class TestRooExcel < Minitest::Test
|
|
6
6
|
def with_spreadsheet(name)
|
|
7
7
|
yield ::Roo::Spreadsheet.open(File.join(TESTDIR, "#{name}.xls"))
|
|
8
8
|
end
|
|
@@ -628,14 +628,14 @@ Sheet 3:
|
|
|
628
628
|
def test_bug_to_xml_with_empty_sheets
|
|
629
629
|
with_spreadsheet('emptysheets') do |oo|
|
|
630
630
|
oo.sheets.each do |sheet|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
631
|
+
assert_nil oo.first_row, "first_row not nil in sheet #{sheet}"
|
|
632
|
+
assert_nil oo.last_row, "last_row not nil in sheet #{sheet}"
|
|
633
|
+
assert_nil oo.first_column, "first_column not nil in sheet #{sheet}"
|
|
634
|
+
assert_nil oo.last_column, "last_column not nil in sheet #{sheet}"
|
|
635
|
+
assert_nil oo.first_row(sheet), "first_row not nil in sheet #{sheet}"
|
|
636
|
+
assert_nil oo.last_row(sheet), "last_row not nil in sheet #{sheet}"
|
|
637
|
+
assert_nil oo.first_column(sheet), "first_column not nil in sheet #{sheet}"
|
|
638
|
+
assert_nil oo.last_column(sheet), "last_column not nil in sheet #{sheet}"
|
|
639
639
|
end
|
|
640
640
|
oo.to_xml
|
|
641
641
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roo-xls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Preymesser
|
|
8
8
|
- Hugh McGowan
|
|
9
9
|
- Ben Woosley
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: roo
|
|
@@ -18,34 +17,54 @@ dependencies:
|
|
|
18
17
|
requirements:
|
|
19
18
|
- - ">="
|
|
20
19
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 2.0.
|
|
20
|
+
version: 2.0.0
|
|
22
21
|
- - "<"
|
|
23
22
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: '
|
|
23
|
+
version: '4'
|
|
25
24
|
type: :runtime
|
|
26
25
|
prerelease: false
|
|
27
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
27
|
requirements:
|
|
29
28
|
- - ">="
|
|
30
29
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: 2.0.
|
|
30
|
+
version: 2.0.0
|
|
32
31
|
- - "<"
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
33
|
+
version: '4'
|
|
35
34
|
- !ruby/object:Gem::Dependency
|
|
36
35
|
name: spreadsheet
|
|
37
36
|
requirement: !ruby/object:Gem::Requirement
|
|
38
37
|
requirements:
|
|
39
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.3.4
|
|
41
|
+
- - "<"
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '2'
|
|
44
|
+
type: :runtime
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 1.3.4
|
|
51
|
+
- - "<"
|
|
40
52
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
53
|
+
version: '2'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: csv
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
42
61
|
type: :runtime
|
|
43
62
|
prerelease: false
|
|
44
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
45
64
|
requirements:
|
|
46
|
-
- - "
|
|
65
|
+
- - ">="
|
|
47
66
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: 0
|
|
67
|
+
version: '0'
|
|
49
68
|
- !ruby/object:Gem::Dependency
|
|
50
69
|
name: nokogiri
|
|
51
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -88,6 +107,34 @@ dependencies:
|
|
|
88
107
|
- - ">="
|
|
89
108
|
- !ruby/object:Gem::Version
|
|
90
109
|
version: '10.0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: minitest
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: 5.19.0
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 5.19.0
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: matrix
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
91
138
|
description: |-
|
|
92
139
|
Roo can access the contents of various spreadsheet files. It can handle
|
|
93
140
|
* OpenOffice
|
|
@@ -102,10 +149,15 @@ executables: []
|
|
|
102
149
|
extensions: []
|
|
103
150
|
extra_rdoc_files: []
|
|
104
151
|
files:
|
|
152
|
+
- ".github/issue_template.md"
|
|
153
|
+
- ".github/pull_request_template.md"
|
|
154
|
+
- ".github/workflows/release-please.yml"
|
|
155
|
+
- ".github/workflows/ruby.yml"
|
|
105
156
|
- ".gitignore"
|
|
157
|
+
- ".release-please-manifest.json"
|
|
106
158
|
- ".rubocop.yml"
|
|
107
159
|
- ".simplecov"
|
|
108
|
-
-
|
|
160
|
+
- CHANGELOG.md
|
|
109
161
|
- Gemfile
|
|
110
162
|
- LICENSE.txt
|
|
111
163
|
- README.md
|
|
@@ -116,6 +168,7 @@ files:
|
|
|
116
168
|
- lib/roo/xls/excel_2003_xml.rb
|
|
117
169
|
- lib/roo/xls/spreadsheet_extensions.rb
|
|
118
170
|
- lib/roo/xls/version.rb
|
|
171
|
+
- release-please-config.json
|
|
119
172
|
- roo-xls.gemspec
|
|
120
173
|
- spec/lib/roo/xls/excel2003xml_spec.rb
|
|
121
174
|
- spec/lib/roo/xls/excel_spec.rb
|
|
@@ -147,6 +200,8 @@ files:
|
|
|
147
200
|
- test/files/excel2003_namespace.xml
|
|
148
201
|
- test/files/false_encoding.xls
|
|
149
202
|
- test/files/false_encoding.xml
|
|
203
|
+
- test/files/font_colors.xml
|
|
204
|
+
- test/files/font_colors_screenshot_in_Mac_Excel_16.10.png
|
|
150
205
|
- test/files/formula.xls
|
|
151
206
|
- test/files/formula.xml
|
|
152
207
|
- test/files/formula_parse_error.xls
|
|
@@ -184,11 +239,11 @@ files:
|
|
|
184
239
|
- test/test_excel_2003_xml.rb
|
|
185
240
|
- test/test_helper.rb
|
|
186
241
|
- test/test_roo_excel.rb
|
|
187
|
-
homepage:
|
|
242
|
+
homepage: https://github.com/roo-rb/roo-xls
|
|
188
243
|
licenses:
|
|
189
244
|
- MIT
|
|
190
|
-
metadata:
|
|
191
|
-
|
|
245
|
+
metadata:
|
|
246
|
+
changelog_uri: https://github.com/roo-rb/roo-xls/blob/master/CHANGELOG.md
|
|
192
247
|
rdoc_options: []
|
|
193
248
|
require_paths:
|
|
194
249
|
- lib
|
|
@@ -196,16 +251,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
196
251
|
requirements:
|
|
197
252
|
- - ">="
|
|
198
253
|
- !ruby/object:Gem::Version
|
|
199
|
-
version:
|
|
254
|
+
version: 3.1.0
|
|
200
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
256
|
requirements:
|
|
202
257
|
- - ">="
|
|
203
258
|
- !ruby/object:Gem::Version
|
|
204
259
|
version: '0'
|
|
205
260
|
requirements: []
|
|
206
|
-
|
|
207
|
-
rubygems_version: 2.5.1
|
|
208
|
-
signing_key:
|
|
261
|
+
rubygems_version: 3.6.9
|
|
209
262
|
specification_version: 4
|
|
210
263
|
summary: Roo::Excel can access the contents of classic xls files.
|
|
211
264
|
test_files:
|
|
@@ -239,6 +292,8 @@ test_files:
|
|
|
239
292
|
- test/files/excel2003_namespace.xml
|
|
240
293
|
- test/files/false_encoding.xls
|
|
241
294
|
- test/files/false_encoding.xml
|
|
295
|
+
- test/files/font_colors.xml
|
|
296
|
+
- test/files/font_colors_screenshot_in_Mac_Excel_16.10.png
|
|
242
297
|
- test/files/formula.xls
|
|
243
298
|
- test/files/formula.xml
|
|
244
299
|
- test/files/formula_parse_error.xls
|
data/.travis.yml
DELETED