spreadsheet 0.6.1.2 → 0.6.1.3
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 +11 -1
- data/lib/spreadsheet/encodings.rb +2 -2
- data/lib/spreadsheet/excel/reader.rb +12 -6
- data/lib/spreadsheet/excel/workbook.rb +1 -1
- data/lib/spreadsheet/excel/writer/workbook.rb +2 -2
- data/lib/spreadsheet/format.rb +2 -2
- data/lib/spreadsheet/workbook.rb +1 -1
- data/lib/spreadsheet/worksheet.rb +2 -2
- data/lib/spreadsheet.rb +2 -2
- data/test/integration.rb +3 -3
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
+
=== 0.6.1.3 / 2008-10-21
|
2
|
+
|
3
|
+
* 2 Bugfixes
|
4
|
+
|
5
|
+
* Renamed UTF8 to UTF-8 to support freebsd
|
6
|
+
(Thanks to Jacob Atzen for the Patch)
|
7
|
+
* Fixes a Bug where only the first Rowblock was read correctly if there were
|
8
|
+
no DBCELL records terminating the Rowblocks.
|
9
|
+
(Thanks to Bjørn Hjelle for the Bugreport)
|
10
|
+
|
1
11
|
=== 0.6.1.2 / 2008-10-20
|
2
12
|
|
3
13
|
* 2 Bugfixes
|
4
14
|
|
5
15
|
* Corrected the Font-Encoding values in Excel::Internals
|
6
|
-
(Thanks to
|
16
|
+
(Thanks to Bjørn Hjelle for the Bugreport)
|
7
17
|
* Spreadsheet now skips Richtext-Formatting runs and Asian Phonetic
|
8
18
|
Settings when reading the SST, fixing a problem where the presence of
|
9
19
|
Richtext could lead to an incomplete SST.
|
@@ -14,9 +14,9 @@ module Spreadsheet
|
|
14
14
|
end
|
15
15
|
else
|
16
16
|
require 'iconv'
|
17
|
-
@@utf8_utf16 = Iconv.new('UTF-16LE', '
|
17
|
+
@@utf8_utf16 = Iconv.new('UTF-16LE', 'UTF-8')
|
18
18
|
@@utf16_ascii = Iconv.new('ASCII//TRANSLIT//IGNORE', 'UTF-16LE')
|
19
|
-
@@utf16_utf8 = Iconv.new('
|
19
|
+
@@utf16_utf8 = Iconv.new('UTF-8//TRANSLIT//IGNORE', 'UTF-16LE')
|
20
20
|
@@iconvs = {}
|
21
21
|
def ascii string
|
22
22
|
@@utf16_ascii.iconv string
|
@@ -18,7 +18,7 @@ class Reader
|
|
18
18
|
OPCODE_SIZE = 4
|
19
19
|
ROW_BLOCK_OPS = [
|
20
20
|
:blank, :boolerr, :dbcell, :formula, :label, :labelsst, :mulblank, :mulrk,
|
21
|
-
:number, :rk, :
|
21
|
+
:number, :rk, :rstring,
|
22
22
|
]
|
23
23
|
def initialize opts = {}
|
24
24
|
@pos = 0
|
@@ -28,7 +28,7 @@ class Reader
|
|
28
28
|
@opts = opts
|
29
29
|
@current_row_block = {}
|
30
30
|
@formats = {}
|
31
|
-
BUILTIN_FORMATS.each do |key, fmt| @formats.store key, client(fmt, '
|
31
|
+
BUILTIN_FORMATS.each do |key, fmt| @formats.store key, client(fmt, 'UTF-8') end
|
32
32
|
end
|
33
33
|
def decode_rk work
|
34
34
|
# Bit Mask Contents
|
@@ -75,8 +75,12 @@ class Reader
|
|
75
75
|
name
|
76
76
|
end
|
77
77
|
end
|
78
|
-
def in_row_block? op
|
79
|
-
|
78
|
+
def in_row_block? op, previous
|
79
|
+
if op == :row
|
80
|
+
previous == op
|
81
|
+
else
|
82
|
+
ROW_BLOCK_OPS.include?(op)
|
83
|
+
end
|
80
84
|
end
|
81
85
|
def memoize?
|
82
86
|
@opts[:memoization]
|
@@ -584,9 +588,10 @@ class Reader
|
|
584
588
|
end
|
585
589
|
def read_worksheet worksheet, offset
|
586
590
|
@pos = offset
|
591
|
+
previous = nil
|
587
592
|
while tuple = get_next_chunk
|
588
593
|
pos, op, len, work = tuple
|
589
|
-
if((offset = @current_row_block_offset) && !in_row_block?(op))
|
594
|
+
if((offset = @current_row_block_offset) && !in_row_block?(op, previous))
|
590
595
|
@current_row_block_offset = nil
|
591
596
|
offset[1] = pos - offset[0]
|
592
597
|
end
|
@@ -611,6 +616,7 @@ class Reader
|
|
611
616
|
# ● ROW ➜ 6.83
|
612
617
|
set_row_address worksheet, work, pos, len
|
613
618
|
end
|
619
|
+
previous = op
|
614
620
|
end
|
615
621
|
end
|
616
622
|
def read_style work, pos, len
|
@@ -652,7 +658,7 @@ class Reader
|
|
652
658
|
id, level = work.unpack 'x2C2'
|
653
659
|
if name = BUILTIN_STYLES[id]
|
654
660
|
name.sub '_lv', "_#{level.to_s}"
|
655
|
-
xf.name = client name, '
|
661
|
+
xf.name = client name, 'UTF-8'
|
656
662
|
end
|
657
663
|
end
|
658
664
|
end
|
@@ -326,10 +326,10 @@ class Workbook < Spreadsheet::Writer
|
|
326
326
|
# The first user-defined format starts at 164 (0xa4).
|
327
327
|
formats = @number_formats[workbook] = {}
|
328
328
|
BUILTIN_FORMATS.each do |idx, str|
|
329
|
-
formats.store client(str, '
|
329
|
+
formats.store client(str, 'UTF-8'), idx
|
330
330
|
end
|
331
331
|
## Ensure at least a 'GENERAL' format is written
|
332
|
-
formats.delete client('GENERAL', '
|
332
|
+
formats.delete client('GENERAL', 'UTF-8')
|
333
333
|
idx = 0xa4
|
334
334
|
workbook.formats.each do |fmt|
|
335
335
|
str = fmt.number_format
|
data/lib/spreadsheet/format.rb
CHANGED
@@ -72,8 +72,8 @@ module Spreadsheet
|
|
72
72
|
# Text rotation
|
73
73
|
attr_reader :rotation
|
74
74
|
def initialize opts={}
|
75
|
-
@font = Font.new client("Arial", '
|
76
|
-
@number_format = client 'GENERAL', '
|
75
|
+
@font = Font.new client("Arial", 'UTF-8'), :family => :swiss
|
76
|
+
@number_format = client 'GENERAL', 'UTF-8'
|
77
77
|
@rotation = 0
|
78
78
|
@pattern = 0
|
79
79
|
@bottom_color = :builtin_black
|
data/lib/spreadsheet/workbook.rb
CHANGED
@@ -52,7 +52,7 @@ module Spreadsheet
|
|
52
52
|
# Use the option <em>:name => 'My pretty Name'</em> to override this
|
53
53
|
# behavior.
|
54
54
|
def create_worksheet opts = {}
|
55
|
-
opts[:name] ||= client("Worksheet#{@worksheets.size.next}", '
|
55
|
+
opts[:name] ||= client("Worksheet#{@worksheets.size.next}", 'UTF-8')
|
56
56
|
add_worksheet Worksheet.new(opts)
|
57
57
|
end
|
58
58
|
##
|
@@ -214,10 +214,10 @@ module Spreadsheet
|
|
214
214
|
case value
|
215
215
|
when Date
|
216
216
|
format = @workbook.formats.find do |fmt| fmt.date? end
|
217
|
-
format ||= Format.new :number_format => client('M/D/YY', '
|
217
|
+
format ||= Format.new :number_format => client('M/D/YY', 'UTF-8')
|
218
218
|
when DateTime, Time
|
219
219
|
format = @workbook.formats.find do |fmt| fmt.datetime? end
|
220
|
-
format ||= Format.new :number_format => client('M/D/YY h:mm', '
|
220
|
+
format ||= Format.new :number_format => client('M/D/YY h:mm', 'UTF-8')
|
221
221
|
end
|
222
222
|
if format
|
223
223
|
row.formats[idx] = format
|
data/lib/spreadsheet.rb
CHANGED
@@ -42,13 +42,13 @@ module Spreadsheet
|
|
42
42
|
|
43
43
|
##
|
44
44
|
# The version of Spreadsheet you are using.
|
45
|
-
VERSION = '0.6.1.
|
45
|
+
VERSION = '0.6.1.3'
|
46
46
|
|
47
47
|
##
|
48
48
|
# Default client Encoding. Change this value if your application uses a
|
49
49
|
# different Encoding:
|
50
50
|
# Spreadsheet.client_encoding = 'ISO-LATIN-1//TRANSLIT//IGNORE'
|
51
|
-
@client_encoding = '
|
51
|
+
@client_encoding = 'UTF-8'
|
52
52
|
|
53
53
|
class << self
|
54
54
|
|
data/test/integration.rb
CHANGED
@@ -9,7 +9,7 @@ require 'fileutils'
|
|
9
9
|
|
10
10
|
module Spreadsheet
|
11
11
|
class TestIntegration < Test::Unit::TestCase
|
12
|
-
@@iconv = Iconv.new('UTF-16LE', '
|
12
|
+
@@iconv = Iconv.new('UTF-16LE', 'UTF-8')
|
13
13
|
def setup
|
14
14
|
@var = File.expand_path 'var', File.dirname(__FILE__)
|
15
15
|
FileUtils.mkdir_p @var
|
@@ -17,7 +17,7 @@ module Spreadsheet
|
|
17
17
|
FileUtils.mkdir_p @data
|
18
18
|
end
|
19
19
|
def teardown
|
20
|
-
Spreadsheet.client_encoding = '
|
20
|
+
Spreadsheet.client_encoding = 'UTF-8'
|
21
21
|
FileUtils.rm_r @var
|
22
22
|
end
|
23
23
|
def test_copy__identical__file_paths
|
@@ -928,7 +928,7 @@ module Spreadsheet
|
|
928
928
|
sheet1.update_row 7, nil, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
|
929
929
|
sheet2 = book.create_worksheet :name => "m\0y\0 \0n\0a\0m\0e\0"
|
930
930
|
book.write path
|
931
|
-
Spreadsheet.client_encoding = '
|
931
|
+
Spreadsheet.client_encoding = 'UTF-8'
|
932
932
|
str1 = 'Shared String'
|
933
933
|
str2 = 'Another Shared String'
|
934
934
|
str3 = '1234567890 ' * 1000
|