spreadsheet 1.3.3 → 1.3.4

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parseexcel/parseexcel.rb +66 -58
  3. data/lib/parseexcel/parser.rb +1 -1
  4. data/lib/parseexcel.rb +1 -1
  5. data/lib/spreadsheet/column.rb +11 -9
  6. data/lib/spreadsheet/compatibility.rb +3 -1
  7. data/lib/spreadsheet/datatypes.rb +149 -147
  8. data/lib/spreadsheet/encodings.rb +20 -16
  9. data/lib/spreadsheet/errors.rb +2 -2
  10. data/lib/spreadsheet/excel/error.rb +23 -22
  11. data/lib/spreadsheet/excel/internals/biff5.rb +11 -11
  12. data/lib/spreadsheet/excel/internals/biff8.rb +13 -13
  13. data/lib/spreadsheet/excel/internals.rb +451 -451
  14. data/lib/spreadsheet/excel/offset.rb +32 -31
  15. data/lib/spreadsheet/excel/password_hash.rb +18 -18
  16. data/lib/spreadsheet/excel/reader/biff5.rb +34 -35
  17. data/lib/spreadsheet/excel/reader/biff8.rb +234 -222
  18. data/lib/spreadsheet/excel/reader.rb +1320 -1274
  19. data/lib/spreadsheet/excel/rgb.rb +91 -91
  20. data/lib/spreadsheet/excel/row.rb +99 -91
  21. data/lib/spreadsheet/excel/sst_entry.rb +40 -38
  22. data/lib/spreadsheet/excel/workbook.rb +86 -76
  23. data/lib/spreadsheet/excel/worksheet.rb +125 -107
  24. data/lib/spreadsheet/excel/writer/biff8.rb +56 -55
  25. data/lib/spreadsheet/excel/writer/format.rb +273 -256
  26. data/lib/spreadsheet/excel/writer/n_worksheet.rb +837 -798
  27. data/lib/spreadsheet/excel/writer/workbook.rb +671 -635
  28. data/lib/spreadsheet/excel/writer/worksheet.rb +898 -861
  29. data/lib/spreadsheet/excel/writer.rb +1 -1
  30. data/lib/spreadsheet/excel.rb +18 -11
  31. data/lib/spreadsheet/font.rb +30 -26
  32. data/lib/spreadsheet/format.rb +74 -59
  33. data/lib/spreadsheet/link.rb +7 -5
  34. data/lib/spreadsheet/note.rb +6 -6
  35. data/lib/spreadsheet/noteObject.rb +5 -5
  36. data/lib/spreadsheet/row.rb +33 -23
  37. data/lib/spreadsheet/version.rb +1 -1
  38. data/lib/spreadsheet/workbook.rb +27 -13
  39. data/lib/spreadsheet/worksheet.rb +102 -68
  40. data/lib/spreadsheet/writer.rb +3 -0
  41. data/lib/spreadsheet.rb +12 -15
  42. data/test/excel/reader.rb +8 -8
  43. data/test/excel/row.rb +35 -31
  44. data/test/excel/writer/workbook.rb +18 -16
  45. data/test/excel/writer/worksheet.rb +10 -8
  46. data/test/font.rb +44 -32
  47. data/test/format.rb +38 -33
  48. data/test/integration.rb +627 -598
  49. data/test/row.rb +5 -3
  50. data/test/suite.rb +7 -7
  51. data/test/workbook.rb +15 -14
  52. data/test/workbook_protection.rb +5 -5
  53. data/test/worksheet.rb +36 -34
  54. metadata +48 -6
@@ -1,5 +1,5 @@
1
1
  # A quick and dirty class for converting color palette values to RGB values.
2
- # The values below have the form 0xRRGGBB, where RR is the red level, GG the
2
+ # The values below have the form 0xRRGGBB, where RR is the red level, GG the
3
3
  # green level, and BB the blue level. Each level is a value from 0 to 255,
4
4
  # just as one would expect in HTML markup.
5
5
 
@@ -13,109 +13,109 @@ module Spreadsheet
13
13
  class Rgb
14
14
  attr_accessor :r, :g, :b
15
15
 
16
- @@RGB_MAP = {
17
- :xls_color_0 => 0x000000,
18
- :xls_color_1 => 0xffffff,
19
- :xls_color_2 => 0xff0000,
20
- :xls_color_3 => 0x00ff00,
21
- :xls_color_4 => 0x0000ff,
22
- :xls_color_5 => 0xffff00,
23
- :xls_color_6 => 0xff00ff,
24
- :xls_color_7 => 0x00ffff,
25
- :xls_color_8 => 0x800000,
26
- :xls_color_9 => 0x008000,
27
- :xls_color_10 => 0x008000,
28
- :xls_color_11 => 0x000080,
29
- :xls_color_12 => 0x808080,
30
- :xls_color_13 => 0x008080,
31
- :xls_color_14 => 0xc0c0c0,
32
- :xls_color_15 => 0x808080,
33
- :xls_color_16 => 0x9999ff,
34
- :xls_color_17 => 0x993366,
35
- :xls_color_18 => 0xffffcc,
36
- :xls_color_19 => 0xccffff,
37
- :xls_color_20 => 0x660066,
38
- :xls_color_21 => 0xff8080,
39
- :xls_color_22 => 0x0066cc,
40
- :xls_color_23 => 0xccccff,
41
- :xls_color_24 => 0x000080,
42
- :xls_color_25 => 0xff00ff,
43
- :xls_color_26 => 0xffff00,
44
- :xls_color_27 => 0x00ffff,
45
- :xls_color_28 => 0x800080,
46
- :xls_color_29 => 0x800000,
47
- :xls_color_30 => 0x008080,
48
- :xls_color_31 => 0x0000ff,
49
- :xls_color_32 => 0x00ccff,
50
- :xls_color_33 => 0xccffff,
51
- :xls_color_34 => 0xccffcc,
52
- :xls_color_35 => 0xffff99,
53
- :xls_color_36 => 0x99ccff,
54
- :xls_color_37 => 0xff99cc,
55
- :xls_color_38 => 0xcc99ff,
56
- :xls_color_39 => 0xffcc99,
57
- :xls_color_40 => 0x3366ff,
58
- :xls_color_41 => 0x33cccc,
59
- :xls_color_42 => 0x99cc00,
60
- :xls_color_43 => 0xffcc00,
61
- :xls_color_44 => 0xff9900,
62
- :xls_color_45 => 0xff6600,
63
- :xls_color_46 => 0x666699,
64
- :xls_color_47 => 0x969696,
65
- :xls_color_48 => 0x003366,
66
- :xls_color_49 => 0x339966,
67
- :xls_color_50 => 0x003300,
68
- :xls_color_51 => 0x333300,
69
- :xls_color_52 => 0x993300,
70
- :xls_color_53 => 0x993366,
71
- :xls_color_54 => 0x333399,
72
- :xls_color_55 => 0x333333,
73
- :builtin_black => 0x000000,
74
- :builtin_white => 0xffffff,
75
- :builtin_red => 0xff0000,
76
- :builtin_green => 0x00ff00,
77
- :builtin_blue => 0x0000ff,
78
- :builtin_yellow => 0xffff00,
79
- :builtin_magenta => 0xff00ff,
80
- :builtin_cyan => 0x00ffff,
81
- :aqua => 0x00ffff,
82
- :black => 0x000000,
83
- :blue => 0x0000ff,
84
- :cyan => 0x00ffff,
85
- :brown => 0x800000,
86
- :fuchsia => 0xff00ff,
87
- :gray => 0x808080,
88
- :grey => 0x808080,
89
- :green => 0x008000,
90
- :lime => 0x00ff00,
91
- :magenta => 0xff00ff,
92
- :navy => 0x000080,
93
- :orange => 0xff9900,
94
- :purple => 0x800080,
95
- :red => 0xff0000,
96
- :silver => 0xc0c0c0,
97
- :white => 0xffffff,
98
- :yellow => 0xffff00
16
+ @@rgb_map = {
17
+ xls_color_0: 0x000000,
18
+ xls_color_1: 0xffffff,
19
+ xls_color_2: 0xff0000,
20
+ xls_color_3: 0x00ff00,
21
+ xls_color_4: 0x0000ff,
22
+ xls_color_5: 0xffff00,
23
+ xls_color_6: 0xff00ff,
24
+ xls_color_7: 0x00ffff,
25
+ xls_color_8: 0x800000,
26
+ xls_color_9: 0x008000,
27
+ xls_color_10: 0x008000,
28
+ xls_color_11: 0x000080,
29
+ xls_color_12: 0x808080,
30
+ xls_color_13: 0x008080,
31
+ xls_color_14: 0xc0c0c0,
32
+ xls_color_15: 0x808080,
33
+ xls_color_16: 0x9999ff,
34
+ xls_color_17: 0x993366,
35
+ xls_color_18: 0xffffcc,
36
+ xls_color_19: 0xccffff,
37
+ xls_color_20: 0x660066,
38
+ xls_color_21: 0xff8080,
39
+ xls_color_22: 0x0066cc,
40
+ xls_color_23: 0xccccff,
41
+ xls_color_24: 0x000080,
42
+ xls_color_25: 0xff00ff,
43
+ xls_color_26: 0xffff00,
44
+ xls_color_27: 0x00ffff,
45
+ xls_color_28: 0x800080,
46
+ xls_color_29: 0x800000,
47
+ xls_color_30: 0x008080,
48
+ xls_color_31: 0x0000ff,
49
+ xls_color_32: 0x00ccff,
50
+ xls_color_33: 0xccffff,
51
+ xls_color_34: 0xccffcc,
52
+ xls_color_35: 0xffff99,
53
+ xls_color_36: 0x99ccff,
54
+ xls_color_37: 0xff99cc,
55
+ xls_color_38: 0xcc99ff,
56
+ xls_color_39: 0xffcc99,
57
+ xls_color_40: 0x3366ff,
58
+ xls_color_41: 0x33cccc,
59
+ xls_color_42: 0x99cc00,
60
+ xls_color_43: 0xffcc00,
61
+ xls_color_44: 0xff9900,
62
+ xls_color_45: 0xff6600,
63
+ xls_color_46: 0x666699,
64
+ xls_color_47: 0x969696,
65
+ xls_color_48: 0x003366,
66
+ xls_color_49: 0x339966,
67
+ xls_color_50: 0x003300,
68
+ xls_color_51: 0x333300,
69
+ xls_color_52: 0x993300,
70
+ xls_color_53: 0x993366,
71
+ xls_color_54: 0x333399,
72
+ xls_color_55: 0x333333,
73
+ builtin_black: 0x000000,
74
+ builtin_white: 0xffffff,
75
+ builtin_red: 0xff0000,
76
+ builtin_green: 0x00ff00,
77
+ builtin_blue: 0x0000ff,
78
+ builtin_yellow: 0xffff00,
79
+ builtin_magenta: 0xff00ff,
80
+ builtin_cyan: 0x00ffff,
81
+ aqua: 0x00ffff,
82
+ black: 0x000000,
83
+ blue: 0x0000ff,
84
+ cyan: 0x00ffff,
85
+ brown: 0x800000,
86
+ fuchsia: 0xff00ff,
87
+ gray: 0x808080,
88
+ grey: 0x808080,
89
+ green: 0x008000,
90
+ lime: 0x00ff00,
91
+ magenta: 0xff00ff,
92
+ navy: 0x000080,
93
+ orange: 0xff9900,
94
+ purple: 0x800080,
95
+ red: 0xff0000,
96
+ silver: 0xc0c0c0,
97
+ white: 0xffffff,
98
+ yellow: 0xffff00
99
99
  }
100
100
 
101
101
  def self.to_rgb color_symbol
102
- col = @@RGB_MAP[color_symbol]
102
+ col = @@rgb_map[color_symbol]
103
103
  return Rgb.new(col >> 16, (col & 0xff00) >> 8, col & 0xff) if col
104
104
  nil
105
105
  end
106
106
 
107
- def initialize(r,g,b)
108
- @r = r & 0xff
109
- @g = g & 0xff
110
- @b = b & 0xff
107
+ def initialize(r, g, b)
108
+ @r = r & 0xff
109
+ @g = g & 0xff
110
+ @b = b & 0xff
111
111
  end
112
112
 
113
113
  def to_i
114
- (r * (256 * 256)) + (g * 256) + b
114
+ (r * (256 * 256)) + (g * 256) + b
115
115
  end
116
116
 
117
117
  def as_hex
118
- to_i.to_s(16)
118
+ to_i.to_s(16)
119
119
  end
120
120
  end
121
121
  end
@@ -1,98 +1,106 @@
1
- require 'date'
2
- require 'spreadsheet/row'
1
+ require "date"
2
+ require "spreadsheet/row"
3
3
 
4
4
  module Spreadsheet
5
5
  module Excel
6
- ##
7
- # Excel-specific Row methods
8
- class Row < Spreadsheet::Row
9
- ##
10
- # The Excel date calculation erroneously assumes that 1900 is a leap-year. All
11
- # Dates after 28.2.1900 are off by one.
12
- LEAP_ERROR = Date.new 1900, 2, 28
13
- ##
14
- # Force convert the cell at _idx_ to a Date
15
- def date idx
16
- _date at(idx)
17
- end
18
- ##
19
- # Force convert the cell at _idx_ to a DateTime
20
- def datetime idx
21
- _datetime at(idx)
22
- end
23
- def each
24
- size.times do |idx|
25
- yield self[idx]
26
- end
27
- end
28
- ##
29
- # Access data in this Row like you would in an Array. If a cell is formatted
30
- # as a Date or DateTime, the decoded Date or DateTime value is returned.
31
- def [] idx, len=nil
32
- if len
33
- idx = idx...(idx+len)
34
- end
35
- if idx.is_a? Range
36
- data = []
37
- idx.each do |i|
38
- data.push enriched_data(i, at(i))
6
+ ##
7
+ # Excel-specific Row methods
8
+ class Row < Spreadsheet::Row
9
+ ##
10
+ # The Excel date calculation erroneously assumes that 1900 is a leap-year. All
11
+ # Dates after 28.2.1900 are off by one.
12
+ LEAP_ERROR = Date.new 1900, 2, 28
13
+ ##
14
+ # Force convert the cell at _idx_ to a Date
15
+ def date idx
16
+ set_date at(idx)
17
+ end
18
+
19
+ ##
20
+ # Force convert the cell at _idx_ to a DateTime
21
+ def datetime idx
22
+ set_datetime at(idx)
23
+ end
24
+
25
+ def each
26
+ size.times do |idx|
27
+ yield self[idx]
28
+ end
29
+ end
30
+
31
+ ##
32
+ # Access data in this Row like you would in an Array. If a cell is formatted
33
+ # as a Date or DateTime, the decoded Date or DateTime value is returned.
34
+ def [] idx, len = nil
35
+ if len
36
+ idx = idx...(idx + len)
37
+ end
38
+ if idx.is_a? Range
39
+ data = []
40
+ idx.each do |i|
41
+ data.push enriched_data(i, at(i))
42
+ end
43
+ data
44
+ else
45
+ enriched_data idx, at(idx)
46
+ end
47
+ end
48
+
49
+ ##
50
+ # Returns data as an array. If a cell is formatted as a Date or DateTime, the
51
+ # decoded Date or DateTime value is returned.
52
+ def to_a
53
+ self[0...length]
54
+ end
55
+
56
+ private
57
+
58
+ def set_date data # :nodoc:
59
+ return data if data.is_a?(Date)
60
+ datetime = set_datetime data
61
+ Date.new datetime.year, datetime.month, datetime.day
62
+ end
63
+
64
+ def set_datetime data # :nodoc:
65
+ return data if data.is_a?(DateTime)
66
+ base = @worksheet.date_base
67
+ date = base + data.to_f
68
+ hour = (data.to_f % 1) * 24
69
+ min = (hour % 1) * 60
70
+ sec = ((min % 1) * 60).round
71
+ min = min.floor
72
+ hour = hour.floor
73
+ if sec > 59
74
+ sec = 0
75
+ min += 1
76
+ end
77
+ if min > 59
78
+ min = 0
79
+ hour += 1
80
+ end
81
+ if hour > 23
82
+ hour = 0
83
+ date += 1
84
+ end
85
+ if base < LEAP_ERROR
86
+ date -= 1
87
+ end
88
+ DateTime.new(date.year, date.month, date.day, hour, min, sec)
89
+ end
90
+
91
+ def enriched_data idx, data # :nodoc:
92
+ res = nil
93
+ if (link = @worksheet.links[[@idx, idx]])
94
+ res = link
95
+ elsif data.is_a?(Numeric) && (fmt = format(idx))
96
+ res = if fmt.datetime? || fmt.time?
97
+ set_datetime data
98
+ elsif fmt.date?
99
+ set_date data
100
+ end
101
+ end
102
+ res || data
39
103
  end
40
- data
41
- else
42
- enriched_data idx, at(idx)
43
- end
44
- end
45
- ##
46
- # Returns data as an array. If a cell is formatted as a Date or DateTime, the
47
- # decoded Date or DateTime value is returned.
48
- def to_a
49
- self[0...length]
50
- end
51
- private
52
- def _date data # :nodoc:
53
- return data if data.is_a?(Date)
54
- datetime = _datetime data
55
- Date.new datetime.year, datetime.month, datetime.day
56
- end
57
- def _datetime data # :nodoc:
58
- return data if data.is_a?(DateTime)
59
- base = @worksheet.date_base
60
- date = base + data.to_f
61
- hour = (data.to_f % 1) * 24
62
- min = (hour % 1) * 60
63
- sec = ((min % 1) * 60).round
64
- min = min.floor
65
- hour = hour.floor
66
- if sec > 59
67
- sec = 0
68
- min += 1
69
- end
70
- if min > 59
71
- min = 0
72
- hour += 1
73
- end
74
- if hour > 23
75
- hour = 0
76
- date += 1
77
- end
78
- if LEAP_ERROR > base
79
- date -= 1
80
- end
81
- DateTime.new(date.year, date.month, date.day, hour, min, sec)
82
- end
83
- def enriched_data idx, data # :nodoc:
84
- res = nil
85
- if link = @worksheet.links[[@idx, idx]]
86
- res = link
87
- elsif data.is_a?(Numeric) && fmt = format(idx)
88
- res = if fmt.datetime? || fmt.time?
89
- _datetime data
90
- elsif fmt.date?
91
- _date data
92
- end
93
104
  end
94
- res || data
95
- end
96
- end
97
105
  end
98
106
  end
@@ -1,46 +1,48 @@
1
- require 'spreadsheet/encodings'
1
+ require "spreadsheet/encodings"
2
2
 
3
3
  module Spreadsheet
4
4
  module Excel
5
- ##
6
- # Shared String Table Entry
7
- class SstEntry
8
- include Spreadsheet::Encodings
9
- attr_accessor :chars, :phonetic, :richtext, :flags, :available,
10
- :continued_chars, :wide
11
- def initialize opts = {}
12
- @content = nil
13
- @offset = opts[:offset]
14
- @ole = opts[:ole]
15
- @reader = opts[:reader]
16
- @continuations = []
17
- end
18
- ##
19
- # Access the contents of this Shared String
20
- def content
21
- @content or begin
22
- data = nil
23
- data = @ole[@offset, @available]
24
- content, _ = @reader.read_string_body data, @flags, @available, @wide
25
- @continuations.each do |offset, len|
26
- @reader.continue_string(@ole[offset,len], [content, @chars])
5
+ ##
6
+ # Shared String Table Entry
7
+ class SstEntry
8
+ include Spreadsheet::Encodings
9
+ attr_accessor :chars, :phonetic, :richtext, :flags, :available,
10
+ :continued_chars, :wide
11
+ def initialize opts = {}
12
+ @content = nil
13
+ @offset = opts[:offset]
14
+ @ole = opts[:ole]
15
+ @reader = opts[:reader]
16
+ @continuations = []
17
+ end
18
+
19
+ ##
20
+ # Access the contents of this Shared String
21
+ def content
22
+ @content or begin
23
+ data = @ole[@offset, @available]
24
+ content, _ = @reader.read_string_body data, @flags, @available, @wide
25
+ @continuations.each do |offset, len|
26
+ @reader.continue_string(@ole[offset, len], [content, @chars])
27
+ end
28
+ content = client content, "UTF-16LE"
29
+ if @reader.memoize?
30
+ @content = content
31
+ end
32
+ content
33
+ end
34
+ end
35
+
36
+ ##
37
+ # Register the offset of a String continuation
38
+ def continue offset, size, chars
39
+ @continued_chars -= chars
40
+ @continuations.push [offset, size]
27
41
  end
28
- content = client content, 'UTF-16LE'
29
- if @reader.memoize?
30
- @content = content
42
+
43
+ def continued? # :nodoc:
44
+ @continued_chars > 0
31
45
  end
32
- content
33
46
  end
34
47
  end
35
- ##
36
- # Register the offset of a String continuation
37
- def continue offset, size, chars
38
- @continued_chars -= chars
39
- @continuations.push [offset, size]
40
- end
41
- def continued? # :nodoc:
42
- @continued_chars > 0
43
- end
44
- end
45
- end
46
48
  end
@@ -1,82 +1,92 @@
1
- require 'spreadsheet/workbook'
2
- require 'spreadsheet/excel/offset'
3
- require 'spreadsheet/excel/writer'
4
- require 'ole/storage'
1
+ require "spreadsheet/workbook"
2
+ require "spreadsheet/excel/offset"
3
+ require "spreadsheet/excel/writer"
4
+ require "ole/storage"
5
5
 
6
6
  module Spreadsheet
7
7
  module Excel
8
- ##
9
- # Excel-specific Workbook methods. These are mostly pertinent to the Excel
10
- # reader. You should have no reason to use any of these.
11
- class Workbook < Spreadsheet::Workbook
12
- include Spreadsheet::Encodings
13
- include Spreadsheet::Excel::Offset
14
- BIFF_VERSIONS = {
15
- 0x000 => 2,
16
- 0x007 => 2,
17
- 0x200 => 2,
18
- 0x300 => 3,
19
- 0x400 => 4,
20
- 0x500 => 5,
21
- 0x600 => 8,
22
- }
23
- VERSION_STRINGS = {
24
- 0x600 => 'Microsoft Excel 97/2000/XP',
25
- 0x500 => 'Microsoft Excel 95',
26
- }
27
- offset :encoding, :boundsheets, :sst
28
- attr_accessor :bof, :ole
29
- attr_writer :date_base
30
- def Workbook.open io, opts = {}
31
- Reader.new(opts).read(io)
32
- end
33
- def initialize *args
34
- super
35
- enc = 'UTF-16LE'
36
- if RUBY_VERSION >= '1.9'
37
- enc = Encoding.find enc
38
- end
39
- @encoding = enc
40
- @version = 0x600
41
- @sst = []
42
- end
43
- def add_shared_string str
44
- @sst.push str
45
- end
46
- def add_worksheet worksheet
47
- @changes.store :boundsheets, true
48
- super
49
- end
50
- def biff_version
51
- case @bof
52
- when 0x009
53
- 2
54
- when 0x209
55
- 3
56
- when 0x409
57
- 4
58
- else
59
- BIFF_VERSIONS.fetch(@version) { raise "Unkown BIFF_VERSION '#@version'" }
8
+ ##
9
+ # Excel-specific Workbook methods. These are mostly pertinent to the Excel
10
+ # reader. You should have no reason to use any of these.
11
+ class Workbook < Spreadsheet::Workbook
12
+ include Spreadsheet::Encodings
13
+ include Spreadsheet::Excel::Offset
14
+ BIFF_VERSIONS = {
15
+ 0x000 => 2,
16
+ 0x007 => 2,
17
+ 0x200 => 2,
18
+ 0x300 => 3,
19
+ 0x400 => 4,
20
+ 0x500 => 5,
21
+ 0x600 => 8
22
+ }
23
+ VERSION_STRINGS = {
24
+ 0x600 => "Microsoft Excel 97/2000/XP",
25
+ 0x500 => "Microsoft Excel 95"
26
+ }
27
+ offset :encoding, :boundsheets, :sst
28
+ attr_accessor :bof, :ole
29
+ attr_writer :date_base
30
+ def self.open io, opts = {}
31
+ Reader.new(opts).read(io)
32
+ end
33
+
34
+ def initialize *args
35
+ super
36
+ enc = "UTF-16LE"
37
+ if RUBY_VERSION >= "1.9"
38
+ enc = Encoding.find enc
39
+ end
40
+ @encoding = enc
41
+ @version = 0x600
42
+ @sst = []
43
+ end
44
+
45
+ def add_shared_string str
46
+ @sst.push str
47
+ end
48
+
49
+ def add_worksheet worksheet
50
+ @changes.store :boundsheets, true
51
+ super
52
+ end
53
+
54
+ def biff_version
55
+ case @bof
56
+ when 0x009
57
+ 2
58
+ when 0x209
59
+ 3
60
+ when 0x409
61
+ 4
62
+ else
63
+ BIFF_VERSIONS.fetch(@version) { raise "Unkown BIFF_VERSION '#{@version}'" }
64
+ end
65
+ end
66
+
67
+ def date_base
68
+ @date_base ||= DateTime.new 1899, 12, 31
69
+ end
70
+
71
+ def inspect
72
+ worksheets
73
+ end
74
+
75
+ def shared_string idx
76
+ @sst[idx.to_i].content
77
+ end
78
+
79
+ def sst_size
80
+ @sst.size
81
+ end
82
+
83
+ def uninspect_variables
84
+ super.push "@sst", "@offsets", "@changes"
85
+ end
86
+
87
+ def version_string
88
+ client VERSION_STRINGS.fetch(@version, "Unknown"), "UTF-8"
89
+ end
60
90
  end
61
91
  end
62
- def date_base
63
- @date_base ||= DateTime.new 1899, 12, 31
64
- end
65
- def inspect
66
- self.worksheets
67
- end
68
- def shared_string idx
69
- @sst[idx.to_i].content
70
- end
71
- def sst_size
72
- @sst.size
73
- end
74
- def uninspect_variables
75
- super.push '@sst', '@offsets', '@changes'
76
- end
77
- def version_string
78
- client VERSION_STRINGS.fetch(@version, "Unknown"), 'UTF-8'
79
- end
80
- end
81
- end
82
92
  end