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,459 +1,459 @@
1
- require 'date'
1
+ require "date"
2
2
 
3
3
  module Spreadsheet
4
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-31J", #(Japanese Shift-JIS)
38
- 936 => "GBK", #(Chinese Simplified GBK)
39
- 949 => "CP949", #(Korean (Wansung))
40
- 950 => "CP950", #(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 => "MACROMAN",
53
- 21010 => "UTF-16LE",
54
- 32768 => "MACROMAN",
55
- 32769 => "WINDOWS-1252", #(Latin I) (BIFF2-BIFF3)
56
- }
57
- SEGAPEDOC = CODEPAGES.reject { |k, _v| k >= 21010 }.invert
58
- # color_codes according to http://support.softartisans.com/kbview_1205.aspx
59
- # synonyms are in comments when reverse lookup
60
- COLOR_CODES = {
61
- 0x0000 => :builtin_black,
62
- 0x0001 => :builtin_white,
63
- 0x0002 => :builtin_red,
64
- 0x0003 => :builtin_green,
65
- 0x0004 => :builtin_blue,
66
- 0x0005 => :builtin_yellow,
67
- 0x0006 => :builtin_magenta,
68
- 0x0007 => :builtin_cyan,
69
- 0x0008 => :black, #xls_color_0
70
- 0x0009 => :white, #xls_color_1
71
- 0x000a => :red, #xls_color_2
72
- 0x000b => :lime, #xls_color_3
73
- 0x000c => :blue, #xls_color_4
74
- 0x000d => :yellow, #xls_color_5
75
- 0x000e => :magenta, #xls_color_6, fuchsia
76
- 0x000f => :cyan, #xls_color_7, aqua
77
- 0x0010 => :brown, #xls_color_8
78
- 0x0011 => :green, #xls_color_9
79
- 0x0012 => :navy, #xls_color_10
80
- 0x0013 => :xls_color_11,
81
- 0x0014 => :xls_color_12,
82
- 0x0015 => :xls_color_13,
83
- 0x0016 => :silver, #xls_color_14
84
- 0x0017 => :gray, #xls_color_15, grey
85
- 0x0018 => :xls_color_16,
86
- 0x0019 => :xls_color_17,
87
- 0x001a => :xls_color_18,
88
- 0x001b => :xls_color_19,
89
- 0x001c => :xls_color_20,
90
- 0x001d => :xls_color_21,
91
- 0x001e => :xls_color_22,
92
- 0x001f => :xls_color_23,
93
- 0x0020 => :xls_color_24,
94
- 0x0021 => :xls_color_25,
95
- 0x0022 => :xls_color_26,
96
- 0x0023 => :xls_color_27,
97
- 0x0024 => :purple, #xls_color_28
98
- 0x0025 => :xls_color_29,
99
- 0x0026 => :xls_color_30,
100
- 0x0027 => :xls_color_31,
101
- 0x0028 => :xls_color_32,
102
- 0x0029 => :xls_color_33,
103
- 0x002a => :xls_color_34,
104
- 0x002b => :xls_color_35,
105
- 0x002c => :xls_color_36,
106
- 0x002d => :xls_color_37,
107
- 0x002e => :xls_color_38,
108
- 0x002f => :xls_color_39,
109
- 0x0030 => :xls_color_40,
110
- 0x0031 => :xls_color_41,
111
- 0x0032 => :xls_color_42,
112
- 0x0033 => :xls_color_43,
113
- 0x0034 => :orange, #xls_color_44
114
- 0x0035 => :xls_color_45,
115
- 0x0036 => :xls_color_46,
116
- 0x0037 => :xls_color_47,
117
- 0x0038 => :xls_color_48,
118
- 0x0039 => :xls_color_49,
119
- 0x003a => :xls_color_50,
120
- 0x003b => :xls_color_51,
121
- 0x003c => :xls_color_52,
122
- 0x003d => :xls_color_53,
123
- 0x003e => :xls_color_54,
124
- 0x003f => :xls_color_55,
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-31J", # (Japanese Shift-JIS)
38
+ 936 => "GBK", # (Chinese Simplified GBK)
39
+ 949 => "CP949", # (Korean (Wansung))
40
+ 950 => "CP950", # (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 => "MACROMAN",
53
+ 21010 => "UTF-16LE",
54
+ 32768 => "MACROMAN",
55
+ 32769 => "WINDOWS-1252" # (Latin I) (BIFF2-BIFF3)
56
+ }
57
+ SEGAPEDOC = CODEPAGES.reject { |k, _v| k >= 21010 }.invert
58
+ # color_codes according to http://support.softartisans.com/kbview_1205.aspx
59
+ # synonyms are in comments when reverse lookup
60
+ COLOR_CODES = {
61
+ 0x0000 => :builtin_black,
62
+ 0x0001 => :builtin_white,
63
+ 0x0002 => :builtin_red,
64
+ 0x0003 => :builtin_green,
65
+ 0x0004 => :builtin_blue,
66
+ 0x0005 => :builtin_yellow,
67
+ 0x0006 => :builtin_magenta,
68
+ 0x0007 => :builtin_cyan,
69
+ 0x0008 => :black, # xls_color_0
70
+ 0x0009 => :white, # xls_color_1
71
+ 0x000a => :red, # xls_color_2
72
+ 0x000b => :lime, # xls_color_3
73
+ 0x000c => :blue, # xls_color_4
74
+ 0x000d => :yellow, # xls_color_5
75
+ 0x000e => :magenta, # xls_color_6, fuchsia
76
+ 0x000f => :cyan, # xls_color_7, aqua
77
+ 0x0010 => :brown, # xls_color_8
78
+ 0x0011 => :green, # xls_color_9
79
+ 0x0012 => :navy, # xls_color_10
80
+ 0x0013 => :xls_color_11,
81
+ 0x0014 => :xls_color_12,
82
+ 0x0015 => :xls_color_13,
83
+ 0x0016 => :silver, # xls_color_14
84
+ 0x0017 => :gray, # xls_color_15, grey
85
+ 0x0018 => :xls_color_16,
86
+ 0x0019 => :xls_color_17,
87
+ 0x001a => :xls_color_18,
88
+ 0x001b => :xls_color_19,
89
+ 0x001c => :xls_color_20,
90
+ 0x001d => :xls_color_21,
91
+ 0x001e => :xls_color_22,
92
+ 0x001f => :xls_color_23,
93
+ 0x0020 => :xls_color_24,
94
+ 0x0021 => :xls_color_25,
95
+ 0x0022 => :xls_color_26,
96
+ 0x0023 => :xls_color_27,
97
+ 0x0024 => :purple, # xls_color_28
98
+ 0x0025 => :xls_color_29,
99
+ 0x0026 => :xls_color_30,
100
+ 0x0027 => :xls_color_31,
101
+ 0x0028 => :xls_color_32,
102
+ 0x0029 => :xls_color_33,
103
+ 0x002a => :xls_color_34,
104
+ 0x002b => :xls_color_35,
105
+ 0x002c => :xls_color_36,
106
+ 0x002d => :xls_color_37,
107
+ 0x002e => :xls_color_38,
108
+ 0x002f => :xls_color_39,
109
+ 0x0030 => :xls_color_40,
110
+ 0x0031 => :xls_color_41,
111
+ 0x0032 => :xls_color_42,
112
+ 0x0033 => :xls_color_43,
113
+ 0x0034 => :orange, # xls_color_44
114
+ 0x0035 => :xls_color_45,
115
+ 0x0036 => :xls_color_46,
116
+ 0x0037 => :xls_color_47,
117
+ 0x0038 => :xls_color_48,
118
+ 0x0039 => :xls_color_49,
119
+ 0x003a => :xls_color_50,
120
+ 0x003b => :xls_color_51,
121
+ 0x003c => :xls_color_52,
122
+ 0x003d => :xls_color_53,
123
+ 0x003e => :xls_color_54,
124
+ 0x003f => :xls_color_55,
125
125
 
126
- 0x0040 => :border,
127
- 0x0041 => :pattern_bg,
128
- 0x0043 => :dialog_bg,
129
- 0x004d => :chart_text,
130
- 0x004e => :chart_bg,
131
- 0x004f => :chart_border,
132
- 0x0050 => :tooltip_bg,
133
- 0x0051 => :tooltip_text,
134
- 0x7fff => :text
135
- }
126
+ 0x0040 => :border,
127
+ 0x0041 => :pattern_bg,
128
+ 0x0043 => :dialog_bg,
129
+ 0x004d => :chart_text,
130
+ 0x004e => :chart_bg,
131
+ 0x004f => :chart_border,
132
+ 0x0050 => :tooltip_bg,
133
+ 0x0051 => :tooltip_text,
134
+ 0x7fff => :text
135
+ }
136
136
 
137
- SEDOC_ROLOC = COLOR_CODES.invert.update(
138
- :xls_color_0 => 0x0008,
139
- :xls_color_1 => 0x0009,
140
- :xls_color_2 => 0x000a,
141
- :xls_color_3 => 0x000b,
142
- :xls_color_4 => 0x000c,
143
- :xls_color_5 => 0x000d,
144
- :xls_color_6 => 0x000e,
145
- :fuchsia => 0x000e,
146
- :xls_color_7 => 0x000f,
147
- :aqua => 0x000f,
148
- :xls_color_8 => 0x0010,
149
- :xls_color_9 => 0x0011,
150
- :xls_color_10 => 0x0012,
151
- :xls_color_14 => 0x0016,
152
- :xls_color_15 => 0x0017,
153
- :grey => 0x0017,
154
- :xls_color_28 => 0x0024,
155
- :xls_color_44 => 0x0034
156
- )
137
+ SEDOC_ROLOC = COLOR_CODES.invert.update(
138
+ xls_color_0: 0x0008,
139
+ xls_color_1: 0x0009,
140
+ xls_color_2: 0x000a,
141
+ xls_color_3: 0x000b,
142
+ xls_color_4: 0x000c,
143
+ xls_color_5: 0x000d,
144
+ xls_color_6: 0x000e,
145
+ fuchsia: 0x000e,
146
+ xls_color_7: 0x000f,
147
+ aqua: 0x000f,
148
+ xls_color_8: 0x0010,
149
+ xls_color_9: 0x0011,
150
+ xls_color_10: 0x0012,
151
+ xls_color_14: 0x0016,
152
+ xls_color_15: 0x0017,
153
+ grey: 0x0017,
154
+ xls_color_28: 0x0024,
155
+ xls_color_44: 0x0034
156
+ )
157
157
 
158
- BINARY_FORMATS = {
159
- :blank => 'v3',
160
- :boolerr => 'v3C2',
161
- :colinfo => 'v5x2',
162
- :font => 'v5C3x',
163
- :labelsst => 'v3V',
164
- :number => "v3#{EIGHT_BYTE_DOUBLE}",
165
- :pagesetup => "v8#{EIGHT_BYTE_DOUBLE}2v",
166
- :margin => "#{EIGHT_BYTE_DOUBLE}",
167
- :rk => 'v3V',
168
- :row => 'v4x4V',
169
- :window2 => 'v4x2v2x4',
170
- :xf => 'v3C4V2v',
171
- }
172
- # From BIFF5 on, the built-in number formats will be omitted. The built-in
173
- # formats are dependent on the current regional settings of the operating
174
- # system. The following table shows which number formats are used by
175
- # default in a US-English environment. All indexes from 0 to 163 are
176
- # reserved for built-in formats.
177
- BUILTIN_FORMATS = { # TODO: locale support
178
- 0 => 'GENERAL',
179
- 1 => '0',
180
- 2 => '0.00',
181
- 3 => '#,##0',
182
- 4 => '#,##0.00',
183
- 5 => '"$"#,##0_);("$"#,##0)',
184
- 6 => '"$"#,##0_);[Red]("$"#,##0)',
185
- 7 => '"$"#,##0.00_);("$"#,##0.00)',
186
- 8 => '"$"#,##0.00_);[Red]("$"#,##0.00)',
187
- 9 => '0%',
188
- 10 => '0.00%',
189
- 11 => '0.00E+00',
190
- 12 => '# ?/?',
191
- 13 => '# ??/??',
192
- 14 => 'M/D/YY',
193
- 15 => 'D-MMM-YY',
194
- 16 => 'D-MMM',
195
- 17 => 'MMM-YY',
196
- 18 => 'h:mm AM/PM',
197
- 19 => 'h:mm:ss AM/PM',
198
- 20 => 'h:mm',
199
- 21 => 'h:mm:ss',
200
- 22 => 'M/D/YY h:mm',
201
- 37 => '_(#,##0_);(#,##0)',
202
- 38 => '_(#,##0_);[Red](#,##0)',
203
- 39 => '_(#,##0.00_);(#,##0.00)',
204
- 40 => '_(#,##0.00_);[Red](#,##0.00)',
205
- 41 => '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
206
- 42 => '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
207
- 43 => '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
208
- 44 => '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
209
- 45 => 'mm:ss',
210
- 46 => '[h]:mm:ss',
211
- 47 => 'mm:ss.0',
212
- 48 => '##0.0E+0',
213
- 49 => '@',
214
- }
215
- BUILTIN_STYLES = {
216
- 0x00 => 'Normal',
217
- 0x01 => 'RowLevel_lv',
218
- 0x02 => 'ColLevel_lv',
219
- 0x03 => 'Comma',
220
- 0x04 => 'Currency',
221
- 0x05 => 'Percent',
222
- 0x06 => 'Comma',
223
- 0x07 => 'Currency',
224
- 0x08 => 'Hyperlink',
225
- 0x09 => 'Followed Hyperlink',
226
- }
227
- ESCAPEMENT_TYPES = {
228
- 0x0001 => :superscript,
229
- 0x0002 => :subscript,
230
- }
231
- SEPYT_TNEMEPACSE = ESCAPEMENT_TYPES.invert
232
- FONT_ENCODINGS = {
233
- 0x00 => :iso_latin1,
234
- 0x01 => :default,
235
- 0x02 => :symbol,
236
- 0x4d => :apple_roman,
237
- 0x80 => :shift_jis,
238
- 0x81 => :korean_hangul,
239
- 0x82 => :korean_johab,
240
- 0x86 => :chinese_simplified,
241
- 0x88 => :chinese_traditional,
242
- 0xa1 => :greek,
243
- 0xa2 => :turkish,
244
- 0xa3 => :vietnamese,
245
- 0xb1 => :hebrew,
246
- 0xb2 => :arabic,
247
- 0xba => :baltic,
248
- 0xcc => :cyrillic,
249
- 0xde => :thai,
250
- 0xee => :iso_latin2,
251
- 0xff => :oem_latin1,
252
- }
253
- SGNIDOCNE_TNOF = FONT_ENCODINGS.invert
254
- FONT_FAMILIES = {
255
- 0x01 => :roman,
256
- 0x02 => :swiss,
257
- 0x03 => :modern,
258
- 0x04 => :script,
259
- 0x05 => :decorative,
260
- }
261
- SEILIMAF_TNOF = FONT_FAMILIES.invert
262
- FONT_WEIGHTS = {
263
- :bold => 700,
264
- :normal => 400,
265
- }
266
- WORKSHEET_VISIBILITIES = {
267
- 0x00 => :visible,
268
- 0x01 => :hidden,
269
- 0x02 => :strong_hidden
270
- }
271
- SEITILIBISIV_TEEHSKROW = WORKSHEET_VISIBILITIES.invert
272
- LEAP_ERROR = Date.new 1900, 2, 28
273
- OPCODES = {
274
- :blank => 0x0201, # BLANK ➜ 6.7
275
- :boolerr => 0x0205, # BOOLERR ➜ 6.10
276
- :boundsheet => 0x0085, # ●● BOUNDSHEET ➜ 6.12
277
- :codepage => 0x0042, # ○ CODEPAGE ➜ 6.17
278
- :colinfo => 0x007d, # ○○ COLINFO ➜ 6.18
279
- :continue => 0x003c, # ○ CONTINUE ➜ 6.22
280
- :datemode => 0x0022, # ○ DATEMODE ➜ 6.25
281
- :dbcell => 0x0a0b, # ○ DBCELL
282
- :dimensions => 0x0200, # ● DIMENSIONS ➜ 6.31
283
- :eof => 0x000a, # ● EOF ➜ 6.36
284
- :font => 0x0031, # ●● FONT ➜ 6.43
285
- :format => 0x041e, # ○○ FORMAT (Number Format) ➜ 6.45
286
- :formula => 0x0006, # FORMULA ➜ 6.46
287
- :hlink => 0x01b8, # HLINK ➜ 6.52 (BIFF8 only)
288
- :label => 0x0204, # LABEL ➜ 6.59 (BIFF2-BIFF7)
289
- :labelsst => 0x00fd, # LABELSST ➜ 6.61 (BIFF8 only)
290
- :mergedcells => 0x00e5, # ○○ MERGEDCELLS ➜ 5.67 (BIFF8 only)
291
- :mulblank => 0x00be, # MULBLANK ➜ 6.64 (BIFF5-BIFF8)
292
- :mulrk => 0x00bd, # MULRK ➜ 6.65 (BIFF5-BIFF8)
293
- :number => 0x0203, # NUMBER ➜ 6.68
294
- :rk => 0x027e, # RK ➜ 6.82 (BIFF3-BIFF8)
295
- :row => 0x0208, # ● ROW ➜ 6.83
296
- :rstring => 0x00d6, # RSTRING ➜ 6.84 (BIFF5/BIFF7)
297
- :sst => 0x00fc, # ● SST ➜ 6.96
298
- :string => 0x0207, # STRING ➜ 6.98
299
- :style => 0x0293, # ●● STYLE ➜ 6.99
300
- :xf => 0x00e0, # ●● XF ➜ 6.115
301
- :sharedfmla => 0x04bc, # SHAREDFMLA ➜ 5.94
302
- ########################## Unhandled Opcodes ################################
303
- :extsst => 0x00ff, # ● EXTSST ➜ 6.40
304
- :index => 0x020b, # ○ INDEX ➜ 5.7 (Row Blocks), ➜ 6.55
305
- :uncalced => 0x005e, # ○ UNCALCED ➜ 6.104
306
- ########################## ○ Calculation Settings Block ➜ 5.3
307
- :calccount => 0x000c, # ○ CALCCOUNT ➜ 6.14
308
- :calcmode => 0x000d, # ○ CALCMODE ➜ 6.15
309
- :precision => 0x000e, # ○ PRECISION ➜ 6.74 (moved to Workbook Globals
310
- # Substream in BIFF5-BIFF8)
311
- :refmode => 0x000f, # ○ REFMODE ➜ 6.80
312
- :delta => 0x0010, # ○ DELTA ➜ 6.30
313
- :iteration => 0x0011, # ○ ITERATION ➜ 6.57
314
- :saverecalc => 0x005f, # ○ SAVERECALC ➜ 6.85 (BIFF3-BIFF8 only)
315
- ########################## ○ Workbook Protection Block ➜ 5.18
316
- :protect => 0x0012, # ○ PROTECT
317
- # Worksheet contents: 1 = protected (➜ 6.77)
318
- :windowprot => 0x0019, # ○ WINDOWPROTECT Window settings: 1 = protected
319
- # (BIFF4W only, ➜ 6.110)
320
- :objectprot => 0x0063, # ○ OBJECTPROTECT
321
- # Embedded objects: 1 = protected (➜ 6.69)
322
- :scenprotect => 0x00dd, # ○ SCENPROTECT
323
- # Scenarios: 1 = protected (BIFF5-BIFF8, ➜ 6.86)
324
- :password => 0x0013, # ○ PASSWORD Hash value of the password;
325
- # 0 = no password (➜ 6.72)
326
- ########################## ○ File Protection Block ➜ 5.19
327
- :writeprot => 0x0086, # ○ WRITEPROT File is write protected
328
- # (BIFF3-BIFF8, ➜ 6.112), password in FILESHARING
329
- :filepass => 0x002f, # ○ FILEPASS File is read/write-protected,
330
- # encryption information (➜ 6.41)
331
- :writeaccess => 0x005c, # ○ WRITEACCESS User name (BIFF3-BIFF8, ➜ 6.111)
332
- :filesharing => 0x005b, # ○ FILESHARING File sharing options
333
- # (BIFF3-BIFF8, ➜ 6.42)
334
- ########################## ○ Link Table ➜ 5.10.3
335
- # ●● SUPBOOK Block(s)
336
- # Settings for a referenced document
337
- :supbook => 0x01ae, # ● SUPBOOK ➜ 6.100
338
- :externname => 0x0223, # ○○ EXTERNNAME ➜ 6.38
339
- :xct => 0x0059, # ○○ ● XCT ➜ 6.114
340
- :crn => 0x005a, # ●● CRN ➜ 6.24
341
- :externsheet => 0x0017, # ● EXTERNSHEET ➜ 6.39
342
- :name => 0x0218, # ○○ NAME ➜ 6.66
343
- ##########################
344
- :window1 => 0x003d, # ● WINDOW1 ➜ 6.108 (has information on
345
- # which Spreadsheet is 'active')
346
- :backup => 0x0040, # ○ BACKUP ➜ 6.5
347
- :country => 0x008c, # ○ COUNTRY (Make writeable?) ➜ 6.23
348
- :hideobj => 0x008d, # ○ HIDEOBJ ➜ 6.52
349
- :palette => 0x0092, # ○ PALETTE ➜ 6.70
350
- :fngroupcnt => 0x009c, # ○ FNGROUPCOUNT
351
- :bookbool => 0x00da, # ○ BOOKBOOL ➜ 6.9
352
- :tabid => 0x013d, # ○ TABID
353
- :useselfs => 0x0160, # ○ USESELFS (Natural Language Formulas) ➜ 6.105
354
- :dsf => 0x0161, # ○ DSF (Double Stream File) ➜ 6.32
355
- :refreshall => 0x01b7, # ○ REFRESHALL
356
- ########################## ● Worksheet View Settings Block ➜ 5.5
357
- :window2 => 0x023e, # ● WINDOW2 ➜ 5.110
358
- :scl => 0x00a0, # ○ SCL ➜ 5.92 (BIFF4-BIFF8 only)
359
- :pane => 0x0041, # ○ PANE ➜ 5.75
360
- :selection => 0x001d, # ○○ SELECTION ➜ 5.93
361
- ########################## ○ Page Settings Block ➜ 5.4
362
- :hpagebreaks => 0x001b, # ○ HORIZONTALPAGEBREAKS ➜ 6.54
363
- :vpagebreaks => 0x001a, # ○ VERTICALPAGEBREAKS ➜ 6.107
364
- :header => 0x0014, # ○ HEADER ➜ 6.51
365
- :footer => 0x0015, # ○ FOOTER ➜ 6.44
366
- :hcenter => 0x0083, # ○ HCENTER ➜ 6.50 (BIFF3-BIFF8 only)
367
- :vcenter => 0x0084, # ○ VCENTER ➜ 6.106 (BIFF3-BIFF8 only)
368
- :leftmargin => 0x0026, # ○ LEFTMARGIN ➜ 6.62
369
- :rightmargin => 0x0027, # ○ RIGHTMARGIN ➜ 6.81
370
- :topmargin => 0x0028, # ○ TOPMARGIN ➜ 6.103
371
- :bottommargin => 0x0029, # ○ BOTTOMMARGIN ➜ 6.11
372
- # ○ PLS (opcode unknown)
373
- :pagesetup => 0x00a1, # ○ PAGESETUP ➜ 6.89 (BIFF4-BIFF8 only)
374
- :bitmap => 0x00e9, # ○ BITMAP ➜ 6.6 (Background-Bitmap, BIFF8 only)
375
- ##########################
376
- :printheaders => 0x002a, # ○ PRINTHEADERS ➜ 6.76
377
- :printgridlns => 0x002b, # ○ PRINTGRIDLINES ➜ 6.75
378
- :gridset => 0x0082, # ○ GRIDSET ➜ 6.48
379
- :guts => 0x0080, # ○ GUTS ➜ 6.49
380
- :defrowheight => 0x0225, # ○ DEFAULTROWHEIGHT ➜ 6.28
381
- :wsbool => 0x0081, # ○ WSBOOL ➜ 6.113
382
- :defcolwidth => 0x0055, # ○ DEFCOLWIDTH ➜ 6.29
383
- :sort => 0x0090, # ○ SORT ➜ 6.95
384
- :note => 0x001c,
385
- :obj => 0x005d,
386
- :drawing => 0x00EC,
387
- :txo => 0x01B6,
388
- }
389
- =begin ## unknown opcodes
390
- 0x00bf, 0x00c0, 0x00c1, 0x00e1, 0x00e2, 0x00eb, 0x01af, 0x01bc
391
- =end
392
- SEDOCPO = OPCODES.invert
393
- TWIPS = 20
394
- UNDERLINE_TYPES = {
395
- 0x0001 => :single,
396
- 0x0002 => :double,
397
- 0x0021 => :single_accounting,
398
- 0x0022 => :double_accounting,
399
- }
400
- SEPYT_ENILREDNU = UNDERLINE_TYPES.invert
401
- XF_H_ALIGN = {
402
- :default => 0,
403
- :left => 1,
404
- :center => 2,
405
- :right => 3,
406
- :fill => 4,
407
- :justify => 5,
408
- :merge => 6,
409
- :distributed => 7,
410
- }
411
- NGILA_H_FX = XF_H_ALIGN.invert
412
- XF_TEXT_DIRECTION = {
413
- :context => 0,
414
- :left_to_right => 1,
415
- :right_to_left => 2,
416
- }
417
- NOITCERID_TXET_FX = XF_TEXT_DIRECTION.invert
418
- XF_V_ALIGN = {
419
- :top => 0,
420
- :middle => 1,
421
- :bottom => 2,
422
- :justify => 3,
423
- :distributed => 4,
424
- }
425
- NGILA_V_FX = XF_V_ALIGN.invert
426
- # border line styles taken from http://www.openoffice.org/sc/excelfileformat.pdf
427
- XF_BORDER_LINE_STYLES = {
428
- 0x00 => :none,
429
- 0x01 => :thin,
430
- 0x02 => :medium,
431
- 0x03 => :dashed,
432
- 0x04 => :dotted,
433
- 0x05 => :thick,
434
- 0x06 => :double,
435
- 0x07 => :hair,
436
- # the following are only valid for BIFF8 and higher:
437
- 0x08 => :medium_dashed,
438
- 0x09 => :thin_dash_dotted,
439
- 0x0a => :medium_dash_dotted,
440
- 0x0b => :thin_dash_dot_dotted,
441
- 0x0c => :medium_dash_dot_dotted,
442
- 0x0d => :slanted_medium_dash_dotted
443
- }
444
- # ensure reader always gets a valid line style
445
- XF_BORDER_LINE_STYLES.default = :none
446
- SELYTS_ENIL_REDROB_FX = XF_BORDER_LINE_STYLES.invert
447
- SELYTS_ENIL_REDROB_FX.default = 0x00
448
- OPCODE_SIZE = 4
449
- ROW_HEIGHT = 12.1
450
- SST_CHUNKSIZE = 20
451
- def binfmt key
452
- BINARY_FORMATS[key]
453
- end
454
- def opcode key
455
- OPCODES[key]
456
- end
457
- end
158
+ BINARY_FORMATS = {
159
+ blank: "v3",
160
+ boolerr: "v3C2",
161
+ colinfo: "v5x2",
162
+ font: "v5C3x",
163
+ labelsst: "v3V",
164
+ number: "v3#{EIGHT_BYTE_DOUBLE}",
165
+ pagesetup: "v8#{EIGHT_BYTE_DOUBLE}2v",
166
+ margin: EIGHT_BYTE_DOUBLE.to_s,
167
+ rk: "v3V",
168
+ row: "v4x4V",
169
+ window2: "v4x2v2x4",
170
+ xf: "v3C4V2v"
171
+ }
172
+ # From BIFF5 on, the built-in number formats will be omitted. The built-in
173
+ # formats are dependent on the current regional settings of the operating
174
+ # system. The following table shows which number formats are used by
175
+ # default in a US-English environment. All indexes from 0 to 163 are
176
+ # reserved for built-in formats.
177
+ BUILTIN_FORMATS = { # TODO: locale support
178
+ 0 => "GENERAL",
179
+ 1 => "0",
180
+ 2 => "0.00",
181
+ 3 => "#,##0",
182
+ 4 => "#,##0.00",
183
+ 5 => '"$"#,##0_);("$"#,##0)',
184
+ 6 => '"$"#,##0_);[Red]("$"#,##0)',
185
+ 7 => '"$"#,##0.00_);("$"#,##0.00)',
186
+ 8 => '"$"#,##0.00_);[Red]("$"#,##0.00)',
187
+ 9 => "0%",
188
+ 10 => "0.00%",
189
+ 11 => "0.00E+00",
190
+ 12 => "# ?/?",
191
+ 13 => "# ??/??",
192
+ 14 => "M/D/YY",
193
+ 15 => "D-MMM-YY",
194
+ 16 => "D-MMM",
195
+ 17 => "MMM-YY",
196
+ 18 => "h:mm AM/PM",
197
+ 19 => "h:mm:ss AM/PM",
198
+ 20 => "h:mm",
199
+ 21 => "h:mm:ss",
200
+ 22 => "M/D/YY h:mm",
201
+ 37 => "_(#,##0_);(#,##0)",
202
+ 38 => "_(#,##0_);[Red](#,##0)",
203
+ 39 => "_(#,##0.00_);(#,##0.00)",
204
+ 40 => "_(#,##0.00_);[Red](#,##0.00)",
205
+ 41 => '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
206
+ 42 => '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
207
+ 43 => '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
208
+ 44 => '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
209
+ 45 => "mm:ss",
210
+ 46 => "[h]:mm:ss",
211
+ 47 => "mm:ss.0",
212
+ 48 => "##0.0E+0",
213
+ 49 => "@"
214
+ }
215
+ BUILTIN_STYLES = {
216
+ 0x00 => "Normal",
217
+ 0x01 => "RowLevel_lv",
218
+ 0x02 => "ColLevel_lv",
219
+ 0x03 => "Comma",
220
+ 0x04 => "Currency",
221
+ 0x05 => "Percent",
222
+ 0x06 => "Comma",
223
+ 0x07 => "Currency",
224
+ 0x08 => "Hyperlink",
225
+ 0x09 => "Followed Hyperlink"
226
+ }
227
+ ESCAPEMENT_TYPES = {
228
+ 0x0001 => :superscript,
229
+ 0x0002 => :subscript
230
+ }
231
+ SEPYT_TNEMEPACSE = ESCAPEMENT_TYPES.invert
232
+ FONT_ENCODINGS = {
233
+ 0x00 => :iso_latin1,
234
+ 0x01 => :default,
235
+ 0x02 => :symbol,
236
+ 0x4d => :apple_roman,
237
+ 0x80 => :shift_jis,
238
+ 0x81 => :korean_hangul,
239
+ 0x82 => :korean_johab,
240
+ 0x86 => :chinese_simplified,
241
+ 0x88 => :chinese_traditional,
242
+ 0xa1 => :greek,
243
+ 0xa2 => :turkish,
244
+ 0xa3 => :vietnamese,
245
+ 0xb1 => :hebrew,
246
+ 0xb2 => :arabic,
247
+ 0xba => :baltic,
248
+ 0xcc => :cyrillic,
249
+ 0xde => :thai,
250
+ 0xee => :iso_latin2,
251
+ 0xff => :oem_latin1
252
+ }
253
+ SGNIDOCNE_TNOF = FONT_ENCODINGS.invert
254
+ FONT_FAMILIES = {
255
+ 0x01 => :roman,
256
+ 0x02 => :swiss,
257
+ 0x03 => :modern,
258
+ 0x04 => :script,
259
+ 0x05 => :decorative
260
+ }
261
+ SEILIMAF_TNOF = FONT_FAMILIES.invert
262
+ FONT_WEIGHTS = {
263
+ bold: 700,
264
+ normal: 400
265
+ }
266
+ WORKSHEET_VISIBILITIES = {
267
+ 0x00 => :visible,
268
+ 0x01 => :hidden,
269
+ 0x02 => :strong_hidden
270
+ }
271
+ SEITILIBISIV_TEEHSKROW = WORKSHEET_VISIBILITIES.invert
272
+ LEAP_ERROR = Date.new 1900, 2, 28
273
+ OPCODES = {
274
+ blank: 0x0201, # BLANK ➜ 6.7
275
+ boolerr: 0x0205, # BOOLERR ➜ 6.10
276
+ boundsheet: 0x0085, # ●● BOUNDSHEET ➜ 6.12
277
+ codepage: 0x0042, # ○ CODEPAGE ➜ 6.17
278
+ colinfo: 0x007d, # ○○ COLINFO ➜ 6.18
279
+ continue: 0x003c, # ○ CONTINUE ➜ 6.22
280
+ datemode: 0x0022, # ○ DATEMODE ➜ 6.25
281
+ dbcell: 0x0a0b, # ○ DBCELL
282
+ dimensions: 0x0200, # ● DIMENSIONS ➜ 6.31
283
+ eof: 0x000a, # ● EOF ➜ 6.36
284
+ font: 0x0031, # ●● FONT ➜ 6.43
285
+ format: 0x041e, # ○○ FORMAT (Number Format) ➜ 6.45
286
+ formula: 0x0006, # FORMULA ➜ 6.46
287
+ hlink: 0x01b8, # HLINK ➜ 6.52 (BIFF8 only)
288
+ label: 0x0204, # LABEL ➜ 6.59 (BIFF2-BIFF7)
289
+ labelsst: 0x00fd, # LABELSST ➜ 6.61 (BIFF8 only)
290
+ mergedcells: 0x00e5, # ○○ MERGEDCELLS ➜ 5.67 (BIFF8 only)
291
+ mulblank: 0x00be, # MULBLANK ➜ 6.64 (BIFF5-BIFF8)
292
+ mulrk: 0x00bd, # MULRK ➜ 6.65 (BIFF5-BIFF8)
293
+ number: 0x0203, # NUMBER ➜ 6.68
294
+ rk: 0x027e, # RK ➜ 6.82 (BIFF3-BIFF8)
295
+ row: 0x0208, # ● ROW ➜ 6.83
296
+ rstring: 0x00d6, # RSTRING ➜ 6.84 (BIFF5/BIFF7)
297
+ sst: 0x00fc, # ● SST ➜ 6.96
298
+ string: 0x0207, # STRING ➜ 6.98
299
+ style: 0x0293, # ●● STYLE ➜ 6.99
300
+ xf: 0x00e0, # ●● XF ➜ 6.115
301
+ sharedfmla: 0x04bc, # SHAREDFMLA ➜ 5.94
302
+ ########################## Unhandled Opcodes ################################
303
+ extsst: 0x00ff, # ● EXTSST ➜ 6.40
304
+ index: 0x020b, # ○ INDEX ➜ 5.7 (Row Blocks), ➜ 6.55
305
+ uncalced: 0x005e, # ○ UNCALCED ➜ 6.104
306
+ ########################## ○ Calculation Settings Block ➜ 5.3
307
+ calccount: 0x000c, # ○ CALCCOUNT ➜ 6.14
308
+ calcmode: 0x000d, # ○ CALCMODE ➜ 6.15
309
+ precision: 0x000e, # ○ PRECISION ➜ 6.74 (moved to Workbook Globals
310
+ # Substream in BIFF5-BIFF8)
311
+ refmode: 0x000f, # ○ REFMODE ➜ 6.80
312
+ delta: 0x0010, # ○ DELTA ➜ 6.30
313
+ iteration: 0x0011, # ○ ITERATION ➜ 6.57
314
+ saverecalc: 0x005f, # ○ SAVERECALC ➜ 6.85 (BIFF3-BIFF8 only)
315
+ ########################## ○ Workbook Protection Block ➜ 5.18
316
+ protect: 0x0012, # ○ PROTECT
317
+ # Worksheet contents: 1 = protected (➜ 6.77)
318
+ windowprot: 0x0019, # ○ WINDOWPROTECT Window settings: 1 = protected
319
+ # (BIFF4W only, ➜ 6.110)
320
+ objectprot: 0x0063, # ○ OBJECTPROTECT
321
+ # Embedded objects: 1 = protected (➜ 6.69)
322
+ scenprotect: 0x00dd, # ○ SCENPROTECT
323
+ # Scenarios: 1 = protected (BIFF5-BIFF8, ➜ 6.86)
324
+ password: 0x0013, # ○ PASSWORD Hash value of the password;
325
+ # 0 = no password (➜ 6.72)
326
+ ########################## ○ File Protection Block ➜ 5.19
327
+ writeprot: 0x0086, # ○ WRITEPROT File is write protected
328
+ # (BIFF3-BIFF8, ➜ 6.112), password in FILESHARING
329
+ filepass: 0x002f, # ○ FILEPASS File is read/write-protected,
330
+ # encryption information (➜ 6.41)
331
+ writeaccess: 0x005c, # ○ WRITEACCESS User name (BIFF3-BIFF8, ➜ 6.111)
332
+ filesharing: 0x005b, # ○ FILESHARING File sharing options
333
+ # (BIFF3-BIFF8, ➜ 6.42)
334
+ ########################## ○ Link Table ➜ 5.10.3
335
+ # ●● SUPBOOK Block(s)
336
+ # Settings for a referenced document
337
+ supbook: 0x01ae, # ● SUPBOOK ➜ 6.100
338
+ externname: 0x0223, # ○○ EXTERNNAME ➜ 6.38
339
+ xct: 0x0059, # ○○ ● XCT ➜ 6.114
340
+ crn: 0x005a, # ●● CRN ➜ 6.24
341
+ externsheet: 0x0017, # ● EXTERNSHEET ➜ 6.39
342
+ name: 0x0218, # ○○ NAME ➜ 6.66
343
+ ##########################
344
+ window1: 0x003d, # ● WINDOW1 ➜ 6.108 (has information on
345
+ # which Spreadsheet is 'active')
346
+ backup: 0x0040, # ○ BACKUP ➜ 6.5
347
+ country: 0x008c, # ○ COUNTRY (Make writeable?) ➜ 6.23
348
+ hideobj: 0x008d, # ○ HIDEOBJ ➜ 6.52
349
+ palette: 0x0092, # ○ PALETTE ➜ 6.70
350
+ fngroupcnt: 0x009c, # ○ FNGROUPCOUNT
351
+ bookbool: 0x00da, # ○ BOOKBOOL ➜ 6.9
352
+ tabid: 0x013d, # ○ TABID
353
+ useselfs: 0x0160, # ○ USESELFS (Natural Language Formulas) ➜ 6.105
354
+ dsf: 0x0161, # ○ DSF (Double Stream File) ➜ 6.32
355
+ refreshall: 0x01b7, # ○ REFRESHALL
356
+ ########################## ● Worksheet View Settings Block ➜ 5.5
357
+ window2: 0x023e, # ● WINDOW2 ➜ 5.110
358
+ scl: 0x00a0, # ○ SCL ➜ 5.92 (BIFF4-BIFF8 only)
359
+ pane: 0x0041, # ○ PANE ➜ 5.75
360
+ selection: 0x001d, # ○○ SELECTION ➜ 5.93
361
+ ########################## ○ Page Settings Block ➜ 5.4
362
+ hpagebreaks: 0x001b, # ○ HORIZONTALPAGEBREAKS ➜ 6.54
363
+ vpagebreaks: 0x001a, # ○ VERTICALPAGEBREAKS ➜ 6.107
364
+ header: 0x0014, # ○ HEADER ➜ 6.51
365
+ footer: 0x0015, # ○ FOOTER ➜ 6.44
366
+ hcenter: 0x0083, # ○ HCENTER ➜ 6.50 (BIFF3-BIFF8 only)
367
+ vcenter: 0x0084, # ○ VCENTER ➜ 6.106 (BIFF3-BIFF8 only)
368
+ leftmargin: 0x0026, # ○ LEFTMARGIN ➜ 6.62
369
+ rightmargin: 0x0027, # ○ RIGHTMARGIN ➜ 6.81
370
+ topmargin: 0x0028, # ○ TOPMARGIN ➜ 6.103
371
+ bottommargin: 0x0029, # ○ BOTTOMMARGIN ➜ 6.11
372
+ # ○ PLS (opcode unknown)
373
+ pagesetup: 0x00a1, # ○ PAGESETUP ➜ 6.89 (BIFF4-BIFF8 only)
374
+ bitmap: 0x00e9, # ○ BITMAP ➜ 6.6 (Background-Bitmap, BIFF8 only)
375
+ ##########################
376
+ printheaders: 0x002a, # ○ PRINTHEADERS ➜ 6.76
377
+ printgridlns: 0x002b, # ○ PRINTGRIDLINES ➜ 6.75
378
+ gridset: 0x0082, # ○ GRIDSET ➜ 6.48
379
+ guts: 0x0080, # ○ GUTS ➜ 6.49
380
+ defrowheight: 0x0225, # ○ DEFAULTROWHEIGHT ➜ 6.28
381
+ wsbool: 0x0081, # ○ WSBOOL ➜ 6.113
382
+ defcolwidth: 0x0055, # ○ DEFCOLWIDTH ➜ 6.29
383
+ sort: 0x0090, # ○ SORT ➜ 6.95
384
+ note: 0x001c,
385
+ obj: 0x005d,
386
+ drawing: 0x00EC,
387
+ txo: 0x01B6
388
+ }
389
+ # ## unknown opcodes
390
+ # 0x00bf, 0x00c0, 0x00c1, 0x00e1, 0x00e2, 0x00eb, 0x01af, 0x01bc
391
+ SEDOCPO = OPCODES.invert
392
+ TWIPS = 20
393
+ UNDERLINE_TYPES = {
394
+ 0x0001 => :single,
395
+ 0x0002 => :double,
396
+ 0x0021 => :single_accounting,
397
+ 0x0022 => :double_accounting
398
+ }
399
+ SEPYT_ENILREDNU = UNDERLINE_TYPES.invert
400
+ XF_H_ALIGN = {
401
+ default: 0,
402
+ left: 1,
403
+ center: 2,
404
+ right: 3,
405
+ fill: 4,
406
+ justify: 5,
407
+ merge: 6,
408
+ distributed: 7
409
+ }
410
+ NGILA_H_FX = XF_H_ALIGN.invert
411
+ XF_TEXT_DIRECTION = {
412
+ context: 0,
413
+ left_to_right: 1,
414
+ right_to_left: 2
415
+ }
416
+ NOITCERID_TXET_FX = XF_TEXT_DIRECTION.invert
417
+ XF_V_ALIGN = {
418
+ top: 0,
419
+ middle: 1,
420
+ bottom: 2,
421
+ justify: 3,
422
+ distributed: 4
423
+ }
424
+ NGILA_V_FX = XF_V_ALIGN.invert
425
+ # border line styles taken from http://www.openoffice.org/sc/excelfileformat.pdf
426
+ XF_BORDER_LINE_STYLES = {
427
+ 0x00 => :none,
428
+ 0x01 => :thin,
429
+ 0x02 => :medium,
430
+ 0x03 => :dashed,
431
+ 0x04 => :dotted,
432
+ 0x05 => :thick,
433
+ 0x06 => :double,
434
+ 0x07 => :hair,
435
+ # the following are only valid for BIFF8 and higher:
436
+ 0x08 => :medium_dashed,
437
+ 0x09 => :thin_dash_dotted,
438
+ 0x0a => :medium_dash_dotted,
439
+ 0x0b => :thin_dash_dot_dotted,
440
+ 0x0c => :medium_dash_dot_dotted,
441
+ 0x0d => :slanted_medium_dash_dotted
442
+ }
443
+ # ensure reader always gets a valid line style
444
+ XF_BORDER_LINE_STYLES.default = :none
445
+ SELYTS_ENIL_REDROB_FX = XF_BORDER_LINE_STYLES.invert
446
+ SELYTS_ENIL_REDROB_FX.default = 0x00
447
+ OPCODE_SIZE = 4
448
+ ROW_HEIGHT = 12.1
449
+ SST_CHUNKSIZE = 20
450
+ def binfmt key
451
+ BINARY_FORMATS[key]
452
+ end
453
+
454
+ def opcode key
455
+ OPCODES[key]
456
+ end
457
+ end
458
458
  end
459
459
  end