spreadsheet 0.6.1.1 → 0.6.1.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/History.txt +10 -0
- data/lib/spreadsheet/excel/internals.rb +2 -3
- data/lib/spreadsheet/excel/reader/biff8.rb +13 -4
- data/lib/spreadsheet/excel/reader.rb +1 -1
- data/lib/spreadsheet.rb +1 -1
- data/test/integration.rb +0 -14
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 0.6.1.2 / 2008-10-20
|
2
|
+
|
3
|
+
* 2 Bugfixes
|
4
|
+
|
5
|
+
* Corrected the Font-Encoding values in Excel::Internals
|
6
|
+
(Thanks to Bjorn Hjelle for the Bugreport)
|
7
|
+
* Spreadsheet now skips Richtext-Formatting runs and Asian Phonetic
|
8
|
+
Settings when reading the SST, fixing a problem where the presence of
|
9
|
+
Richtext could lead to an incomplete SST.
|
10
|
+
|
1
11
|
=== 0.6.1.1 / 2008-10-20
|
2
12
|
|
3
13
|
* 1 Bugfix
|
@@ -163,6 +163,7 @@ module Internals
|
|
163
163
|
}
|
164
164
|
SEPYT_TNEMEPACSE = ESCAPEMENT_TYPES.invert
|
165
165
|
FONT_ENCODINGS = {
|
166
|
+
0x00 => :iso_latin1,
|
166
167
|
0x01 => :default,
|
167
168
|
0x02 => :symbol,
|
168
169
|
0x4d => :apple_roman,
|
@@ -179,7 +180,7 @@ module Internals
|
|
179
180
|
0xba => :baltic,
|
180
181
|
0xcc => :cyrillic,
|
181
182
|
0xde => :thai,
|
182
|
-
0xee => :
|
183
|
+
0xee => :iso_latin2,
|
183
184
|
0xff => :oem_latin1,
|
184
185
|
}
|
185
186
|
SGNIDOCNE_TNOF = FONT_ENCODINGS.invert
|
@@ -197,8 +198,6 @@ module Internals
|
|
197
198
|
}
|
198
199
|
LEAP_ERROR = Date.new 1900, 2, 28
|
199
200
|
OPCODES = {
|
200
|
-
:annotation => 0x01b6, # Details unknown
|
201
|
-
:note => 0x001c, # Details unknown
|
202
201
|
:blank => 0x0201, # BLANK ➜ 6.7
|
203
202
|
:boolerr => 0x0205, # BOOLERR ➜ 6.10
|
204
203
|
:boundsheet => 0x0085, # ●● BOUNDSHEET ➜ 6.12
|
@@ -99,7 +99,7 @@ module Biff8
|
|
99
99
|
# List of rt formatting runs (➜ 3.2)
|
100
100
|
# [var.] sz (optional, only if phonetic=1)
|
101
101
|
# Asian Phonetic Settings Block (➜ 3.4.2)
|
102
|
-
chars, offset, wide, phonetic, richtext, available, owing \
|
102
|
+
chars, offset, wide, phonetic, richtext, available, owing, skip \
|
103
103
|
= read_string_header work, count_length
|
104
104
|
string, data = read_string_body work, offset, available, wide > 0
|
105
105
|
if owing > 0
|
@@ -132,11 +132,20 @@ module Biff8
|
|
132
132
|
phonetic = (opts >> 2) & 1
|
133
133
|
richtext = (opts >> 3) & 1
|
134
134
|
size = chars * (wide + 1)
|
135
|
+
skip = 0
|
136
|
+
if richtext > 0
|
137
|
+
runs, = work[offset + 1 + count_length, 2].unpack 'v'
|
138
|
+
skip = 4 * runs
|
139
|
+
end
|
140
|
+
if phonetic > 0
|
141
|
+
psize, = work[offset + 1 + count_length + richtext * 2, 4].unpack 'V'
|
142
|
+
skip += psize
|
143
|
+
end
|
135
144
|
flagsize = 1 + count_length + richtext * 2 + phonetic * 4
|
136
145
|
avbl = [work.size - offset, flagsize + size].min
|
137
146
|
have_chrs = (avbl - flagsize) / (1 + wide)
|
138
147
|
owing = chars - have_chrs
|
139
|
-
[chars, flagsize, wide, phonetic, richtext, avbl, owing]
|
148
|
+
[chars, flagsize, wide, phonetic, richtext, avbl, owing, skip]
|
140
149
|
end
|
141
150
|
##
|
142
151
|
# Insert null-characters into a compressed UTF-16 string
|
@@ -153,13 +162,13 @@ module Biff8
|
|
153
162
|
:ole => @data,
|
154
163
|
:reader => self
|
155
164
|
sst.chars, sst.flags, wide, sst.phonetic, sst.richtext, sst.available,
|
156
|
-
sst.continued_chars = read_string_header work, 2, pos
|
165
|
+
sst.continued_chars, skip = read_string_header work, 2, pos
|
157
166
|
sst.wide = wide > 0
|
158
167
|
if sst.continued?
|
159
168
|
@incomplete_sst = sst
|
160
169
|
end
|
161
170
|
@workbook.add_shared_string sst
|
162
|
-
pos += sst.available
|
171
|
+
pos += sst.available + skip
|
163
172
|
end
|
164
173
|
end
|
165
174
|
end
|
@@ -853,7 +853,7 @@ class Reader
|
|
853
853
|
@pos += len
|
854
854
|
code = SEDOCPO.fetch(op, op)
|
855
855
|
#puts "0x%04x/%-16s (0x%08x) %5i: %s" % [op, code.inspect, pos, len, work[0,16].inspect]
|
856
|
-
puts "0x%04x/%-16s %5i: %s" % [op, code.inspect, len, work[0,32].inspect]
|
856
|
+
#puts "0x%04x/%-16s %5i: %s" % [op, code.inspect, len, work[0,32].inspect]
|
857
857
|
[ pos, code, len + OPCODE_SIZE, work]
|
858
858
|
end
|
859
859
|
end
|
data/lib/spreadsheet.rb
CHANGED
data/test/integration.rb
CHANGED
@@ -1030,19 +1030,5 @@ module Spreadsheet
|
|
1030
1030
|
sheet.name
|
1031
1031
|
assert_not_nil sheet.offset
|
1032
1032
|
end
|
1033
|
-
def test_file_comment
|
1034
|
-
source = File.expand_path 'data/test_comment.xls', File.dirname(__FILE__)
|
1035
|
-
book = Spreadsheet.open source
|
1036
|
-
sheet = book.worksheet 0
|
1037
|
-
row = sheet.row 0
|
1038
|
-
ann = row.annotation 0
|
1039
|
-
assert_equal 'cellcontent', row.cell(0)
|
1040
|
-
assert_equal 'cellcomment', ann
|
1041
|
-
assert_equal 'HW', ann.author
|
1042
|
-
row = sheet.row 1
|
1043
|
-
ann = row.annotation 1
|
1044
|
-
assert_equal 'cellcontent', row.cell(1)
|
1045
|
-
assert_equal 'annotation', ann
|
1046
|
-
end
|
1047
1033
|
end
|
1048
1034
|
end
|
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.6.1.
|
4
|
+
version: 0.6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes Wyss
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-21 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|