spreadsheet 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/GUIDE.txt +209 -0
  2. data/History.txt +8 -0
  3. data/LICENSE.txt +619 -0
  4. data/Manifest.txt +46 -0
  5. data/README.txt +54 -0
  6. data/Rakefile +15 -0
  7. data/lib/parseexcel.rb +27 -0
  8. data/lib/parseexcel/parseexcel.rb +75 -0
  9. data/lib/parseexcel/parser.rb +11 -0
  10. data/lib/spreadsheet.rb +79 -0
  11. data/lib/spreadsheet/datatypes.rb +99 -0
  12. data/lib/spreadsheet/encodings.rb +49 -0
  13. data/lib/spreadsheet/excel.rb +75 -0
  14. data/lib/spreadsheet/excel/error.rb +26 -0
  15. data/lib/spreadsheet/excel/internals.rb +322 -0
  16. data/lib/spreadsheet/excel/internals/biff5.rb +17 -0
  17. data/lib/spreadsheet/excel/internals/biff8.rb +19 -0
  18. data/lib/spreadsheet/excel/offset.rb +37 -0
  19. data/lib/spreadsheet/excel/reader.rb +798 -0
  20. data/lib/spreadsheet/excel/reader/biff5.rb +22 -0
  21. data/lib/spreadsheet/excel/reader/biff8.rb +168 -0
  22. data/lib/spreadsheet/excel/row.rb +67 -0
  23. data/lib/spreadsheet/excel/sst_entry.rb +45 -0
  24. data/lib/spreadsheet/excel/workbook.rb +76 -0
  25. data/lib/spreadsheet/excel/worksheet.rb +85 -0
  26. data/lib/spreadsheet/excel/writer.rb +1 -0
  27. data/lib/spreadsheet/excel/writer/biff8.rb +66 -0
  28. data/lib/spreadsheet/excel/writer/format.rb +270 -0
  29. data/lib/spreadsheet/excel/writer/workbook.rb +586 -0
  30. data/lib/spreadsheet/excel/writer/worksheet.rb +556 -0
  31. data/lib/spreadsheet/font.rb +86 -0
  32. data/lib/spreadsheet/format.rb +172 -0
  33. data/lib/spreadsheet/formula.rb +9 -0
  34. data/lib/spreadsheet/row.rb +87 -0
  35. data/lib/spreadsheet/workbook.rb +120 -0
  36. data/lib/spreadsheet/worksheet.rb +215 -0
  37. data/lib/spreadsheet/writer.rb +29 -0
  38. data/test/data/test_copy.xls +0 -0
  39. data/test/data/test_version_excel5.xls +0 -0
  40. data/test/data/test_version_excel95.xls +0 -0
  41. data/test/data/test_version_excel97.xls +0 -0
  42. data/test/excel/row.rb +29 -0
  43. data/test/font.rb +163 -0
  44. data/test/integration.rb +1021 -0
  45. data/test/workbook.rb +21 -0
  46. data/test/worksheet.rb +62 -0
  47. metadata +113 -0
@@ -0,0 +1,75 @@
1
+ require 'spreadsheet'
2
+
3
+ warn <<-EOS
4
+ [DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
5
+ layer which provides a drop-in replacement for Spreadsheet::Excel
6
+ versions <= 0.3.5.1. This code will be removed in Spreadsheet
7
+ version 1.0.0
8
+ EOS
9
+ ##
10
+ # Spreadsheet::Excel Compatibility Layer.
11
+ # Drop-in replacement for Spreadsheet::Excel version <= 0.3.5.1
12
+ module Spreadsheet
13
+ module Excel
14
+ class ExcelCompatibleWorkbook < Workbook
15
+ def initialize file_path, *args
16
+ super *args
17
+ @file_path = file_path
18
+ end
19
+ def close
20
+ write @file_path
21
+ end
22
+ end
23
+ def Excel.new file_path
24
+ ExcelCompatibleWorkbook.new file_path
25
+ end
26
+ class Workbook
27
+ def add_worksheet name
28
+ if name.is_a? String
29
+ create_worksheet :name => name
30
+ else
31
+ super
32
+ end
33
+ end
34
+ end
35
+ end
36
+ class Worksheet
37
+ def write row, col, data=nil, format=nil
38
+ if data.is_a? Array
39
+ write_row row, col, data, format
40
+ else
41
+ row = row(row)
42
+ row[col] = data
43
+ row.set_format col, format
44
+ end
45
+ end
46
+ def write_column row, col, data=nil, format=nil
47
+ if data.is_a? Array
48
+ data.each do |token|
49
+ if token.is_a? Array
50
+ write_row row, col, token, format
51
+ else
52
+ write row, col, token, format
53
+ end
54
+ row += 1
55
+ end
56
+ else
57
+ write row, col, data, format
58
+ end
59
+ end
60
+ def write_row row, col, data=nil, format=nil
61
+ if data.is_a? Array
62
+ data.each do |token|
63
+ if token.is_a? Array
64
+ write_column row, col, token, format
65
+ else
66
+ write row, col, token, format
67
+ end
68
+ col += 1
69
+ end
70
+ else
71
+ write row, col, data, format
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,26 @@
1
+ module Spreadsheet
2
+ module Excel
3
+ ##
4
+ # This class encapsulates Excel Error-Codes
5
+ class Error
6
+ attr_reader :code
7
+ ERROR_VALUES = {
8
+ 0x00 => '#NULL!', # Intersection of two cell ranges is empty
9
+ 0x07 => '#DIV/0!', # Division by zero
10
+ 0x0F => '#VALUE!', # Wrong type of operand
11
+ 0x17 => '#REF!', # Illegal or deleted cell reference
12
+ 0x1D => '#NAME?', # Wrong function or range name
13
+ 0x24 => '#NUM!', # Value range overflow
14
+ 0x2A => '#N/A!', # Argument or function not available
15
+ }
16
+ def initialize code
17
+ @code = code
18
+ end
19
+ ##
20
+ # The String value Excel associates with an Error code
21
+ def value
22
+ ERROR_VALUES.fetch @code, '#UNKNOWN'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,322 @@
1
+ require 'date'
2
+
3
+ module Spreadsheet
4
+ module Excel
5
+ ##
6
+ # Binary Formats and other configurations internal to Excel. This Module is
7
+ # likely to shrink as Support for older Versions of Excel grows and more Binary
8
+ # formats are moved away from here for disambiguation.
9
+ # If you need to work with constants defined in this module and are confused by
10
+ # names like SEDOC_ROLOC, try reading them backwards. (The reason for this weird
11
+ # naming convention is that according to my ri, Ruby 1.9 renames Hash#index to
12
+ # Hash#key without backward compatibility. Since I did not want to pepper my code
13
+ # with RUBY_VERSION-checks, I settled on this strategy to make the transition to
14
+ # Ruby 1.9 as simple as possible.
15
+ module Internals
16
+ EIGHT_BYTE_DOUBLE = [0.1].pack('E').size == 8 ? 'E' : 'e'
17
+ CODEPAGES = {
18
+ 367 => "ASCII",
19
+ 437 => "IBM437", #(US)
20
+ 720 => "IBM720", #(OEM Arabic)
21
+ 737 => "IBM737", #(Greek)
22
+ 775 => "IBM775", #(Baltic)
23
+ 850 => "IBM850", #(Latin I)
24
+ 852 => "IBM852", #(Latin II (Central European))
25
+ 855 => "IBM855", #(Cyrillic)
26
+ 857 => "IBM857", #(Turkish)
27
+ 858 => "IBM858", #(Multilingual Latin I with Euro)
28
+ 860 => "IBM860", #(Portuguese)
29
+ 861 => "IBM861", #(Icelandic)
30
+ 862 => "IBM862", #(Hebrew)
31
+ 863 => "IBM863", #(Canadian (French))
32
+ 864 => "IBM864", #(Arabic)
33
+ 865 => "IBM865", #(Nordic)
34
+ 866 => "IBM866", #(Cyrillic (Russian))
35
+ 869 => "IBM869", #(Greek (Modern))
36
+ 874 => "WINDOWS-874", #(Thai)
37
+ 932 => "WINDOWS-932", #(Japanese Shift-JIS)
38
+ 936 => "WINDOWS-936", #(Chinese Simplified GBK)
39
+ 949 => "WINDOWS-949", #(Korean (Wansung))
40
+ 950 => "WINDOWS-950", #(Chinese Traditional BIG5)
41
+ 1200 => "UTF-16LE", #(BIFF8)
42
+ 1250 => "WINDOWS-1250", #(Latin II) (Central European)
43
+ 1251 => "WINDOWS-1251", #(Cyrillic)
44
+ 1252 => "WINDOWS-1252", #(Latin I) (BIFF4-BIFF7)
45
+ 1253 => "WINDOWS-1253", #(Greek)
46
+ 1254 => "WINDOWS-1254", #(Turkish)
47
+ 1255 => "WINDOWS-1255", #(Hebrew)
48
+ 1256 => "WINDOWS-1256", #(Arabic)
49
+ 1257 => "WINDOWS-1257", #(Baltic)
50
+ 1258 => "WINDOWS-1258", #(Vietnamese)
51
+ 1361 => "WINDOWS-1361", #(Korean (Johab))
52
+ 10000 => "MACINTOSH",
53
+ 32768 => "MACINTOSH",
54
+ 32769 => "WINDOWS-1252", #(Latin I) (BIFF2-BIFF3)
55
+ }
56
+ SEGAPEDOC = CODEPAGES.invert
57
+ COLOR_CODES = {
58
+ 0x0000 => :builtin_black,
59
+ 0x0001 => :builtin_white,
60
+ 0x0002 => :builtin_red,
61
+ 0x0003 => :builtin_green,
62
+ 0x0004 => :builtin_blue,
63
+ 0x0005 => :builtin_yellow,
64
+ 0x0006 => :builtin_magenta,
65
+ 0x0007 => :builtin_cyan,
66
+ 0x0008 => :black,
67
+ 0x0009 => :white,
68
+ 0x000a => :red,
69
+ 0x000b => :lime,
70
+ 0x000c => :blue,
71
+ 0x000d => :yellow,
72
+ 0x000e => :magenta,
73
+ 0x000f => :cyan,
74
+ 0x0010 => :brown,
75
+ 0x0011 => :green,
76
+ 0x0012 => :navy,
77
+ 0x0016 => :silver,
78
+ 0x0017 => :gray,
79
+ 0x001d => :orange,
80
+ 0x0024 => :purple,
81
+ 0x0040 => :border,
82
+ 0x0041 => :pattern_bg,
83
+ 0x0043 => :dialog_bg,
84
+ 0x004d => :chart_text,
85
+ 0x004e => :chart_bg,
86
+ 0x004f => :chart_border,
87
+ 0x0050 => :tooltip_bg,
88
+ 0x0051 => :tooltip_text,
89
+ 0x7fff => :text,
90
+ }
91
+ SEDOC_ROLOC = COLOR_CODES.invert.update( :aqua => 0x000f,
92
+ :fuchsia => 0x000e,
93
+ :grey => 0x0017 )
94
+ BINARY_FORMATS = {
95
+ :blank => 'v3',
96
+ :boolerr => 'v3C2',
97
+ :font => 'v5C3x',
98
+ :labelsst => 'v3V',
99
+ :number => "v3#{EIGHT_BYTE_DOUBLE}",
100
+ :rk => 'v3V',
101
+ :row => 'v5Cv',
102
+ :xf => 'v3C4V2v',
103
+ }
104
+ # From BIFF5 on, the built-in number formats will be omitted. The built-in
105
+ # formats are dependent on the current regional settings of the operating
106
+ # system. The following table shows which number formats are used by
107
+ # default in a US-English environment. All indexes from 0 to 163 are
108
+ # reserved for built-in formats.
109
+ BUILTIN_FORMATS = { # TODO: locale support
110
+ 0 => 'General',
111
+ 1 => '0',
112
+ 2 => '0.00',
113
+ 3 => '#,##0',
114
+ 4 => '#,##0.00',
115
+ 5 => '"$"#,##0_);("$"#,##0)',
116
+ 6 => '"$"#,##0_);[Red]("$"#,##0)',
117
+ 7 => '"$"#,##0.00_);("$"#,##0.00)',
118
+ 8 => '"$"#,##0.00_);[Red]("$"#,##0.00)',
119
+ 9 => '0%',
120
+ 10 => '0.00%',
121
+ 11 => '0.00E+00',
122
+ 12 => '# ?/?',
123
+ 13 => '# ??/??',
124
+ 14 => 'M/D/YY',
125
+ 15 => 'D-MMM-YY',
126
+ 16 => 'D-MMM',
127
+ 17 => 'MMM-YY',
128
+ 18 => 'h:mm AM/PM',
129
+ 19 => 'h:mm:ss AM/PM',
130
+ 20 => 'h:mm',
131
+ 21 => 'h:mm:ss',
132
+ 22 => 'M/D/YY h:mm',
133
+ 37 => '_(#,##0_);(#,##0)',
134
+ 38 => '_(#,##0_);[Red](#,##0)',
135
+ 39 => '_(#,##0.00_);(#,##0.00)',
136
+ 40 => '_(#,##0.00_);[Red](#,##0.00)',
137
+ 41 => '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
138
+ 42 => '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
139
+ 43 => '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
140
+ 44 => '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
141
+ 45 => 'mm:ss',
142
+ 46 => '[h]:mm:ss',
143
+ 47 => 'mm:ss.0',
144
+ 48 => '##0.0E+0',
145
+ 49 => '@',
146
+ }
147
+ BUILTIN_STYLES = {
148
+ 0x00 => 'Normal',
149
+ 0x01 => 'RowLevel_lv',
150
+ 0x02 => 'ColLevel_lv',
151
+ 0x03 => 'Comma',
152
+ 0x04 => 'Currency',
153
+ 0x05 => 'Percent',
154
+ 0x06 => 'Comma',
155
+ 0x07 => 'Currency',
156
+ 0x08 => 'Hyperlink',
157
+ 0x09 => 'Followed Hyperlink',
158
+ }
159
+ ESCAPEMENT_TYPES = {
160
+ 0x0001 => :superscript,
161
+ 0x0002 => :subscript,
162
+ }
163
+ SEPYT_TNEMEPACSE = ESCAPEMENT_TYPES.invert
164
+ FONT_ENCODINGS = {
165
+ 0x01 => :default,
166
+ 0x02 => :symbol,
167
+ 0x4d => :apple_roman,
168
+ 0x80 => :shift_jis,
169
+ 0x81 => :korean_hangul,
170
+ 0x82 => :korean_johab,
171
+ 0x86 => :chinese_simplified,
172
+ 0x88 => :chinese_traditional,
173
+ 0xa1 => :greek,
174
+ 0xa2 => :turkish,
175
+ 0xa3 => :vietnamese,
176
+ 0xb1 => :hebrew,
177
+ 0xb2 => :arabic,
178
+ 0xba => :baltic,
179
+ 0xcc => :cyrillic,
180
+ 0xde => :thai,
181
+ 0xee => :latin2,
182
+ 0xff => :oem_latin1,
183
+ }
184
+ SGNIDOCNE_TNOF = FONT_ENCODINGS.invert
185
+ FONT_FAMILIES = {
186
+ 0x01 => :roman,
187
+ 0x02 => :swiss,
188
+ 0x03 => :modern,
189
+ 0x04 => :script,
190
+ 0x05 => :decorative,
191
+ }
192
+ SEILIMAF_TNOF = FONT_FAMILIES.invert
193
+ FONT_WEIGHTS = {
194
+ :bold => 700,
195
+ :normal => 400,
196
+ }
197
+ LEAP_ERROR = Date.new 1900, 2, 28
198
+ OPCODES = {
199
+ :blank => 0x0201,
200
+ :boolerr => 0x0205,
201
+ :boundsheet => 0x0085,
202
+ :codepage => 0x0042,
203
+ :continue => 0x003c,
204
+ :datemode => 0x0022,
205
+ :dbcell => 0x0a0b,
206
+ :dimensions => 0x0200,
207
+ :eof => 0x000a,
208
+ :extsst => 0x00ff,
209
+ :font => 0x0031,
210
+ :format => 0x041e,
211
+ :formula => 0x0006,
212
+ :index => 0x020b,
213
+ :label => 0x0204,
214
+ :labelsst => 0x00fd,
215
+ :mulblank => 0x00be,
216
+ :mulrk => 0x00bd,
217
+ :number => 0x0203,
218
+ :rk => 0x027e,
219
+ :row => 0x0208,
220
+ :rstring => 0x00d6,
221
+ :sst => 0x00fc,
222
+ :string => 0x0207,
223
+ :style => 0x0293,
224
+ :uncalced => 0x005e,
225
+ :xf => 0x00e0,
226
+ ########################## Unhandled Opcodes ################################
227
+ ########################## ○ Calculation Settings Block ➜ 5.3
228
+ :calccount => 0x000c, # ○ CALCCOUNT ➜ 6.14
229
+ :calcmode => 0x000d, # ○ CALCMODE ➜ 6.15
230
+ :precision => 0x000e, # ○ PRECISION ➜ 6.74 (moved to Workbook Globals
231
+ # Substream in BIFF5-BIFF8)
232
+ :refmode => 0x000f, # ○ REFMODE ➜ 6.80
233
+ :delta => 0x0010, # ○ DELTA ➜ 6.30
234
+ :iteration => 0x0011, # ○ ITERATION ➜ 6.57
235
+ :saverecalc => 0x005f, # ○ SAVERECALC ➜ 6.85 (BIFF3-BIFF8 only)
236
+ ########################## ○ Workbook Protection Block ➜ 5.18
237
+ :protect => 0x0012, # ○ PROTECT
238
+ # Worksheet contents: 1 = protected (➜ 6.77)
239
+ :windowprot => 0x0019, # ○ WINDOWPROTECT Window settings: 1 = protected
240
+ # (BIFF4W only, ➜ 6.110)
241
+ :objectprot => 0x0063, # ○ OBJECTPROTECT
242
+ # Embedded objects: 1 = protected (➜ 6.69)
243
+ :scenprotect => 0x00dd, # ○ SCENPROTECT
244
+ # Scenarios: 1 = protected (BIFF5-BIFF8, ➜ 6.86)
245
+ :password => 0x0013, # ○ PASSWORD Hash value of the password;
246
+ # 0 = no password (➜ 6.72)
247
+ ########################## ○ File Protection Block ➜ 5.19
248
+ :writeprot => 0x0086, # ○ WRITEPROT File is write protected
249
+ # (BIFF3-BIFF8, ➜ 6.112), password in FILESHARING
250
+ :filepass => 0x002f, # ○ FILEPASS File is read/write-protected,
251
+ # encryption information (➜ 6.41)
252
+ :writeaccess => 0x005c, # ○ WRITEACCESS User name (BIFF3-BIFF8, ➜ 6.111)
253
+ :filesharing => 0x005b, # ○ FILESHARING File sharing options
254
+ # (BIFF3-BIFF8, ➜ 6.42)
255
+ ########################## ○ Link Table ➜ 5.10.3
256
+ # ●● SUPBOOK Block(s)
257
+ # Settings for a referenced document
258
+ :supbook => 0x01ae, # ● SUPBOOK ➜ 6.100
259
+ :externname => 0x0223, # ○○ EXTERNNAME ➜ 6.38
260
+ :xct => 0x0059, # ○○ ● XCT ➜ 6.114
261
+ :crn => 0x005a, # ●● CRN ➜ 6.24
262
+ :externsheet => 0x0017, # ● EXTERNSHEET ➜ 6.39
263
+ :name => 0x0218, # ○○ NAME ➜ 6.66
264
+ ##########################
265
+ :window1 => 0x003d, # ● WINDOW1 ➜ 6.108 (has information on
266
+ # which Spreadsheet is 'active')
267
+ :backup => 0x0040, # ○ BACKUP ➜ 6.5
268
+ :country => 0x008c, # ○ COUNTRY (Make writeable?) ➜ 6.23
269
+ :hideobj => 0x008d, # ○ HIDEOBJ ➜ 6.52
270
+ :palette => 0x0092, # ○ PALETTE ➜ 6.70
271
+ :fngroupcnt => 0x009c, # ○ FNGROUPCOUNT
272
+ :bookbool => 0x00da, # ○ BOOKBOOL ➜ 6.9
273
+ :tabid => 0x013d, # ○ TABID
274
+ :useselfs => 0x0160, # ○ USESELFS (Natural Language Formulas) ➜ 6.105
275
+ :dsf => 0x0161, # ○ DSF (Double Stream File) ➜ 6.32
276
+ :refreshall => 0x01b7, # ○ REFRESHALL
277
+ ########################## ○ Page Settings Block ➜ 5.4
278
+ :hpagebreaks => 0x001b, # ○ HORIZONTALPAGEBREAKS ➜ 6.54
279
+ :vpagebreaks => 0x001a, # ○ VERTICALPAGEBREAKS ➜ 6.107
280
+ :header => 0x0014, # ○ HEADER ➜ 6.51
281
+ :footer => 0x0015, # ○ FOOTER ➜ 6.44
282
+ :hcenter => 0x0083, # ○ HCENTER ➜ 6.50 (BIFF3-BIFF8 only)
283
+ :vcenter => 0x0084, # ○ VCENTER ➜ 6.106 (BIFF3-BIFF8 only)
284
+ :leftmargin => 0x0026, # ○ LEFTMARGIN ➜ 6.62
285
+ :rightmargin => 0x0027, # ○ RIGHTMARGIN ➜ 6.81
286
+ :topmargin => 0x0028, # ○ TOPMARGIN ➜ 6.103
287
+ :bottommargin => 0x0029, # ○ BOTTOMMARGIN ➜ 6.11
288
+ # ○ PLS (opcode unknown)
289
+ :setup => 0x00a1, # ○ SETUP ➜ 6.89 (BIFF4-BIFF8 only)
290
+ :bitmap => 0x00e9, # ○ BITMAP ➜ 6.6 (Background-Bitmap, BIFF8 only)
291
+ ##########################
292
+ :printheaders => 0x002a, # ○ PRINTHEADERS ➜ 6.76
293
+ :printgridlns => 0x002b, # ○ PRINTGRIDLINES ➜ 6.75
294
+ :gridset => 0x0082, # ○ GRIDSET ➜ 6.48
295
+ :guts => 0x0080, # ○ GUTS ➜ 6.49
296
+ :defrowheight => 0x0225, # ○ DEFAULTROWHEIGHT ➜ 6.28
297
+ :wsbool => 0x0081, # ○ WSBOOL ➜ 6.113
298
+ :defcolwidth => 0x0055, # ○ DEFCOLWIDTH ➜ 6.29
299
+ :colinfo => 0x007d, # ○○ COLINFO ➜ 6.18
300
+ :sort => 0x0090, # ○ SORT ➜ 6.95
301
+ }
302
+ =begin ## unknown opcodes
303
+ 0x00bf, 0x00c0, 0x00c1, 0x00e1, 0x00e2, 0x00eb, 0x01af, 0x01bc
304
+ =end
305
+ SEDOCPO = OPCODES.invert
306
+ TWIPS = 20
307
+ UNDERLINE_TYPES = {
308
+ 0x0001 => :single,
309
+ 0x0002 => :double,
310
+ 0x0021 => :single_accounting,
311
+ 0x0022 => :double_accounting,
312
+ }
313
+ SEPYT_ENILREDNU = UNDERLINE_TYPES.invert
314
+ def binfmt key
315
+ BINARY_FORMATS[key]
316
+ end
317
+ def opcode key
318
+ OPCODES[key]
319
+ end
320
+ end
321
+ end
322
+ end
@@ -0,0 +1,17 @@
1
+ module Spreadsheet
2
+ module Excel
3
+ module Internals
4
+ ##
5
+ # Binary Formats and other configurations internal to Biff5. This Module is
6
+ # likely to be expanded as Support for older Versions of Excel grows.
7
+ module Biff5
8
+ BINARY_FORMATS = {
9
+ :dimensions => 'v5',
10
+ }
11
+ def binfmt key # :nodoc:
12
+ BINARY_FORMATS.fetch key do super end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Spreadsheet
2
+ module Excel
3
+ module Internals
4
+ ##
5
+ # Binary Formats and other configurations internal to Biff8. This Module is
6
+ # likely to be expanded as Support for older Versions of Excel grows and more
7
+ # Binary formats are moved here for disambiguation.
8
+ module Biff8
9
+ BINARY_FORMATS = {
10
+ :bof => 'v4V2',
11
+ :dimensions => 'V2v2x2',
12
+ }
13
+ def binfmt key # :nodoc:
14
+ BINARY_FORMATS.fetch key do super end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end