rubyXL 1.2.10 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/Gemfile +14 -10
  2. data/Gemfile.lock +80 -21
  3. data/LICENSE.txt +1 -1
  4. data/README.rdoc +88 -82
  5. data/Rakefile +7 -2
  6. data/VERSION +1 -1
  7. data/lib/rubyXL.rb +13 -7
  8. data/lib/rubyXL/cell.rb +108 -268
  9. data/lib/rubyXL/generic_storage.rb +40 -0
  10. data/lib/rubyXL/objects/border.rb +66 -0
  11. data/lib/rubyXL/objects/calculation_chain.rb +28 -0
  12. data/lib/rubyXL/objects/cell_style.rb +75 -0
  13. data/lib/rubyXL/objects/color.rb +25 -0
  14. data/lib/rubyXL/objects/column_range.rb +74 -0
  15. data/lib/rubyXL/objects/container_nodes.rb +122 -0
  16. data/lib/rubyXL/objects/data_validation.rb +43 -0
  17. data/lib/rubyXL/objects/document_properties.rb +76 -0
  18. data/lib/rubyXL/objects/extensions.rb +36 -0
  19. data/lib/rubyXL/objects/fill.rb +57 -0
  20. data/lib/rubyXL/objects/font.rb +111 -0
  21. data/lib/rubyXL/objects/formula.rb +24 -0
  22. data/lib/rubyXL/objects/ooxml_object.rb +295 -0
  23. data/lib/rubyXL/objects/reference.rb +110 -0
  24. data/lib/rubyXL/objects/relationships.rb +59 -0
  25. data/lib/rubyXL/objects/shared_strings.rb +57 -0
  26. data/lib/rubyXL/objects/sheet_data.rb +149 -0
  27. data/lib/rubyXL/objects/sheet_view.rb +71 -0
  28. data/lib/rubyXL/objects/stylesheet.rb +200 -0
  29. data/lib/rubyXL/objects/text.rb +87 -0
  30. data/lib/rubyXL/objects/theme.rb +64 -0
  31. data/lib/rubyXL/objects/workbook.rb +233 -0
  32. data/lib/rubyXL/objects/worksheet.rb +485 -0
  33. data/lib/rubyXL/parser.rb +78 -442
  34. data/lib/rubyXL/workbook.rb +216 -385
  35. data/lib/rubyXL/worksheet.rb +509 -1062
  36. data/lib/rubyXL/writer/content_types_writer.rb +104 -68
  37. data/lib/rubyXL/writer/core_writer.rb +26 -43
  38. data/lib/rubyXL/writer/generic_writer.rb +43 -0
  39. data/lib/rubyXL/writer/root_rels_writer.rb +11 -19
  40. data/lib/rubyXL/writer/styles_writer.rb +6 -398
  41. data/lib/rubyXL/writer/theme_writer.rb +321 -327
  42. data/lib/rubyXL/writer/workbook_writer.rb +63 -67
  43. data/lib/rubyXL/writer/worksheet_writer.rb +29 -218
  44. data/rdoc/created.rid +39 -0
  45. data/rdoc/fonts.css +167 -0
  46. data/rdoc/fonts/Lato-Light.ttf +0 -0
  47. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  48. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  49. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/rdoc/images/add.png +0 -0
  53. data/rdoc/images/arrow_up.png +0 -0
  54. data/rdoc/images/brick.png +0 -0
  55. data/rdoc/images/brick_link.png +0 -0
  56. data/rdoc/images/bug.png +0 -0
  57. data/rdoc/images/bullet_black.png +0 -0
  58. data/rdoc/images/bullet_toggle_minus.png +0 -0
  59. data/rdoc/images/bullet_toggle_plus.png +0 -0
  60. data/rdoc/images/date.png +0 -0
  61. data/rdoc/images/delete.png +0 -0
  62. data/rdoc/images/find.png +0 -0
  63. data/rdoc/images/loadingAnimation.gif +0 -0
  64. data/rdoc/images/macFFBgHack.png +0 -0
  65. data/rdoc/images/package.png +0 -0
  66. data/rdoc/images/page_green.png +0 -0
  67. data/rdoc/images/page_white_text.png +0 -0
  68. data/rdoc/images/page_white_width.png +0 -0
  69. data/rdoc/images/plugin.png +0 -0
  70. data/rdoc/images/ruby.png +0 -0
  71. data/rdoc/images/tag_blue.png +0 -0
  72. data/rdoc/images/tag_green.png +0 -0
  73. data/rdoc/images/transparent.png +0 -0
  74. data/rdoc/images/wrench.png +0 -0
  75. data/rdoc/images/wrench_orange.png +0 -0
  76. data/rdoc/images/zoom.png +0 -0
  77. data/rdoc/js/darkfish.js +140 -0
  78. data/rdoc/js/jquery.js +18 -0
  79. data/rdoc/js/navigation.js +142 -0
  80. data/rdoc/js/search.js +109 -0
  81. data/rdoc/js/search_index.js +1 -0
  82. data/rdoc/js/searcher.js +228 -0
  83. data/rdoc/rdoc.css +580 -0
  84. data/rubyXL.gemspec +90 -34
  85. data/spec/lib/cell_spec.rb +29 -59
  86. data/spec/lib/parser_spec.rb +35 -19
  87. data/spec/lib/reference_spec.rb +29 -0
  88. data/spec/lib/stylesheet_spec.rb +29 -0
  89. data/spec/lib/workbook_spec.rb +22 -17
  90. data/spec/lib/worksheet_spec.rb +47 -202
  91. metadata +185 -148
  92. data/lib/.DS_Store +0 -0
  93. data/lib/rubyXL/Hash.rb +0 -60
  94. data/lib/rubyXL/color.rb +0 -14
  95. data/lib/rubyXL/private_class.rb +0 -265
  96. data/lib/rubyXL/writer/app_writer.rb +0 -62
  97. data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
  98. data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
  99. data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
  100. data/lib/rubyXL/zip.rb +0 -20
  101. data/spec/lib/hash_spec.rb +0 -28
data/lib/rubyXL/cell.rb CHANGED
@@ -1,209 +1,115 @@
1
1
  module RubyXL
2
- class Cell < PrivateClass
3
-
4
- attr_accessor :row, :column, :datatype, :style_index, :formula, :worksheet
5
- attr_reader :workbook,:formula_attributes
6
-
7
- def initialize(worksheet,row,column,value=nil,formula=nil,datatype='s',style_index=0, fmla_attr={})
8
- @worksheet = worksheet
9
-
10
- @workbook = worksheet.workbook
11
- @row = row
12
- @column = column
13
- @datatype = datatype
14
- @value = value
15
- @formula=formula
16
- @style_index = style_index
17
- @formula_attributes = fmla_attr
18
- end
19
-
20
- def value(args = {})
21
- raw_values = args.delete(:raw) || false
22
- return @value if raw_values
23
-
24
- if is_date?
25
- return @workbook.num_to_date(@value)
26
- else
27
- return @value
28
- end
2
+ module LegacyCell
3
+ SHARED_STRING = 's'
4
+ RAW_STRING = 'str'
5
+ ERROR = 'e'
6
+
7
+ attr_accessor :formula, :worksheet
8
+
9
+ def workbook
10
+ @worksheet.workbook
29
11
  end
30
12
 
31
13
  def is_date?
32
- if !@value.is_a?(String)
33
- if @workbook.num_fmts_by_id
34
- num_fmt_id = xf_id()[:numFmtId]
35
- tmp_num_fmt = @workbook.num_fmts_by_id[num_fmt_id]
36
- num_fmt = (tmp_num_fmt &&tmp_num_fmt[:attributes] && tmp_num_fmt[:attributes][:formatCode]) ? tmp_num_fmt[:attributes][:formatCode] : nil
37
- if num_fmt && workbook.date_num_fmt?(num_fmt)
38
- return true
39
- end
40
- end
41
- end
42
- return false
43
- end
44
-
45
- def is_date_format?(num_fmt)
46
- skip_chars = ['$', '-', '+', '/', '(', ')', ':', ' ']
47
- num_chars = ['0', '#', '?']
48
- non_date_formats = ['0.00E+00', '##0.0E+0', 'General', 'GENERAL', 'general', '@']
49
- date_chars = ['y','m','d','h','s']
50
-
51
- state = 0
52
- s = ''
53
- num_fmt.split(//).each do |c|
54
- if state == 0
55
- if c == '"'
56
- state = 1
57
- elsif ['\\', '_', '*'].include?(c)
58
- state = 2
59
- elsif skip_chars.include?(c)
60
- next
61
- else
62
- s << c
63
- end
64
- elsif state == 1
65
- if c == '"'
66
- state = 0
67
- end
68
- elsif state == 2
69
- state = 0
70
- end
71
- end
72
- s.gsub!(/\[[^\]]*\]/, '')
73
- if non_date_formats.include?(s)
74
- return false
75
- end
76
- separator = ';'
77
- got_sep = 0
78
- date_count = 0
79
- num_count = 0
80
- s.split(//).each do |c|
81
- if date_chars.include?(c)
82
- date_count += 1
83
- elsif num_chars.include?(c)
84
- num_count += 1
85
- elsif c == separator
86
- got_sep = 1
87
- end
88
- end
89
- if date_count > 0 && num_count == 0
90
- return true
91
- elsif num_count > 0 && date_count == 0
92
- return false
93
- elsif date_count
94
- # ambiguous result
95
- elsif got_sep == 0
96
- # constant result
97
- end
98
- return date_count > num_count
14
+ return false unless raw_value =~ /^\d+$/ # Only fully numeric values can be dates
15
+ num_fmt = get_number_format
16
+ num_fmt && num_fmt.is_date_format?
99
17
  end
100
18
 
101
19
  # changes fill color of cell
102
20
  def change_fill(rgb='ffffff')
103
21
  validate_worksheet
104
22
  Color.validate_color(rgb)
105
- @style_index = modify_fill(@workbook, @style_index,rgb)
23
+ self.style_index = workbook.modify_fill(self.style_index,rgb)
106
24
  end
107
25
 
108
26
  # Changes font name of cell
109
- def change_font_name(font_name='Verdana')
27
+ def change_font_name(new_font_name = 'Verdana')
110
28
  validate_worksheet
111
- # Get copy of font object with modified name
112
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
113
- font[:name][:attributes][:val] = font_name.to_s
114
- # Update font and xf array
115
- change_font(font)
29
+
30
+ font = get_cell_font.dup
31
+ font.set_name(new_font_name)
32
+ update_font_references(font)
116
33
  end
117
34
 
118
35
  # Changes font size of cell
119
36
  def change_font_size(font_size=10)
120
37
  validate_worksheet
121
- if font_size.is_a?(Integer) || font_size.is_a?(Float)
122
- # Get copy of font object with modified size
123
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
124
- font[:sz][:attributes][:val] = font_size
125
- # Update font and xf array
126
- change_font(font)
127
- else
128
- raise 'Argument must be a number'
129
- end
38
+ raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
39
+
40
+ font = get_cell_font.dup
41
+ font.set_size(font_size)
42
+ update_font_references(font)
130
43
  end
131
44
 
132
45
  # Changes font color of cell
133
46
  def change_font_color(font_color='000000')
134
47
  validate_worksheet
135
- #if arg is a color name, convert to integer
136
48
  Color.validate_color(font_color)
137
- # Get copy of font object with modified color
138
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
139
- font = modify_font_color(font, font_color.to_s)
140
- # Update font and xf array
141
- change_font(font)
49
+
50
+ font = get_cell_font.dup
51
+ font.set_rgb_color(font_color)
52
+ update_font_references(font)
142
53
  end
143
54
 
144
55
  # Changes font italics settings of cell
145
56
  def change_font_italics(italicized=false)
146
57
  validate_worksheet
147
- # Get copy of font object with modified italics settings
148
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
149
- font = modify_font_italics(font, italicized)
150
- # Update font and xf array
151
- change_font(font)
58
+
59
+ font = get_cell_font.dup
60
+ font.set_italic(italicized)
61
+ update_font_references(font)
152
62
  end
153
63
 
154
64
  # Changes font bold settings of cell
155
65
  def change_font_bold(bolded=false)
156
66
  validate_worksheet
157
- # Get copy of font object with modified bold settings
158
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
159
- font = modify_font_bold(font, bolded)
160
- # Update font and xf array
161
- change_font(font)
67
+
68
+ font = get_cell_font.dup
69
+ font.set_bold(bolded)
70
+ update_font_references(font)
162
71
  end
163
72
 
164
73
  # Changes font underline settings of cell
165
74
  def change_font_underline(underlined=false)
166
75
  validate_worksheet
167
- # Get copy of font object with modified underline settings
168
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
169
- font = modify_font_underline(font, underlined)
170
- # Update font and xf array
171
- change_font(font)
76
+
77
+ font = get_cell_font.dup
78
+ font.set_underline(underlined)
79
+ update_font_references(font)
172
80
  end
173
81
 
174
- # Changes font strikethrough settings of cell
175
82
  def change_font_strikethrough(struckthrough=false)
176
83
  validate_worksheet
177
- # Get copy of font object with modified strikethrough settings
178
- font = deep_copy(workbook.fonts[font_id().to_s][:font])
179
- font = modify_font_strikethrough(font, struckthrough)
180
- # Update font and xf array
181
- change_font(font)
84
+
85
+ font = get_cell_font.dup
86
+ font.set_strikethrough(struckthrough)
87
+ update_font_references(font)
182
88
  end
183
89
 
184
90
  # Helper method to update the font array and xf array
185
- def change_font(font)
186
- # Modify font array and retrieve new font id
187
- font_id = modify_font(@workbook, font, font_id())
188
- # Get copy of xf object with modified font id
189
- xf = deep_copy(xf_id())
190
- xf[:fontId] = Integer(font_id.to_i)
191
- # Modify xf array and retrieve new xf id
192
- @style_index = modify_xf(@workbook, xf)
91
+ def update_font_references(modified_font)
92
+ xf = workbook.register_new_font(modified_font, get_cell_xf)
93
+ self.style_index = workbook.register_new_xf(xf, self.style_index)
193
94
  end
95
+ private :update_font_references
194
96
 
195
97
  # changes horizontal alignment of cell
196
98
  def change_horizontal_alignment(alignment='center')
197
99
  validate_worksheet
198
- validate_horizontal_alignment(alignment)
199
- @style_index = modify_alignment(@workbook,@style_index,true,alignment)
100
+ self.style_index = workbook.modify_alignment(self.style_index, true, alignment)
200
101
  end
201
102
 
202
103
  # changes vertical alignment of cell
203
104
  def change_vertical_alignment(alignment='center')
204
105
  validate_worksheet
205
- validate_vertical_alignment(alignment)
206
- @style_index = modify_alignment(@workbook,@style_index,false,alignment)
106
+ self.style_index = workbook.modify_alignment(self.style_index, false, alignment)
107
+ end
108
+
109
+ # changes wrap of cell
110
+ def change_text_wrap(wrap=false)
111
+ validate_worksheet
112
+ self.style_index = workbook.modify_text_wrap(self.style_index, wrap)
207
113
  end
208
114
 
209
115
  # changes top border of cell
@@ -234,106 +140,82 @@ module RubyXL
234
140
  # changes contents of cell, with formula option
235
141
  def change_contents(data, formula=nil)
236
142
  validate_worksheet
237
- @datatype='str'
238
- if data.is_a?(Date) || data.is_a?(DateTime)
239
- data = @workbook.date_to_num(data)
240
- end
241
- if (data.is_a?Integer) || (data.is_a?Float)
242
- @datatype = ''
143
+ self.datatype = RAW_STRING
144
+
145
+ case data
146
+ when Date then data = workbook.date_to_num(data)
147
+ when Integer, Float then self.datatype = ''
243
148
  end
244
- @value=data
245
- @formula=formula
149
+
150
+ self.raw_value = data
151
+ @formula = formula
246
152
  end
247
153
 
248
154
  # returns if font is italicized
249
155
  def is_italicized()
250
156
  validate_worksheet
251
- if @workbook.fonts[font_id()][:font][:i].nil?
252
- false
253
- else
254
- true
255
- end
157
+ get_cell_font.is_italic
256
158
  end
257
159
 
258
160
  # returns if font is bolded
259
161
  def is_bolded()
260
162
  validate_worksheet
261
- if @workbook.fonts[font_id()][:font][:b].nil?
262
- false
263
- else
264
- true
265
- end
163
+ get_cell_font.is_bold
266
164
  end
267
165
 
268
- # returns if font is underlined
269
166
  def is_underlined()
270
167
  validate_worksheet
271
- xf = @workbook.get_style_attributes(@workbook.get_style(@style_index))
272
- if @workbook.fonts[font_id()][:font][:u].nil?
273
- false
274
- else
275
- true
276
- end
168
+ get_cell_font.is_underlined
277
169
  end
278
170
 
279
- # returns if font has a strike through it
280
171
  def is_struckthrough()
281
172
  validate_worksheet
282
- xf = @workbook.get_style_attributes(@workbook.get_style(@style_index))
283
- if @workbook.fonts[font_id()][:font][:strike].nil?
284
- false
285
- else
286
- true
287
- end
173
+ get_cell_font.is_strikethrough
288
174
  end
289
175
 
290
- # returns cell's font name
291
176
  def font_name()
292
177
  validate_worksheet
293
- @workbook.fonts[font_id()][:font][:name][:attributes][:val]
178
+ get_cell_font.get_name
294
179
  end
295
180
 
296
- # returns cell's font size
297
181
  def font_size()
298
182
  validate_worksheet
299
- return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]
183
+ get_cell_font.get_size
300
184
  end
301
185
 
302
- # returns cell's font color
303
186
  def font_color()
304
187
  validate_worksheet
305
- if @workbook.fonts[font_id()][:font][:color].nil?
306
- '000000' #black
307
- else
308
- @workbook.fonts[font_id()][:font][:color][:attributes][:rgb]
309
- end
188
+ get_cell_font.get_rgb_color || '000000'
310
189
  end
311
190
 
312
191
  # returns cell's fill color
313
192
  def fill_color()
314
193
  validate_worksheet
315
- xf = @workbook.get_style_attributes(@workbook.get_style(@style_index))
316
- return @workbook.get_fill_color(xf)
194
+ return workbook.get_fill_color(get_cell_xf)
317
195
  end
318
196
 
319
197
  # returns cell's horizontal alignment
320
198
  def horizontal_alignment()
321
199
  validate_worksheet
322
- xf_obj = @workbook.get_style(@style_index)
323
- if xf_obj[:alignment].nil? || xf_obj[:alignment][:attributes].nil?
324
- return nil
325
- end
326
- xf_obj[:alignment][:attributes][:horizontal].to_s
200
+ xf_obj = get_cell_xf
201
+ return nil if xf_obj.alignment.nil?
202
+ xf_obj.alignment.horizontal
327
203
  end
328
204
 
329
205
  # returns cell's vertical alignment
330
206
  def vertical_alignment()
331
207
  validate_worksheet
332
- xf_obj = @workbook.get_style(@style_index)
333
- if xf_obj[:alignment].nil? || xf_obj[:alignment][:attributes].nil?
334
- return nil
335
- end
336
- xf_obj[:alignment][:attributes][:vertical].to_s
208
+ xf_obj = get_cell_xf
209
+ return nil if xf_obj.alignment.nil?
210
+ xf_obj.alignment.vertical
211
+ end
212
+
213
+ # returns cell's wrap
214
+ def text_wrap()
215
+ validate_worksheet
216
+ xf_obj = get_cell_xf
217
+ return nil if xf_obj.alignment.nil?
218
+ xf_obj.alignment.wrap_text
337
219
  end
338
220
 
339
221
  # returns cell's top border
@@ -361,46 +243,10 @@ module RubyXL
361
243
  return get_border(:diagonal)
362
244
  end
363
245
 
364
- # returns Excel-style cell string from matrix indices
365
- def Cell.convert_to_cell(row=0,col=0)
366
- row_string = (row + 1).to_s #+1 for 0 indexing
367
- col_string = ''
368
-
369
- if row < 0 || col < 0
370
- raise 'Invalid input: cannot convert negative numbers'
371
- end
372
-
373
- unless col == 0
374
- col_length = 1+Integer(Math.log(col) / Math.log(26)) #opposite of 26**
375
- else
376
- col_length = 1
377
- end
378
-
379
- 1.upto(col_length) do |i|
380
-
381
- #for the last digit, 0 should mean A. easy way to do this.
382
- if i == col_length
383
- col+=1
384
- end
385
-
386
- if col >= 26**(col_length-i)
387
- int_val = col / 26**(col_length-i) #+1 for 0 indexing
388
- int_val += 64 #converts 1 to A, etc.
389
-
390
- col_string += int_val.chr
391
-
392
- #intval multiplier decrements by placeholder, essentially
393
- #a B subtracts more than an A this way.
394
- col -= (int_val-64)*26**(col_length-i)
395
- end
396
- end
397
- col_string+row_string
398
- end
399
-
400
246
  def inspect
401
- str = "(#{@row},#{@column}): #{@value}"
247
+ str = "#<#{self.class}(#{row},#{column}): #{raw_value.inspect}"
402
248
  str += " =#{@formula}" if @formula
403
- str += ", datatype = #{@datatype}, style_index = #{@style_index}"
249
+ str += ", datatype = #{self.datatype}, style_index = #{self.style_index}>"
404
250
  return str
405
251
  end
406
252
 
@@ -408,54 +254,48 @@ module RubyXL
408
254
 
409
255
  def change_border(direction, weight)
410
256
  validate_worksheet
411
- validate_border(weight)
412
- @style_index = modify_border(@workbook,@style_index)
413
- if @workbook.borders[border_id()][:border][direction][:attributes].nil?
414
- @workbook.borders[border_id()][:border][direction][:attributes] = { :style => nil }
415
- end
416
- @workbook.borders[border_id()][:border][direction][:attributes][:style] = weight.to_s
257
+ self.style_index = workbook.modify_border(self.style_index, direction, weight)
417
258
  end
418
259
 
419
260
  def get_border(direction)
420
261
  validate_worksheet
421
-
422
- if @workbook.borders[border_id()][:border][direction][:attributes].nil?
423
- return nil
424
- end
425
- return @workbook.borders[border_id()][:border][direction][:attributes][:style]
262
+ get_cell_border.get_edge_style(direction)
426
263
  end
427
264
 
428
265
  def validate_workbook()
429
- unless @workbook.nil? || @workbook.worksheets.nil?
430
- @workbook.worksheets.each do |sheet|
431
- unless sheet.nil? || sheet.sheet_data.nil? || sheet.sheet_data[@row].nil?
432
- if sheet.sheet_data[@row][@column] == self
266
+ unless workbook.nil? || workbook.worksheets.nil?
267
+ workbook.worksheets.each do |sheet|
268
+ unless sheet.nil? || sheet.sheet_data.nil? || sheet.sheet_data[row].nil?
269
+ if sheet.sheet_data[row][column] == self
433
270
  return
434
271
  end
435
272
  end
436
273
  end
437
274
  end
438
- raise "This cell #{self} is not in workbook #{@workbook}"
275
+ raise "This cell #{self} is not in workbook #{workbook}"
439
276
  end
440
277
 
441
278
  def validate_worksheet()
442
- if !@worksheet.nil? && @worksheet[@row][@column] == self
443
- return
444
- else
445
- raise "This cell #{self} is not in worksheet #{worksheet}"
446
- end
279
+ return if @worksheet && @worksheet[row][column] == self
280
+ raise "This cell #{self} is not in worksheet #{worksheet}"
447
281
  end
448
282
 
449
- def xf_id()
450
- @workbook.get_style_attributes(@workbook.get_style(@style_index.to_s))
283
+ def get_cell_xf
284
+ workbook.cell_xfs[self.style_index]
451
285
  end
452
286
 
453
- def border_id()
454
- xf_id()[:borderId].to_s
287
+ def get_cell_font
288
+ workbook.fonts[workbook.cell_xfs[self.style_index].font_id]
455
289
  end
456
290
 
457
- def font_id()
458
- xf_id()[:fontId].to_s
291
+ def get_cell_border
292
+ workbook.borders[get_cell_xf.border_id]
459
293
  end
294
+
295
+ def get_number_format
296
+ workbook.stylesheet.get_number_format_by_id(get_cell_xf.num_fmt_id)
297
+ end
298
+
460
299
  end
461
300
  end
301
+