spreadsheet 0.7.5 → 0.7.6
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/History.txt +12 -0
- data/lib/spreadsheet.rb +1 -1
- data/lib/spreadsheet/excel/reader.rb +9 -11
- data/lib/spreadsheet/excel/writer/workbook.rb +2 -2
- data/lib/spreadsheet/excel/writer/worksheet.rb +1 -2
- data/lib/spreadsheet/font.rb +11 -0
- data/lib/spreadsheet/row.rb +1 -1
- metadata +8 -8
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 0.7.6 / 15.01.2013
|
2
|
+
|
3
|
+
Author: Kenichi Kamiya <kachick1@gmail.com>
|
4
|
+
Date: Tue Jan 15 15:52:58 2013 +0900
|
5
|
+
|
6
|
+
* Remove warnings "method redefined; discarding old default_format"
|
7
|
+
* Remove warnings "`*' interpreted as argument prefix"
|
8
|
+
* Remove warnings "instance variable @{ivar} not initialized"
|
9
|
+
* Remove warnings "assigned but unused variable"
|
10
|
+
|
11
|
+
also see: https://github.com/zdavatz/spreadsheet/pull/21
|
12
|
+
|
1
13
|
=== 0.7.5 / 06.12.2012
|
2
14
|
|
3
15
|
* Add error tolerant values for Iconv when writing spreadsheet
|
data/lib/spreadsheet.rb
CHANGED
@@ -145,7 +145,7 @@ class Reader
|
|
145
145
|
# 6 2 Build year
|
146
146
|
# 8 4 File history flags
|
147
147
|
# 12 4 Lowest Excel version that can read all records in this file
|
148
|
-
|
148
|
+
_, @bof, _, work = get_next_chunk
|
149
149
|
## version and datatype are common to all Excel-Versions. Later versions
|
150
150
|
# have additional information such as build-id and -year (from BIFF5).
|
151
151
|
# These are ignored for the time being.
|
@@ -178,7 +178,7 @@ class Reader
|
|
178
178
|
# 6 var. Sheet name: BIFF5/BIFF7: Byte string,
|
179
179
|
# 8-bit string length (➜ 3.3)
|
180
180
|
# BIFF8: Unicode string, 8-bit string length (➜ 3.4)
|
181
|
-
offset,
|
181
|
+
offset, _, _ = work.unpack("VC2")
|
182
182
|
name = client read_string(work[6..-1]), @workbook.encoding
|
183
183
|
if @boundsheets
|
184
184
|
@boundsheets[0] += 1
|
@@ -442,15 +442,14 @@ class Reader
|
|
442
442
|
# [var.] 2∙tl (optional, see option flags) Character array of the text
|
443
443
|
# mark without “#” sign, no Unicode string header, always
|
444
444
|
# 16-bit characters, zero-terminated
|
445
|
-
firstrow, lastrow, firstcol, lastcol,
|
445
|
+
firstrow, lastrow, firstcol, lastcol, _, opts = work.unpack 'v4H32x4V'
|
446
446
|
has_link = opts & 0x0001
|
447
|
-
absolute = opts & 0x0002
|
448
447
|
desc = opts & 0x0014
|
449
448
|
textmark = opts & 0x0008
|
450
449
|
target = opts & 0x0080
|
451
450
|
unc = opts & 0x0100
|
452
451
|
link = Link.new
|
453
|
-
|
452
|
+
_, description = nil
|
454
453
|
pos = 32
|
455
454
|
if desc > 0
|
456
455
|
description, pos = read_hlink_string work, pos
|
@@ -610,7 +609,7 @@ class Reader
|
|
610
609
|
# 4 2∙nc List of nc=lc-fc+1 16-bit indexes to XF records (➜ 6.115)
|
611
610
|
# 4+2∙nc 2 Index to last column (lc)
|
612
611
|
row, column, *xfs = work.unpack 'v*'
|
613
|
-
|
612
|
+
xfs.pop #=> last_column
|
614
613
|
xfs.each_with_index do |xf, idx| set_cell worksheet, row, column + idx, xf end
|
615
614
|
end
|
616
615
|
def read_mulrk worksheet, addr, work
|
@@ -655,7 +654,7 @@ class Reader
|
|
655
654
|
@pos = addr[:offset]
|
656
655
|
found = false
|
657
656
|
while tuple = get_next_chunk
|
658
|
-
pos, op,
|
657
|
+
pos, op, _, work = tuple
|
659
658
|
case op
|
660
659
|
when :eof # ● EOF ➜ 6.36 - we should only get here if there is just
|
661
660
|
# one Row-Block
|
@@ -771,7 +770,7 @@ class Reader
|
|
771
770
|
# but another self-contained MERGEDCELLS record is started. The limit of 8224 bytes
|
772
771
|
# per record results in a maximum number of 1027 merged ranges.
|
773
772
|
|
774
|
-
worksheet.merged_cells.push
|
773
|
+
worksheet.merged_cells.push(*read_range_address_list(work, len))
|
775
774
|
#
|
776
775
|
# A cell range address list consists of a field with the number of ranges and the list
|
777
776
|
# of the range addresses.
|
@@ -783,7 +782,6 @@ class Reader
|
|
783
782
|
end
|
784
783
|
|
785
784
|
def read_workbook
|
786
|
-
worksheet = nil
|
787
785
|
previous_op = nil
|
788
786
|
while tuple = get_next_chunk
|
789
787
|
pos, op, len, work = tuple
|
@@ -1029,7 +1027,7 @@ class Reader
|
|
1029
1027
|
# 13-7 0x3f80 Colour index (➜ 6.70)
|
1030
1028
|
# for pattern background
|
1031
1029
|
fmt = Format.new
|
1032
|
-
font_idx, numfmt,
|
1030
|
+
font_idx, numfmt, _, xf_align, xf_rotation, xf_indent, _,
|
1033
1031
|
xf_borders, xf_brdcolors, xf_pattern = work.unpack binfmt(:xf)
|
1034
1032
|
fmt.number_format = @formats[numfmt]
|
1035
1033
|
## this appears to be undocumented: the first 4 fonts seem to be accessed
|
@@ -1084,7 +1082,7 @@ class Reader
|
|
1084
1082
|
# Offset Size Contents
|
1085
1083
|
# 0 2 Index of this row
|
1086
1084
|
# 2 2 Index to this column
|
1087
|
-
row_index,
|
1085
|
+
row_index, _ = work.unpack 'v2'
|
1088
1086
|
unless worksheet.offsets[row_index]
|
1089
1087
|
@current_row_block_offset ||= [pos]
|
1090
1088
|
data = {
|
@@ -193,7 +193,7 @@ class Workbook < Spreadsheet::Writer
|
|
193
193
|
reader.seek lastpos = 0
|
194
194
|
workbook.offsets.select do |key, pair|
|
195
195
|
workbook.changes.include? key
|
196
|
-
end.sort_by do |key, (pos,
|
196
|
+
end.sort_by do |key, (pos, _)|
|
197
197
|
pos
|
198
198
|
end.each do |key, (pos, len)|
|
199
199
|
data = reader.read(pos - lastpos)
|
@@ -538,7 +538,7 @@ class Workbook < Spreadsheet::Writer
|
|
538
538
|
## if we're writing wide characters, we need to make sure we don't cut
|
539
539
|
# characters in half
|
540
540
|
if wide > 0 && data.size > @recordsize_limit
|
541
|
-
remove = @recordsize_limit -
|
541
|
+
remove = @recordsize_limit - bef
|
542
542
|
remove -= remove % 2
|
543
543
|
rest = data.slice!(remove..-1)
|
544
544
|
write_op writer, op, data
|
@@ -291,7 +291,7 @@ Please contact the author (hannes dot wyss at gmail dot com) with a sample file
|
|
291
291
|
and minimal code that generates this warning. Thanks!
|
292
292
|
EOS
|
293
293
|
end
|
294
|
-
work = work.sort_by do |key, (pos,
|
294
|
+
work = work.sort_by do |key, (pos, _)|
|
295
295
|
[pos, key.is_a?(Integer) ? key : -1]
|
296
296
|
end
|
297
297
|
work.each do |key, (pos, len)|
|
@@ -598,7 +598,6 @@ and minimal code that generates this warning. Thanks!
|
|
598
598
|
def write_hyperlink_table
|
599
599
|
# TODO: theoretically it's possible to write fewer records by combining
|
600
600
|
# identical neighboring links in cell-ranges
|
601
|
-
links = []
|
602
601
|
@worksheet.each do |row|
|
603
602
|
row.each_with_index do |cell, idx|
|
604
603
|
if cell.is_a? Link
|
data/lib/spreadsheet/font.rb
CHANGED
@@ -64,6 +64,17 @@ module Spreadsheet
|
|
64
64
|
def initialize name, opts={}
|
65
65
|
self.name = name
|
66
66
|
@color = :text
|
67
|
+
@previous_fast_key = nil
|
68
|
+
@size = nil
|
69
|
+
@weight = nil
|
70
|
+
@italic = nil
|
71
|
+
@strikeout = nil
|
72
|
+
@outline = nil
|
73
|
+
@shadow = nil
|
74
|
+
@escapement = nil
|
75
|
+
@underline = nil
|
76
|
+
@family = nil
|
77
|
+
@encoding = nil
|
67
78
|
opts.each do |key, val|
|
68
79
|
self.send "#{key}=", val
|
69
80
|
end
|
data/lib/spreadsheet/row.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-ole
|
16
|
-
requirement: &
|
16
|
+
requirement: &5739340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *5739340
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &5732180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.10'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *5732180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hoe
|
38
|
-
requirement: &
|
38
|
+
requirement: &5726660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.13'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *5726660
|
47
47
|
description: ! 'The Spreadsheet Library is designed to read and write Spreadsheet
|
48
48
|
Documents.
|
49
49
|
|