rubyXL 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/Gemfile +16 -0
  2. data/Gemfile.lock +34 -0
  3. data/LICENSE.txt +20 -0
  4. data/README +0 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +53 -0
  7. data/VERSION +1 -0
  8. data/lib/.DS_Store +0 -0
  9. data/lib/Hash.rb +60 -0
  10. data/lib/cell.rb +360 -0
  11. data/lib/color.rb +14 -0
  12. data/lib/parser.rb +413 -0
  13. data/lib/private_class.rb +182 -0
  14. data/lib/rubyXL.rb +9 -0
  15. data/lib/test.html +1 -0
  16. data/lib/tests/test.rb +110 -0
  17. data/lib/tests/test10.rb +16 -0
  18. data/lib/tests/test2.rb +118 -0
  19. data/lib/tests/test3.rb +76 -0
  20. data/lib/tests/test4.rb +92 -0
  21. data/lib/tests/test5.rb +90 -0
  22. data/lib/tests/test6.rb +50 -0
  23. data/lib/tests/test7.rb +48 -0
  24. data/lib/tests/test8.rb +12 -0
  25. data/lib/tests/test9.rb +60 -0
  26. data/lib/workbook.rb +336 -0
  27. data/lib/worksheet.rb +1245 -0
  28. data/lib/writer/app_writer.rb +62 -0
  29. data/lib/writer/calc_chain_writer.rb +33 -0
  30. data/lib/writer/content_types_writer.rb +77 -0
  31. data/lib/writer/core_writer.rb +51 -0
  32. data/lib/writer/root_rels_writer.rb +25 -0
  33. data/lib/writer/shared_strings_writer.rb +44 -0
  34. data/lib/writer/styles_writer.rb +376 -0
  35. data/lib/writer/theme_writer.rb +346 -0
  36. data/lib/writer/workbook_rels_writer.rb +59 -0
  37. data/lib/writer/workbook_writer.rb +77 -0
  38. data/lib/writer/worksheet_writer.rb +208 -0
  39. data/lib/zip.rb +20 -0
  40. data/pkg/rubyXL-1.0.4.gem +0 -0
  41. data/rubyXL.gemspec +106 -0
  42. data/spec/lib/cell_spec.rb +359 -0
  43. data/spec/lib/color_spec.rb +14 -0
  44. data/spec/lib/hash_spec.rb +28 -0
  45. data/spec/lib/parser_spec.rb +49 -0
  46. data/spec/lib/workbook_spec.rb +51 -0
  47. data/spec/lib/worksheet_spec.rb +1650 -0
  48. metadata +222 -0
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rubyXL'
3
+
4
+ describe RubyXL::Color do
5
+ describe '.validate_color' do
6
+ it 'should return true if a valid hex color without a # is passed' do
7
+ RubyXL::Color.validate_color('0fbCAd').should == true
8
+ end
9
+
10
+ it 'should cause an error if an invalid hex color code or one with a # is passed' do
11
+ lambda {RubyXL::Color.validate_color('#G')}.should raise_error
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'rubyXL'
3
+
4
+ describe RubyXL::Hash do
5
+ before do
6
+ @xml = '<root xmlns:foo="bar"><bar hello="world"/></root>'
7
+ @hash = {
8
+ :root => {
9
+ :bar => { :attributes => { :hello => 'world' } }
10
+ }
11
+ }
12
+ end
13
+
14
+ describe '.from_xml' do
15
+ it 'should create a hash which correctly corresponds to XML' do
16
+ nokogiri = RubyXL::Hash.from_xml(@xml)
17
+ nokogiri.should == @hash
18
+ end
19
+ end
20
+
21
+ describe '.xml_node_to_hash' do
22
+ it 'should create a hash which correctly corresponds to a Nokogiri root node' do
23
+ nokogiri = Nokogiri::XML::Document.parse(@xml)
24
+ my_hash = RubyXL::Hash.xml_node_to_hash(nokogiri.root)
25
+ my_hash.should == @hash[:root]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'rubyXL'
3
+
4
+ describe RubyXL::Parser do
5
+ before do
6
+ @workbook = (RubyXL::Workbook.new)
7
+ @time_str = Time.now.to_s
8
+ @file = @time_str + '.xlsx'
9
+ @workbook.write(@file)
10
+ end
11
+
12
+ describe '.convert_to_index' do
13
+ it 'should convert a well-formed Excel index into a pair of array indices' do
14
+ RubyXL::Parser.convert_to_index('AA1').should == [0, 26]
15
+ end
16
+
17
+ it 'should return [-1, -1] if the Excel index is not well-formed' do
18
+ RubyXL::Parser.convert_to_index('A1B').should == [-1, -1]
19
+ end
20
+ end
21
+
22
+ describe '.parse' do
23
+ it 'should parse a valid Excel xlsx or xlsm workbook correctly' do
24
+ @workbook2 = RubyXL::Parser.parse(@file)
25
+
26
+ @workbook2.worksheets.size.should == @workbook.worksheets.size
27
+ @workbook2[0].sheet_data.should == @workbook[0].sheet_data
28
+ @workbook2[0].sheet_name.should == @workbook[0].sheet_name
29
+ end
30
+
31
+ it 'should cause an error if an xlsx or xlsm workbook is not passed' do
32
+ lambda {@workbook2 = RubyXL::Parser.parse(@time_str+".xls")}.should raise_error
33
+ end
34
+
35
+ it 'should only read the data and not any of the styles (for the sake of speed) when passed true' do
36
+ @workbook2 = RubyXL::Parser.parse(@file, true)
37
+
38
+ @workbook2.worksheets.size.should == @workbook.worksheets.size
39
+ @workbook2[0].sheet_data.should == @workbook[0].sheet_data
40
+ @workbook2[0].sheet_name.should == @workbook[0].sheet_name
41
+ end
42
+ end
43
+
44
+ after do
45
+ if File.exist?(@file)
46
+ File.delete(@file)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rubyXL'
3
+
4
+ describe RubyXL::Workbook do
5
+ before do
6
+ @workbook = RubyXL::Workbook.new
7
+ @worksheet = RubyXL::Worksheet.new(@workbook)
8
+ @workbook.worksheets << @worksheet
9
+ (0..10).each do |i|
10
+ (0..10).each do |j|
11
+ @worksheet.add_cell(i, j, "#{i}:#{j}")
12
+ end
13
+ end
14
+ @cell = @worksheet[0][0]
15
+ end
16
+
17
+ describe '.write' do
18
+ #method not conducive to unit tests
19
+ end
20
+
21
+ describe '.get_style' do
22
+ it 'should return the cell_xfs object based on the passed in style index (string or number)' do
23
+ @workbook.get_style('0').should == @workbook.cell_xfs[:xf][0]
24
+ end
25
+
26
+ it 'should return nil if index out of range or string is passed in' do
27
+ @workbook.get_style('20000').should be_nil
28
+ end
29
+ end
30
+
31
+ describe '.get_style_attributes' do
32
+ it 'should return the attributes of the style object when passed the style object itself' do
33
+ @workbook.get_style_attributes(@workbook.get_style(0)).should == @workbook.cell_xfs[:xf][0][:attributes]
34
+ end
35
+
36
+ it 'should cause an error if nil is passed' do
37
+ lambda {@workbook.get_style_attributes(nil)}.should raise_error
38
+ end
39
+ end
40
+
41
+ describe '.get_fill_color' do
42
+ it 'should return the fill color of a particular style attribute' do
43
+ @cell.change_fill('000000')
44
+ @workbook.get_fill_color(@workbook.get_style_attributes(@workbook.get_style(@cell.style_index))).should == '000000'
45
+ end
46
+
47
+ it 'should return white (ffffff) if no fill color is specified in style' do
48
+ @workbook.get_fill_color(@workbook.get_style_attributes(@workbook.get_style(@cell.style_index))).should == 'ffffff'
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,1650 @@
1
+ require 'rubygems'
2
+ require 'rubyXL'
3
+
4
+ describe RubyXL::Worksheet do
5
+ before do
6
+ @workbook = RubyXL::Workbook.new
7
+ @worksheet = RubyXL::Worksheet.new(@workbook)
8
+ @workbook.worksheets << @worksheet
9
+ (0..10).each do |i|
10
+ (0..10).each do |j|
11
+ @worksheet.add_cell(i, j, "#{i}:#{j}")
12
+ end
13
+ end
14
+
15
+ @old_cell = Marshal.load(Marshal.dump(@worksheet[0][0]))
16
+ @old_cell_value = @worksheet[0][0].value
17
+ @old_cell_formula = @worksheet[0][0].formula
18
+ end
19
+
20
+ describe '.get_table' do
21
+ it 'should return nil if table cannot be found with specified string' do
22
+ @worksheet.get_table('TEST').should be_nil
23
+ end
24
+
25
+ it 'should return nil if table cannot be found with specified headers' do
26
+ @worksheet.get_table(['TEST']).should be_nil
27
+ end
28
+
29
+ it 'should return a hash when given an array of headers it can find, where :table points to an array of hashes (rows), where each symbol is a column' do
30
+ headers = ["0:0", "0:1", "0:4"]
31
+ table_hash = @worksheet.get_table(headers)
32
+
33
+ table_hash.size.should == 4
34
+ table_hash[:table].size.should == 10
35
+ table_hash[:table][0].size.should == 3
36
+ table_hash[:"0:0"].size.should == 10
37
+ table_hash[:"0:1"].size.should == 10
38
+ table_hash[:"0:4"].size.should == 10
39
+ end
40
+ end
41
+
42
+ describe '.change_row_fill' do
43
+ it 'should raise error if hex color code not passed' do
44
+ lambda {
45
+ @worksheet.change_row_fill(0, 'G')
46
+ }.should raise_error
47
+ end
48
+
49
+ it 'should raise error if hex color code includes # character' do
50
+ lambda {
51
+ @worksheet.change_row_fill(3,'#FFF000')
52
+ }.should raise_error
53
+ end
54
+
55
+ it 'should make row and cell fill colors equal hex color code passed' do
56
+ @worksheet.change_row_fill(0, '111111')
57
+ @worksheet.get_row_fill(0).should == '111111'
58
+ @worksheet[0][5].fill_color.should == '111111'
59
+ end
60
+
61
+ it 'should cause error if a negative argument is passed in' do
62
+ lambda {
63
+ @worksheet.change_row_fill(-1,'111111')
64
+ }.should raise_error
65
+ end
66
+
67
+ it 'should expand matrix to fit argument if nonnegative' do
68
+ @worksheet.sheet_data.size.should == 11
69
+ @worksheet.change_row_fill(11,'111111')
70
+ @worksheet.get_row_fill(11).should == '111111'
71
+ @worksheet.sheet_data.size.should == 12
72
+ end
73
+ end
74
+
75
+ describe '.change_row_font_name' do
76
+ it 'should make row and cell font names equal font name passed' do
77
+ @worksheet.change_row_font_name(0, 'Arial')
78
+ @worksheet.get_row_font_name(0).should == 'Arial'
79
+ @worksheet[0][5].font_name.should == 'Arial'
80
+ end
81
+
82
+ it 'should cause error if a negative argument is passed in' do
83
+ lambda {
84
+ @worksheet.change_row_font_name(-1,'Arial')
85
+ }.should raise_error
86
+ end
87
+
88
+ it 'should expand matrix to fit argument if nonnegative' do
89
+ @worksheet.sheet_data.size.should == 11
90
+ @worksheet.change_row_font_name(11, 'Arial')
91
+ @worksheet.get_row_font_name(11).should == "Arial"
92
+ @worksheet.sheet_data.size.should == 12
93
+ end
94
+ end
95
+
96
+ describe '.change_row_font_size' do
97
+ it 'should make row and cell font sizes equal font number passed' do
98
+ @worksheet.change_row_font_size(0, 20)
99
+ @worksheet.get_row_font_size(0).should == 20
100
+ @worksheet[0][5].font_size.should == 20
101
+ end
102
+
103
+ it 'should cause an error if a string passed' do
104
+ lambda {
105
+ @worksheet.change_row_font_size(0, '20')
106
+ }.should raise_error
107
+ end
108
+
109
+ it 'should cause error if a negative argument is passed in' do
110
+ lambda {
111
+ @worksheet.change_row_font_size(-1,20)
112
+ }.should raise_error
113
+ end
114
+
115
+ it 'should expand matrix to fit argument if nonnegative' do
116
+ @worksheet.sheet_data.size.should == 11
117
+ @worksheet.change_row_font_size(11,20)
118
+ @worksheet.get_row_font_size(11).should == 20
119
+ @worksheet.sheet_data.size.should == 12
120
+ end
121
+ end
122
+
123
+ describe '.change_row_font_color' do
124
+ it 'should make row and cell font colors equal to font color passed' do
125
+ @worksheet.change_row_font_color(0, '0f0f0f')
126
+ @worksheet.get_row_font_color(0).should == '0f0f0f'
127
+ @worksheet[0][5].font_color.should == '0f0f0f'
128
+ end
129
+
130
+ it 'should raise error if hex color code not passed' do
131
+ lambda {
132
+ @worksheet.change_row_font_color(0, 'G')
133
+ }.should raise_error
134
+ end
135
+
136
+ it 'should raise error if hex color code includes # character' do
137
+ lambda {
138
+ @worksheet.change_row_font_color(3,'#FFF000')
139
+ }.should raise_error
140
+ end
141
+
142
+ it 'should cause error if a negative argument is passed in' do
143
+ lambda {
144
+ @worksheet.change_row_font_color(-1,'0f0f0f')
145
+ }.should raise_error
146
+ end
147
+
148
+ it 'should expand matrix to fit argument if nonnegative' do
149
+ @worksheet.sheet_data.size.should == 11
150
+ @worksheet.change_row_font_color(11,'0f0f0f')
151
+ @worksheet.get_row_font_color(11).should == '0f0f0f'
152
+ @worksheet.sheet_data.size.should == 12
153
+ end
154
+ end
155
+
156
+ describe '.change_row_italics' do
157
+ it 'should make row and cell fonts italicized when true is passed' do
158
+ @worksheet.change_row_italics(0,true)
159
+ @worksheet.is_row_italicized(0).should == true
160
+ @worksheet[0][5].is_italicized.should == true
161
+ end
162
+
163
+ it 'should cause error if a negative argument is passed in' do
164
+ lambda {
165
+ @worksheet.change_row_italics(-1,false)
166
+ }.should raise_error
167
+ end
168
+
169
+ it 'should expand matrix to fit argument if nonnegative' do
170
+ @worksheet.sheet_data.size.should == 11
171
+ @worksheet.change_row_italics(11,true)
172
+ @worksheet.is_row_italicized(11).should == true
173
+ @worksheet.sheet_data.size.should == 12
174
+ end
175
+ end
176
+
177
+ describe '.change_row_bold' do
178
+ it 'should make row and cell fonts bolded when true is passed' do
179
+ @worksheet.change_row_bold(0,true)
180
+ @worksheet.is_row_bolded(0).should == true
181
+ @worksheet[0][5].is_bolded.should == true
182
+ end
183
+
184
+ it 'should cause error if a negative argument is passed in' do
185
+ lambda {
186
+ @worksheet.change_row_bold(-1,false)
187
+ }.should raise_error
188
+ end
189
+
190
+ it 'should expand matrix to fit argument if nonnegative' do
191
+ @worksheet.sheet_data.size.should == 11
192
+ @worksheet.change_row_bold(11,true)
193
+ @worksheet.is_row_bolded(11).should == true
194
+ @worksheet.sheet_data.size.should == 12
195
+ end
196
+ end
197
+
198
+ describe '.change_row_underline' do
199
+ it 'should make row and cell fonts underlined when true is passed' do
200
+ @worksheet.change_row_underline(0,true)
201
+ @worksheet.is_row_underlined(0).should == true
202
+ @worksheet[0][5].is_underlined.should == true
203
+ end
204
+
205
+ it 'should cause error if a negative argument is passed in' do
206
+ lambda {
207
+ @worksheet.change_row_underline(-1,false)
208
+ }.should raise_error
209
+ end
210
+
211
+ it 'should expand matrix to fit argument if nonnegative' do
212
+ @worksheet.sheet_data.size.should == 11
213
+ @worksheet.change_row_underline(11,true)
214
+ @worksheet.is_row_underlined(11).should == true
215
+ @worksheet.sheet_data.size.should == 12
216
+ end
217
+ end
218
+
219
+ describe '.change_row_strikethrough' do
220
+ it 'should make row and cell fonts struckthrough when true is passed' do
221
+ @worksheet.change_row_strikethrough(0,true)
222
+ @worksheet.is_row_struckthrough(0).should == true
223
+ @worksheet[0][5].is_struckthrough.should == true
224
+ end
225
+
226
+ it 'should cause error if a negative argument is passed in' do
227
+ lambda {
228
+ @worksheet.change_row_strikethrough(-1,false)
229
+ }.should raise_error
230
+ end
231
+
232
+ it 'should expand matrix to fit argument if nonnegative' do
233
+ @worksheet.sheet_data.size.should == 11
234
+ @worksheet.change_row_strikethrough(11,true)
235
+ @worksheet.is_row_struckthrough(11).should == true
236
+ @worksheet.sheet_data.size.should == 12
237
+ end
238
+ end
239
+
240
+ describe '.change_row_height' do
241
+ it 'should make row height match number which is passed' do
242
+ @worksheet.change_row_height(0,30.0002)
243
+ @worksheet.get_row_height(0).should == 30.0002
244
+ end
245
+
246
+ it 'should make row height a number equivalent of the string passed if it is a string which is a number' do
247
+ @worksheet.change_row_height(0,'30.0002')
248
+ @worksheet.get_row_height(0).should == 30.0002
249
+ end
250
+
251
+ it 'should cause error if a string which is not a number' do
252
+ lambda {
253
+ @worksheet.change_row_height(0,'TEST')
254
+ }.should raise_error
255
+ end
256
+
257
+ it 'should cause error if a negative argument is passed in' do
258
+ lambda {
259
+ @worksheet.change_row_height(-1,30)
260
+ }.should raise_error
261
+ end
262
+
263
+ it 'should expand matrix to fit argument if nonnegative' do
264
+ @worksheet.sheet_data.size.should == 11
265
+ @worksheet.change_row_height(11,30)
266
+ @worksheet.get_row_height(11).should == 30
267
+ @worksheet.sheet_data.size.should == 12
268
+ end
269
+ end
270
+
271
+ describe '.change_row_horizontal_alignment' do
272
+ it 'should cause row and cells to horizontally align as specified by the passed in string' do
273
+ @worksheet.change_row_horizontal_alignment(0,'center')
274
+ @worksheet.get_row_horizontal_alignment(0).should == 'center'
275
+ @worksheet[0][5].horizontal_alignment.should == 'center'
276
+ end
277
+
278
+ it 'should cause error if nil, "center", "justify", "left", "right", or "distributed" is not passed' do
279
+ lambda {
280
+ @worksheet.change_row_horizontal_alignment(0,'TEST')
281
+ }.should raise_error
282
+ end
283
+
284
+ it 'should cause error if a negative argument is passed in' do
285
+ lambda {
286
+ @worksheet.change_row_horizontal_alignment(-1,'center')
287
+ }.should raise_error
288
+ end
289
+
290
+ it 'should expand matrix to fit argument if nonnegative' do
291
+ @worksheet.sheet_data.size.should == 11
292
+ @worksheet.change_row_horizontal_alignment(11,'center')
293
+ @worksheet.get_row_horizontal_alignment(11).should == 'center'
294
+ @worksheet.sheet_data.size.should == 12
295
+ end
296
+ end
297
+
298
+ describe '.change_row_vertical_alignment' do
299
+ it 'should cause row and cells to vertically align as specified by the passed in string' do
300
+ @worksheet.change_row_vertical_alignment(0,'center')
301
+ @worksheet.get_row_vertical_alignment(0).should == 'center'
302
+ @worksheet[0][5].vertical_alignment.should == 'center'
303
+ end
304
+
305
+ it 'should cause error if nil, "center", "justify", "top", "bottom", or "distributed" is not passed' do
306
+ lambda {
307
+ @worksheet.change_row_vertical_alignment(0,'TEST')
308
+ }.should raise_error
309
+ end
310
+
311
+ it 'should cause error if a negative argument is passed in' do
312
+ lambda {
313
+ @worksheet.change_row_vertical_alignment(-1,'center')
314
+ }.should raise_error
315
+ end
316
+
317
+ it 'should expand matrix to fit argument if nonnegative' do
318
+ @worksheet.sheet_data.size.should == 11
319
+ @worksheet.change_row_vertical_alignment(11,'center')
320
+ @worksheet.get_row_vertical_alignment(11).should == 'center'
321
+ @worksheet.sheet_data.size.should == 12
322
+ end
323
+ end
324
+
325
+ describe '.change_row_border_top' do
326
+ it 'should cause row and cells to have border at top of specified weight' do
327
+ @worksheet.change_row_border_top(0, 'thin')
328
+ @worksheet.get_row_border_top(0).should == 'thin'
329
+ @worksheet[0][5].border_top.should == 'thin'
330
+ end
331
+
332
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
333
+ lambda {
334
+ @worksheet.change_row_border_top(0,'TEST')
335
+ }.should raise_error
336
+ end
337
+
338
+ it 'should cause error if a negative argument is passed in' do
339
+ lambda {
340
+ @worksheet.change_row_border_top(-1,'thin')
341
+ }.should raise_error
342
+ end
343
+
344
+ it 'should expand matrix to fit argument if nonnegative' do
345
+ @worksheet.sheet_data.size.should == 11
346
+ @worksheet.change_row_border_top(11,'thin')
347
+ @worksheet.get_row_border_top(11).should == 'thin'
348
+ @worksheet.sheet_data.size.should == 12
349
+ end
350
+ end
351
+
352
+ describe '.change_row_border_left' do
353
+ it 'should cause row and cells to have border at left of specified weight' do
354
+ @worksheet.change_row_border_left(0, 'thin')
355
+ @worksheet.get_row_border_left(0).should == 'thin'
356
+ @worksheet[0][5].border_left.should == 'thin'
357
+ end
358
+
359
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
360
+ lambda {
361
+ @worksheet.change_row_border_left(0,'TEST')
362
+ }.should raise_error
363
+ end
364
+
365
+ it 'should cause error if a negative argument is passed in' do
366
+ lambda {
367
+ @worksheet.change_row_border_left(-1,'thin')
368
+ }.should raise_error
369
+ end
370
+
371
+ it 'should expand matrix to fit argument if nonnegative' do
372
+ @worksheet.sheet_data.size.should == 11
373
+ @worksheet.change_row_border_left(11,'thin')
374
+ @worksheet.get_row_border_left(11).should == 'thin'
375
+ @worksheet.sheet_data.size.should == 12
376
+ end
377
+ end
378
+
379
+ describe '.change_row_border_right' do
380
+ it 'should cause row and cells to have border at right of specified weight' do
381
+ @worksheet.change_row_border_right(0, 'thin')
382
+ @worksheet.get_row_border_right(0).should == 'thin'
383
+ @worksheet[0][5].border_right.should == 'thin'
384
+ end
385
+
386
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
387
+ lambda {
388
+ @worksheet.change_row_border_right(0,'TEST')
389
+ }.should raise_error
390
+ end
391
+
392
+ it 'should cause error if a negative argument is passed in' do
393
+ lambda {
394
+ @worksheet.change_row_border_right(-1,'thin')
395
+ }.should raise_error
396
+ end
397
+
398
+ it 'should expand matrix to fit argument if nonnegative' do
399
+ @worksheet.sheet_data.size.should == 11
400
+ @worksheet.change_row_border_right(11,'thin')
401
+ @worksheet.get_row_border_right(11).should == 'thin'
402
+ @worksheet.sheet_data.size.should == 12
403
+ end
404
+ end
405
+
406
+ describe '.change_row_border_bottom' do
407
+ it 'should cause row to have border at bottom of specified weight' do
408
+ @worksheet.change_row_border_bottom(0, 'thin')
409
+ @worksheet.get_row_border_bottom(0).should == 'thin'
410
+ @worksheet[0][5].border_bottom.should == 'thin'
411
+ end
412
+
413
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
414
+ lambda {
415
+ @worksheet.change_row_border_bottom(0,'TEST')
416
+ }.should raise_error
417
+ end
418
+
419
+ it 'should cause error if a negative argument is passed in' do
420
+ lambda {
421
+ @worksheet.change_row_border_bottom(-1,'thin')
422
+ }.should raise_error
423
+ end
424
+
425
+ it 'should expand matrix to fit argument if nonnegative' do
426
+ @worksheet.sheet_data.size.should == 11
427
+ @worksheet.change_row_border_bottom(11,'thin')
428
+ @worksheet.get_row_border_bottom(11).should == 'thin'
429
+ @worksheet.sheet_data.size.should == 12
430
+ end
431
+ end
432
+
433
+ describe '.change_row_border_diagonal' do
434
+ it 'should cause row to have border at diagonal of specified weight' do
435
+ @worksheet.change_row_border_diagonal(0, 'thin')
436
+ @worksheet.get_row_border_diagonal(0).should == 'thin'
437
+ @worksheet[0][5].border_diagonal.should == 'thin'
438
+ end
439
+
440
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
441
+ lambda {
442
+ @worksheet.change_row_border_diagonal(0,'TEST')
443
+ }.should raise_error
444
+ end
445
+
446
+ it 'should cause error if a negative argument is passed in' do
447
+ lambda {
448
+ @worksheet.change_row_border_diagonal(-1,'thin')
449
+ }.should raise_error
450
+ end
451
+
452
+ it 'should expand matrix to fit argument if nonnegative' do
453
+ @worksheet.sheet_data.size.should == 11
454
+ @worksheet.change_row_border_diagonal(11,'thin')
455
+ @worksheet.get_row_border_diagonal(11).should == 'thin'
456
+ @worksheet.sheet_data.size.should == 12
457
+ end
458
+ end
459
+
460
+ describe '.change_column_font_name' do
461
+ it 'should cause column and cell font names to match string passed in' do
462
+ @worksheet.change_column_font_name(0, 'Arial')
463
+ @worksheet.get_column_font_name(0).should == 'Arial'
464
+ @worksheet[5][0].font_name.should == 'Arial'
465
+ end
466
+
467
+ it 'should cause error if a negative argument is passed in' do
468
+ lambda {
469
+ @worksheet.change_column_font_name(-1,'Arial')
470
+ }.should raise_error
471
+ end
472
+
473
+ it 'should expand matrix to fit argument if nonnegative' do
474
+ @worksheet.sheet_data[0].size.should == 11
475
+ @worksheet.change_column_font_name(11,'Arial')
476
+ @worksheet.get_column_font_name(11).should == 'Arial'
477
+ @worksheet.sheet_data[0].size.should == 12
478
+ end
479
+ end
480
+
481
+ describe '.change_column_font_size' do
482
+ it 'should make column and cell font sizes equal font number passed' do
483
+ @worksheet.change_column_font_size(0, 20)
484
+ @worksheet.get_column_font_size(0).should == 20
485
+ @worksheet[5][0].font_size.should == 20
486
+ end
487
+
488
+ it 'should cause an error if a string passed' do
489
+ lambda {
490
+ @worksheet.change_column_font_size(0, '20')
491
+ }.should raise_error
492
+ end
493
+
494
+ it 'should cause error if a negative argument is passed in' do
495
+ lambda {
496
+ @worksheet.change_column_font_size(-1,20)
497
+ }.should raise_error
498
+ end
499
+
500
+ it 'should expand matrix to fit argument if nonnegative'do
501
+ @worksheet.sheet_data[0].size.should == 11
502
+ @worksheet.change_column_font_size(11,20)
503
+ @worksheet.get_column_font_size(11).should == 20
504
+ @worksheet.sheet_data[0].size.should == 12
505
+ end
506
+ end
507
+
508
+ describe '.change_column_font_color' do
509
+ it 'should make column and cell font colors equal to font color passed' do
510
+ @worksheet.change_column_font_color(0, '0f0f0f')
511
+ @worksheet.get_column_font_color(0).should == '0f0f0f'
512
+ @worksheet[5][0].font_color.should == '0f0f0f'
513
+ end
514
+
515
+ it 'should raise error if hex color code not passed' do
516
+ lambda {
517
+ @worksheet.change_column_font_color(0, 'G')
518
+ }.should raise_error
519
+ end
520
+
521
+ it 'should raise error if hex color code includes # character' do
522
+ lambda {
523
+ @worksheet.change_column_font_color(0,'#FFF000')
524
+ }.should raise_error
525
+ end
526
+
527
+ it 'should cause error if a negative argument is passed in' do
528
+ lambda {
529
+ @worksheet.change_column_font_color(-1,'0f0f0f')
530
+ }.should raise_error
531
+ end
532
+
533
+ it 'should expand matrix to fit argument if nonnegative'do
534
+ @worksheet.sheet_data[0].size.should == 11
535
+ @worksheet.change_column_font_color(11,'0f0f0f')
536
+ @worksheet.get_column_font_color(11).should == '0f0f0f'
537
+ @worksheet.sheet_data[0].size.should == 12
538
+ end
539
+ end
540
+
541
+ describe '.change_column_italics' do
542
+ it 'should make column and cell fonts italicized when true is passed' do
543
+ @worksheet.change_column_italics(0,true)
544
+ @worksheet.is_column_italicized(0).should == true
545
+ @worksheet[5][0].is_italicized.should == true
546
+ end
547
+
548
+ it 'should cause error if a negative argument is passed in' do
549
+ lambda {
550
+ @worksheet.change_column_italicized(-1,false)
551
+ }.should raise_error
552
+ end
553
+
554
+ it 'should expand matrix to fit argument if nonnegative'do
555
+ @worksheet.sheet_data[0].size.should == 11
556
+ @worksheet.change_column_italics(11,true)
557
+ @worksheet.is_column_italicized(11).should == true
558
+ @worksheet.sheet_data[0].size.should == 12
559
+ end
560
+ end
561
+
562
+ describe '.change_column_bold' do
563
+ it 'should make column and cell fonts bolded when true is passed' do
564
+ @worksheet.change_column_bold(0,true)
565
+ @worksheet.is_column_bolded(0).should == true
566
+ @worksheet[5][0].is_bolded.should == true
567
+ end
568
+
569
+ it 'should cause error if a negative argument is passed in' do
570
+ lambda {
571
+ @worksheet.change_column_bold(-1,false)
572
+ }.should raise_error
573
+ end
574
+
575
+ it 'should expand matrix to fit argument if nonnegative'do
576
+ @worksheet.sheet_data[0].size.should == 11
577
+ @worksheet.change_column_bold(11,true)
578
+ @worksheet.is_column_bolded(11).should == true
579
+ @worksheet.sheet_data[0].size.should == 12
580
+ end
581
+ end
582
+
583
+ describe '.change_column_underline' do
584
+ it 'should make column and cell fonts underlined when true is passed' do
585
+ @worksheet.change_column_underline(0,true)
586
+ @worksheet.is_column_underlined(0).should == true
587
+ @worksheet[5][0].is_underlined.should == true
588
+ end
589
+
590
+ it 'should cause error if a negative argument is passed in' do
591
+ lambda {
592
+ @worksheet.change_column_underline(-1,false)
593
+ }.should raise_error
594
+ end
595
+
596
+ it 'should expand matrix to fit argument if nonnegative'do
597
+ @worksheet.sheet_data[0].size.should == 11
598
+ @worksheet.change_column_underline(11,true)
599
+ @worksheet.is_column_underlined(11).should == true
600
+ @worksheet.sheet_data[0].size.should == 12
601
+ end
602
+ end
603
+
604
+ describe '.change_column_strikethrough' do
605
+ it 'should make column and cell fonts struckthrough when true is passed' do
606
+ @worksheet.change_column_strikethrough(0,true)
607
+ @worksheet.is_column_struckthrough(0).should == true
608
+ @worksheet[5][0].is_struckthrough.should == true
609
+ end
610
+
611
+ it 'should cause error if a negative argument is passed in' do
612
+ lambda {
613
+ @worksheet.change_column_strikethrough(-1,false)
614
+ }.should raise_error
615
+ end
616
+
617
+ it 'should expand matrix to fit argument if nonnegative'do
618
+ @worksheet.sheet_data[0].size.should == 11
619
+ @worksheet.change_column_strikethrough(11,true)
620
+ @worksheet.is_column_struckthrough(11).should == true
621
+ @worksheet.sheet_data[0].size.should == 12
622
+ end
623
+ end
624
+
625
+ describe '.change_column_width' do
626
+ it 'should make column width match number which is passed' do
627
+ @worksheet.change_column_width(0,30.0002)
628
+ @worksheet.get_column_width(0).should == 30.0002
629
+ end
630
+
631
+ it 'should make column width a number equivalent of the string passed if it is a string which is a number' do
632
+ @worksheet.change_column_width(0,'30.0002')
633
+ @worksheet.get_column_width(0).should == 30.0002
634
+ end
635
+
636
+ it 'should cause error if a string which is not a number' do
637
+ lambda {
638
+ @worksheet.change_column_width(0,'TEST')
639
+ }.should raise_error
640
+ end
641
+
642
+ it 'should cause error if a negative argument is passed in' do
643
+ lambda {
644
+ @worksheet.change_column_width(-1,10)
645
+ }.should raise_error
646
+ end
647
+
648
+ it 'should expand matrix to fit argument if nonnegative'do
649
+ @worksheet.sheet_data[0].size.should == 11
650
+ @worksheet.change_column_width(11,30)
651
+ @worksheet.get_column_width(11).should == 30
652
+ @worksheet.sheet_data[0].size.should == 12
653
+ end
654
+ end
655
+
656
+ describe '.change_column_fill' do
657
+ it 'should raise error if hex color code not passed' do
658
+ lambda {
659
+ @worksheet.change_column_fill(0, 'G')
660
+ }.should raise_error
661
+ end
662
+
663
+ it 'should raise error if hex color code includes # character' do
664
+ lambda {
665
+ @worksheet.change_column_fill(3,'#FFF000')
666
+ }.should raise_error
667
+ end
668
+
669
+ it 'should make column and cell fill colors equal hex color code passed' do
670
+ @worksheet.change_column_fill(0, '111111')
671
+ @worksheet.get_column_fill(0).should == '111111'
672
+ @worksheet[5][0].fill_color.should == '111111'
673
+ end
674
+
675
+ it 'should cause error if a negative argument is passed in' do
676
+ lambda {
677
+ @worksheet.change_column_fill(-1,'111111')
678
+ }.should raise_error
679
+ end
680
+
681
+ it 'should expand matrix to fit argument if nonnegative'do
682
+ @worksheet.sheet_data[0].size.should == 11
683
+ @worksheet.change_column_fill(11,'111111')
684
+ @worksheet.get_column_fill(11).should == '111111'
685
+ @worksheet.sheet_data[0].size.should == 12
686
+ end
687
+ end
688
+
689
+ describe '.change_column_horizontal_alignment' do
690
+ it 'should cause column and cell to horizontally align as specified by the passed in string' do
691
+ @worksheet.change_column_horizontal_alignment(0,'center')
692
+ @worksheet.get_column_horizontal_alignment(0).should == 'center'
693
+ @worksheet[5][0].horizontal_alignment.should == 'center'
694
+ end
695
+
696
+ it 'should cause error if nil, "center", "justify", "left", "right", or "distributed" is not passed' do
697
+ lambda {
698
+ @worksheet.change_column_horizontal_alignment(0,'TEST')
699
+ }.should raise_error
700
+ end
701
+
702
+ it 'should cause error if a negative argument is passed in' do
703
+ lambda {
704
+ @worksheet.change_column_horizontal_alignment(-1,'center')
705
+ }.should raise_error
706
+ end
707
+
708
+ it 'should expand matrix to fit argument if nonnegative'do
709
+ @worksheet.sheet_data[0].size.should == 11
710
+ @worksheet.change_column_horizontal_alignment(11,'center')
711
+ @worksheet.get_column_horizontal_alignment(11).should == 'center'
712
+ @worksheet.sheet_data[0].size.should == 12
713
+ end
714
+ end
715
+
716
+ describe '.change_column_vertical_alignment' do
717
+ it 'should cause column and cell to vertically align as specified by the passed in string' do
718
+ @worksheet.change_column_vertical_alignment(0,'center')
719
+ @worksheet.get_column_vertical_alignment(0).should == 'center'
720
+ @worksheet[5][0].vertical_alignment.should == 'center'
721
+ end
722
+
723
+ it 'should cause error if nil, "center", "justify", "top", "bottom", or "distributed" is not passed' do
724
+ lambda {
725
+ @worksheet.change_column_vertical_alignment(0,'TEST')
726
+ }.should raise_error
727
+ end
728
+
729
+ it 'should cause error if a negative argument is passed in' do
730
+ lambda {
731
+ @worksheet.change_column_vertical_alignment(-1,'center')
732
+ }.should raise_error
733
+ end
734
+
735
+ it 'should expand matrix to fit argument if nonnegative'do
736
+ @worksheet.sheet_data[0].size.should == 11
737
+ @worksheet.change_column_vertical_alignment(11,'center')
738
+ @worksheet.get_column_vertical_alignment(11).should == 'center'
739
+ @worksheet.sheet_data[0].size.should == 12
740
+ end
741
+ end
742
+
743
+ describe '.change_column_border_top' do
744
+ it 'should cause column and cells within to have border at top of specified weight' do
745
+ @worksheet.change_column_border_top(0, 'thin')
746
+ @worksheet.get_column_border_top(0).should == 'thin'
747
+ @worksheet[5][0].border_top.should == 'thin'
748
+ end
749
+
750
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
751
+ lambda {
752
+ @worksheet.change_column_border_top(0,'TEST')
753
+ }.should raise_error
754
+ end
755
+
756
+ it 'should cause error if a negative argument is passed in' do
757
+ lambda {
758
+ @worksheet.change_column_border_top(-1,'thin')
759
+ }.should raise_error
760
+ end
761
+
762
+ it 'should expand matrix to fit argument if nonnegative'do
763
+ @worksheet.sheet_data[0].size.should == 11
764
+ @worksheet.change_column_border_top(11,'thin')
765
+ @worksheet.get_column_border_top(11).should == 'thin'
766
+ @worksheet.sheet_data[0].size.should == 12
767
+ end
768
+ end
769
+
770
+ describe '.change_column_border_left' do
771
+ it 'should cause column and cells within to have border at left of specified weight' do
772
+ @worksheet.change_column_border_left(0, 'thin')
773
+ @worksheet.get_column_border_left(0).should == 'thin'
774
+ @worksheet[5][0].border_left.should == 'thin'
775
+ end
776
+
777
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
778
+ lambda {
779
+ @worksheet.change_column_border_left(0,'TEST')
780
+ }.should raise_error
781
+ end
782
+
783
+ it 'should cause error if a negative argument is passed in' do
784
+ lambda {
785
+ @worksheet.change_column_border_left(-1,'thin')
786
+ }.should raise_error
787
+ end
788
+
789
+ it 'should expand matrix to fit argument if nonnegative' do
790
+ @worksheet.sheet_data[0].size.should == 11
791
+ @worksheet.change_column_border_left(11,'thin')
792
+ @worksheet.get_column_border_left(11).should == 'thin'
793
+ @worksheet.sheet_data[0].size.should == 12
794
+ end
795
+ end
796
+
797
+ describe '.change_column_border_right' do
798
+ it 'should cause column and cells within to have border at right of specified weight' do
799
+ @worksheet.change_column_border_right(0, 'thin')
800
+ @worksheet.get_column_border_right(0).should == 'thin'
801
+ @worksheet[5][0].border_right.should == 'thin'
802
+ end
803
+
804
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
805
+ lambda {
806
+ @worksheet.change_column_border_right(0,'TEST')
807
+ }.should raise_error
808
+ end
809
+
810
+ it 'should cause error if a negative argument is passed in' do
811
+ lambda {
812
+ @worksheet.change_column_border_right(-1,'thin')
813
+ }.should raise_error
814
+ end
815
+
816
+ it 'should expand matrix to fit argument if nonnegative'do
817
+ @worksheet.sheet_data[0].size.should == 11
818
+ @worksheet.change_column_border_right(11,'thin')
819
+ @worksheet.get_column_border_right(11).should == 'thin'
820
+ @worksheet.sheet_data[0].size.should == 12
821
+ end
822
+ end
823
+
824
+ describe '.change_column_border_bottom' do
825
+ it 'should cause column and cells within to have border at bottom of specified weight' do
826
+ @worksheet.change_column_border_bottom(0, 'thin')
827
+ @worksheet.get_column_border_bottom(0).should == 'thin'
828
+ @worksheet[5][0].border_bottom.should == 'thin'
829
+ end
830
+
831
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
832
+ lambda {
833
+ @worksheet.change_column_border_bottom(0,'TEST')
834
+ }.should raise_error
835
+ end
836
+
837
+ it 'should cause error if a negative argument is passed in' do
838
+ lambda {
839
+ @worksheet.change_column_border_bottom(-1,'thin')
840
+ }.should raise_error
841
+ end
842
+
843
+ it 'should expand matrix to fit argument if nonnegative'do
844
+ @worksheet.sheet_data[0].size.should == 11
845
+ @worksheet.change_column_border_bottom(11,'thin')
846
+ @worksheet.get_column_border_bottom(11).should == 'thin'
847
+ @worksheet.sheet_data[0].size.should == 12
848
+ end
849
+ end
850
+
851
+ describe '.change_column_border_diagonal' do
852
+ it 'should cause column and cells within to have border at diagonal of specified weight' do
853
+ @worksheet.change_column_border_diagonal(0, 'thin')
854
+ @worksheet.get_column_border_diagonal(0).should == 'thin'
855
+ @worksheet[5][0].border_diagonal.should == 'thin'
856
+ end
857
+
858
+ it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
859
+ lambda {
860
+ @worksheet.change_column_border_diagonal(0,'TEST')
861
+ }.should raise_error
862
+ end
863
+
864
+ it 'should cause error if a negative argument is passed in' do
865
+ lambda {
866
+ @worksheet.change_column_border_diagonal(-1,'thin')
867
+ }.should raise_error
868
+ end
869
+
870
+ it 'should expand matrix to fit argument if nonnegative' do
871
+ @worksheet.sheet_data[0].size.should == 11
872
+ @worksheet.change_column_border_diagonal(11,'thin')
873
+ @worksheet.get_column_border_diagonal(11).should == 'thin'
874
+ @worksheet.sheet_data[0].size.should == 12
875
+ end
876
+ end
877
+
878
+ describe '.merge_cells' do
879
+ it 'should merge cells in any valid range specified by indices' do
880
+ @worksheet.merge_cells(0,0,1,1)
881
+ @worksheet.merged_cells.include?({:attributes=>{:ref=>"A1:B2"}}).should == true
882
+ end
883
+
884
+ it 'should cause an error if a negative number is passed' do
885
+ lambda {
886
+ @worksheet.merge_cells(0,0,-1,0)
887
+ }.should raise_error
888
+ end
889
+ end
890
+
891
+ describe '.add_cell' do
892
+ it 'should add new cell where specified, even if a cell is already there (default)' do
893
+ @worksheet.add_cell(0,0,'TEST')
894
+ @worksheet[0][0].value.should_not == @old_cell_value
895
+ @worksheet[0][0].value.should == 'TEST'
896
+ end
897
+
898
+ it 'should add new cell where specified with formula, even if a cell is already there (default)' do
899
+ @worksheet.add_cell(0,0,'','SUM(A2:A10)')
900
+ @worksheet[0][0].value.should_not == @old_cell_value
901
+ @worksheet[0][0].formula.should_not == @old_cell_formula
902
+ @worksheet[0][0].value.should == ''
903
+ @worksheet[0][0].formula.should == 'SUM(A2:A10)'
904
+ end
905
+
906
+ it 'should not overwrite when a cell is present when overwrite is specified to be false' do
907
+ @worksheet.add_cell(0,0,'TEST','B2',false)
908
+ @worksheet[0][0].value.should == @old_cell_value
909
+ @worksheet[0][0].formula.should == @old_cell_formula
910
+ end
911
+
912
+ it 'should still add a new cell when there is no cell to be overwritten' do
913
+ @worksheet.add_cell(11,11,'TEST','B2',false)
914
+ @worksheet[11][11].value.should == 'TEST'
915
+ @worksheet[11][11].formula.should == 'B2'
916
+ end
917
+
918
+ it 'should cause error if a negative argument is passed in' do
919
+ lambda {
920
+ @worksheet.add_cell(-1,-1,'')
921
+ }.should raise_error
922
+ end
923
+ end
924
+
925
+ describe '.add_cell_obj' do
926
+ it 'should add already created cell object to worksheet, even if a cell is already there (default)' do
927
+ new_cell = RubyXL::Cell.new(@worksheet,0,0,'TEST','B2')
928
+ @worksheet.add_cell_obj(new_cell)
929
+ @worksheet[0][0].value.should_not == @old_cell_value
930
+ @worksheet[0][0].formula.should_not == @old_cell_formula
931
+ @worksheet[0][0].value.should == 'TEST'
932
+ @worksheet[0][0].formula.should == 'B2'
933
+ end
934
+
935
+ it 'should not add already created cell object to already occupied cell if overwrite is false' do
936
+ new_cell = RubyXL::Cell.new(@worksheet,0,0,'TEST','B2')
937
+ @worksheet.add_cell_obj(new_cell,false)
938
+ @worksheet[0][0].value.should == @old_cell_value
939
+ @worksheet[0][0].formula.should == @old_cell_formula
940
+ end
941
+
942
+ it 'should cause error if a negative argument is passed in' do
943
+ lambda {
944
+ @worksheet.add_cell_obj(-1)
945
+ }.should raise_error
946
+ end
947
+
948
+ it 'should expand matrix to fit argument if nonnegative' do
949
+ @worksheet.sheet_data.size.should == 11
950
+ new_cell = RubyXL::Cell.new(@worksheet,11,11,'TEST','B2')
951
+ @worksheet.add_cell_obj(new_cell)
952
+ @worksheet.sheet_data.size.should == 12
953
+ end
954
+ end
955
+
956
+ describe '.insert_row' do
957
+ it 'should insert a row at index specified, "pushing" everything else "down"' do
958
+ @worksheet.insert_row(0)
959
+ @worksheet[0][0].should be_nil
960
+ @worksheet[1][0].value.should == @old_cell_value
961
+ @worksheet[1][0].formula.should == @old_cell_formula
962
+ end
963
+
964
+ it 'should insert a row at index specified, copying styles from row "above"' do
965
+ @worksheet.change_row_font_name(0,'Courier')
966
+ @worksheet.insert_row(1)
967
+ @worksheet.get_row_font_name(1).should == 'Courier'
968
+ end
969
+
970
+ it 'should preserve (rather than fix) formulas that reference cells "pushed down" rows' do
971
+ @worksheet.add_cell(5,0,nil,'SUM(A1:A4)')
972
+ @worksheet.insert_row(0)
973
+ @worksheet[6][0].formula.should == 'SUM(A1:A4)'
974
+ end
975
+
976
+ it 'should cause error if a negative argument is passed in' do
977
+ lambda {
978
+ @worksheet.insert_row(-1)
979
+ }.should raise_error
980
+ end
981
+
982
+ it 'should expand matrix to fit argument if nonnegative' do
983
+ @worksheet.sheet_data.size.should == 11
984
+ @worksheet.insert_row(11)
985
+ @worksheet.sheet_data.size.should == 13
986
+ end
987
+ end
988
+
989
+ describe '.insert_column' do
990
+ it 'should insert a column at index specified, "pushing" everything else "right"' do
991
+ @worksheet.insert_column(0)
992
+ @worksheet[0][0].should be_nil
993
+ @worksheet[0][1].value.should == @old_cell_value
994
+ @worksheet[0][1].formula.should == @old_cell_formula
995
+ end
996
+
997
+ it 'should insert a column at index specified, copying styles from column to "left"' do
998
+ @worksheet.change_column_font_name(0,'Courier')
999
+ @worksheet.insert_column(1)
1000
+ @worksheet.get_column_font_name(1).should == 'Courier'
1001
+ end
1002
+
1003
+ it 'should insert a column at 0 without copying any styles, when passed 0 as column index' do
1004
+ @worksheet.change_column_font_name(0,'Courier')
1005
+ @worksheet.insert_column(0)
1006
+ @worksheet.get_column_font_name(0).should == 'Verdana' #not courier
1007
+ end
1008
+
1009
+ it 'should preserve (rather than fix) formulas that reference cells in "pushed right" rows' do
1010
+ @worksheet.add_cell(0,5,nil,'SUM(A1:D1)')
1011
+ @worksheet.insert_column(0)
1012
+ @worksheet[0][6].formula.should == 'SUM(A1:D1)'
1013
+ end
1014
+
1015
+ it 'should cause error if a negative argument is passed in' do
1016
+ lambda {
1017
+ @worksheet.insert_column(-1)
1018
+ }.should raise_error
1019
+ end
1020
+
1021
+ it 'should expand matrix to fit argument if nonnegative' do
1022
+ @worksheet.sheet_data[0].size.should == 11
1023
+ @worksheet.insert_column(11)
1024
+ @worksheet.sheet_data[0].size.should == 13
1025
+ end
1026
+ end
1027
+
1028
+ describe '.get_row_fill' do
1029
+ it 'should return white (ffffff) if no fill color specified for row' do
1030
+ @worksheet.get_row_fill(0).should == 'ffffff'
1031
+ end
1032
+
1033
+ it 'should correctly reflect fill color if specified for row' do
1034
+ @worksheet.change_row_fill(0, '000000')
1035
+ @worksheet.get_row_fill(0).should == '000000'
1036
+ end
1037
+
1038
+ it 'should return nil if a row which does not exist is passed in' do
1039
+ @worksheet.get_row_fill(11).should be_nil
1040
+ end
1041
+
1042
+ it 'should cause error if a negative argument is passed in' do
1043
+ lambda {
1044
+ @worksheet.get_row_fill(-1)
1045
+ }.should raise_error
1046
+ end
1047
+ end
1048
+
1049
+ describe '.get_row_font_name' do
1050
+ it 'should correctly reflect font name for row' do
1051
+ @worksheet.change_row_font_name(0,'Courier')
1052
+ @worksheet.get_row_font_name(0).should == 'Courier'
1053
+ end
1054
+
1055
+ it 'should cause error if a negative argument is passed in' do
1056
+ lambda {
1057
+ @worksheet.get_row_font_name(-1)
1058
+ }.should raise_error
1059
+ end
1060
+
1061
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1062
+ @worksheet.get_row_font_name(11).should be_nil
1063
+ end
1064
+ end
1065
+
1066
+ describe '.get_row_font_size' do
1067
+ it 'should correctly reflect font size for row' do
1068
+ @worksheet.change_row_font_size(0,30)
1069
+ @worksheet.get_row_font_size(0).should == 30
1070
+ end
1071
+
1072
+ it 'should cause error if a negative argument is passed in' do
1073
+ lambda {
1074
+ @worksheet.get_row_font_size(-1)
1075
+ }.should raise_error
1076
+ end
1077
+
1078
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1079
+ @worksheet.get_row_font_size(11).should be_nil
1080
+ end
1081
+ end
1082
+
1083
+ describe '.get_row_font_color' do
1084
+ it 'should correctly reflect font color for row' do
1085
+ @worksheet.change_row_font_color(0,'0f0f0f')
1086
+ @worksheet.get_row_font_color(0).should == '0f0f0f'
1087
+ end
1088
+
1089
+ it 'should cause error if a negative argument is passed in' do
1090
+ lambda {
1091
+ @worksheet.get_row_font_color(-1)
1092
+ }.should raise_error
1093
+ end
1094
+
1095
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1096
+ @worksheet.get_row_font_color(11).should be_nil
1097
+ end
1098
+ end
1099
+
1100
+ describe '.is_row_italicized' do
1101
+ it 'should correctly return whether row is italicized' do
1102
+ @worksheet.change_row_italics(0,true)
1103
+ @worksheet.is_row_italicized(0).should == true
1104
+ end
1105
+
1106
+ it 'should cause error if a negative argument is passed in' do
1107
+ lambda {
1108
+ @worksheet.is_row_italicized(-1)
1109
+ }.should raise_error
1110
+ end
1111
+
1112
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1113
+ @worksheet.is_row_italicized(11).should be_nil
1114
+ end
1115
+ end
1116
+
1117
+ describe '.is_row_bolded' do
1118
+ it 'should correctly return whether row is bolded' do
1119
+ @worksheet.change_row_bold(0,true)
1120
+ @worksheet.is_row_bolded(0).should == true
1121
+ end
1122
+
1123
+ it 'should cause error if a negative argument is passed in' do
1124
+ lambda {
1125
+ @worksheet.is_row_bolded(-1)
1126
+ }.should raise_error
1127
+ end
1128
+
1129
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1130
+ @worksheet.is_row_bolded(11).should be_nil
1131
+ end
1132
+ end
1133
+
1134
+ describe '.is_row_underlined' do
1135
+ it 'should correctly return whether row is underlined' do
1136
+ @worksheet.change_row_underline(0,true)
1137
+ @worksheet.is_row_underlined(0).should == true
1138
+ end
1139
+
1140
+ it 'should cause error if a negative argument is passed in' do
1141
+ lambda {
1142
+ @worksheet.is_row_underlined(-1)
1143
+ }.should raise_error
1144
+ end
1145
+
1146
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1147
+ @worksheet.is_row_underlined(11).should be_nil
1148
+ end
1149
+ end
1150
+
1151
+ describe '.is_row_struckthrough' do
1152
+ it 'should correctly return whether row is struckthrough' do
1153
+ @worksheet.change_row_strikethrough(0,true)
1154
+ @worksheet.is_row_struckthrough(0).should == true
1155
+ end
1156
+
1157
+ it 'should cause error if a negative argument is passed in' do
1158
+ lambda {
1159
+ @worksheet.is_row_struckthrough(-1)
1160
+ }.should raise_error
1161
+ end
1162
+
1163
+ it 'should return nil if a (nonnegative) row which does not exist is passed in' do
1164
+ @worksheet.is_row_struckthrough(11).should be_nil
1165
+ end
1166
+ end
1167
+
1168
+ describe '.get_row_height' do
1169
+ it 'should return 13 if no height specified for row' do
1170
+ @worksheet.get_row_height(0).should == 13
1171
+ end
1172
+
1173
+ it 'should correctly reflect height if specified for row' do
1174
+ @worksheet.change_row_height(0, 30)
1175
+ @worksheet.get_row_height(0).should == 30
1176
+ end
1177
+
1178
+ it 'should return nil if a row which does not exist is passed in' do
1179
+ @worksheet.get_row_height(11).should be_nil
1180
+ end
1181
+
1182
+ it 'should cause error if a negative argument is passed in' do
1183
+ lambda {
1184
+ @worksheet.get_row_height(-1)
1185
+ }.should raise_error
1186
+ end
1187
+ end
1188
+
1189
+ describe '.get_row_horizontal_alignment' do
1190
+ it 'should return nil if no alignment specified for row' do
1191
+ @worksheet.get_row_horizontal_alignment(0).should be_nil
1192
+ end
1193
+
1194
+ it 'should return nil if a row which does not exist is passed in' do
1195
+ @worksheet.get_row_horizontal_alignment(11).should be_nil
1196
+ end
1197
+
1198
+ it 'should cause error if a negative argument is passed in' do
1199
+ lambda {
1200
+ @worksheet.get_row_horizontal_alignment(-1)
1201
+ }.should raise_error
1202
+ end
1203
+
1204
+ it 'should return correct horizontal alignment if it is set for that row' do
1205
+ @worksheet.change_row_horizontal_alignment(0, 'center')
1206
+ @worksheet.get_row_horizontal_alignment(0).should == 'center'
1207
+ end
1208
+ end
1209
+
1210
+ describe '.get_row_vertical_alignment' do
1211
+ it 'should return nil if no alignment specified for row' do
1212
+ @worksheet.get_row_vertical_alignment(0).should be_nil
1213
+ end
1214
+
1215
+ it 'should return nil if a row which does not exist is passed in' do
1216
+ @worksheet.get_row_vertical_alignment(11).should be_nil
1217
+ end
1218
+
1219
+ it 'should cause error if a negative argument is passed in' do
1220
+ lambda {
1221
+ @worksheet.get_row_vertical_alignment(-1)
1222
+ }.should raise_error
1223
+ end
1224
+
1225
+ it 'should return correct vertical alignment if it is set for that row' do
1226
+ @worksheet.change_row_vertical_alignment(0, 'center')
1227
+ @worksheet.get_row_vertical_alignment(0).should == 'center'
1228
+ end
1229
+ end
1230
+
1231
+ describe '.get_row_border_top' do
1232
+ it 'should return nil if no border is specified for that row in that direction' do
1233
+ @worksheet.get_row_border_top(0).should be_nil
1234
+ end
1235
+
1236
+ it 'should return type of border that this row has on top' do
1237
+ @worksheet.change_row_border_top(0,'thin')
1238
+ @worksheet.get_row_border_top(0).should == 'thin'
1239
+ end
1240
+
1241
+ it 'should cause error if a negative argument is passed in' do
1242
+ lambda {
1243
+ @worksheet.get_row_border_top(-1)
1244
+ }.should raise_error
1245
+ end
1246
+
1247
+ it 'should return nil if a row which does not exist is passed in' do
1248
+ @worksheet.get_row_border_top(11).should be_nil
1249
+ end
1250
+ end
1251
+
1252
+ describe '.get_row_border_left' do
1253
+ it 'should return nil if no border is specified for that row in that direction' do
1254
+ @worksheet.get_row_border_left(0).should be_nil
1255
+ end
1256
+
1257
+ it 'should return type of border that this row has on left' do
1258
+ @worksheet.change_row_border_left(0,'thin')
1259
+ @worksheet.get_row_border_left(0).should == 'thin'
1260
+ end
1261
+
1262
+ it 'should cause error if a negative argument is passed in' do
1263
+ lambda {
1264
+ @worksheet.get_row_border_left(-1)
1265
+ }.should raise_error
1266
+ end
1267
+
1268
+ it 'should return nil if a row which does not exist is passed in' do
1269
+ @worksheet.get_row_border_left(11).should be_nil
1270
+ end
1271
+ end
1272
+
1273
+ describe '.get_row_border_right' do
1274
+ it 'should return nil if no border is specified for that row in that direction' do
1275
+ @worksheet.get_row_border_right(0).should be_nil
1276
+ end
1277
+
1278
+ it 'should return type of border that this row has on right' do
1279
+ @worksheet.change_row_border_right(0,'thin')
1280
+ @worksheet.get_row_border_right(0).should == 'thin'
1281
+ end
1282
+
1283
+ it 'should cause error if a negative argument is passed in' do
1284
+ lambda {
1285
+ @worksheet.get_row_border_right(-1)
1286
+ }.should raise_error
1287
+ end
1288
+
1289
+ it 'should return nil if a row which does not exist is passed in' do
1290
+ @worksheet.get_row_border_right(11).should be_nil
1291
+ end
1292
+ end
1293
+
1294
+
1295
+ describe '.get_row_border_bottom' do
1296
+ it 'should return nil if no border is specified for that row in that direction' do
1297
+ @worksheet.get_row_border_bottom(0).should be_nil
1298
+ end
1299
+
1300
+ it 'should return type of border that this row has on bottom' do
1301
+ @worksheet.change_row_border_bottom(0,'thin')
1302
+ @worksheet.get_row_border_bottom(0).should == 'thin'
1303
+ end
1304
+
1305
+ it 'should cause error if a negative argument is passed in' do
1306
+ lambda {
1307
+ @worksheet.get_row_border_bottom(-1)
1308
+ }.should raise_error
1309
+ end
1310
+
1311
+ it 'should return nil if a row which does not exist is passed in' do
1312
+ @worksheet.get_row_border_bottom(11).should be_nil
1313
+ end
1314
+ end
1315
+
1316
+ describe '.get_row_border_diagonal' do
1317
+ it 'should return nil if no border is specified for that row in that direction' do
1318
+ @worksheet.get_row_border_diagonal(0).should be_nil
1319
+ end
1320
+
1321
+ it 'should return type of border that this row has on diagonal' do
1322
+ @worksheet.change_row_border_diagonal(0,'thin')
1323
+ @worksheet.get_row_border_diagonal(0).should == 'thin'
1324
+ end
1325
+
1326
+ it 'should cause error if a negative argument is passed in' do
1327
+ lambda {
1328
+ @worksheet.get_row_border_diagonal(-1)
1329
+ }.should raise_error
1330
+ end
1331
+
1332
+ it 'should return nil if a row which does not exist is passed in' do
1333
+ @worksheet.get_row_border_diagonal(11).should be_nil
1334
+ end
1335
+ end
1336
+
1337
+ describe '.get_column_font_name' do
1338
+ it 'should correctly reflect font name for column' do
1339
+ @worksheet.change_column_font_name(0,'Courier')
1340
+ @worksheet.get_column_font_name(0).should == 'Courier'
1341
+ end
1342
+
1343
+ it 'should cause error if a negative argument is passed in' do
1344
+ lambda {
1345
+ @worksheet.get_column_font_name(-1)
1346
+ }.should raise_error
1347
+ end
1348
+
1349
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1350
+ @worksheet.get_column_font_name(11).should be_nil
1351
+ end
1352
+ end
1353
+
1354
+ describe '.get_column_font_size' do
1355
+ it 'should correctly reflect font size for column' do
1356
+ @worksheet.change_column_font_size(0,30)
1357
+ @worksheet.get_column_font_size(0).should == 30
1358
+ end
1359
+
1360
+ it 'should cause error if a negative argument is passed in' do
1361
+ lambda {
1362
+ @worksheet.get_column_font_size(-1)
1363
+ }.should raise_error
1364
+ end
1365
+
1366
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1367
+ @worksheet.get_column_font_size(11).should be_nil
1368
+ end
1369
+ end
1370
+
1371
+ describe '.get_column_font_color' do
1372
+ it 'should correctly reflect font color for column' do
1373
+ @worksheet.change_column_font_color(0,'0f0f0f')
1374
+ @worksheet.get_column_font_color(0).should == '0f0f0f'
1375
+ end
1376
+
1377
+ it 'should cause error if a negative argument is passed in' do
1378
+ lambda {
1379
+ @worksheet.get_column_font_color(-1)
1380
+ }.should raise_error
1381
+ end
1382
+
1383
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1384
+ @worksheet.get_column_font_color(11).should be_nil
1385
+ end
1386
+
1387
+ it 'should return black (000000) if no rgb font color is specified' do
1388
+ @worksheet.get_column_font_color(0).should == '000000'
1389
+ end
1390
+ end
1391
+
1392
+ describe '.is_column_italicized' do
1393
+ it 'should correctly return whether column is italicized' do
1394
+ @worksheet.change_column_italics(0,true)
1395
+ @worksheet.is_column_italicized(0).should == true
1396
+ end
1397
+
1398
+ it 'should cause error if a negative argument is passed in' do
1399
+ lambda {
1400
+ @worksheet.is_column_italicized(-1)
1401
+ }.should raise_error
1402
+ end
1403
+
1404
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1405
+ @worksheet.is_column_italicized(11).should be_nil
1406
+ end
1407
+ end
1408
+
1409
+ describe '.is_column_bolded' do
1410
+ it 'should correctly return whether column is bolded' do
1411
+ @worksheet.change_column_bold(0,true)
1412
+ @worksheet.is_column_bolded(0).should == true
1413
+ end
1414
+
1415
+ it 'should cause error if a negative argument is passed in' do
1416
+ lambda {
1417
+ @worksheet.is_column_bolded(-1)
1418
+ }.should raise_error
1419
+ end
1420
+
1421
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1422
+ @worksheet.is_column_bolded(11).should be_nil
1423
+ end
1424
+ end
1425
+
1426
+ describe '.is_column_underlined' do
1427
+ it 'should correctly return whether column is underlined' do
1428
+ @worksheet.change_column_underline(0,true)
1429
+ @worksheet.is_column_underlined(0).should == true
1430
+ end
1431
+
1432
+ it 'should cause error if a negative argument is passed in' do
1433
+ lambda {
1434
+ @worksheet.is_column_underlined(-1)
1435
+ }.should raise_error
1436
+ end
1437
+
1438
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1439
+ @worksheet.is_column_underlined(11).should be_nil
1440
+ end
1441
+ end
1442
+
1443
+ describe '.is_column_struckthrough' do
1444
+ it 'should correctly return whether column is struckthrough' do
1445
+ @worksheet.change_column_strikethrough(0,true)
1446
+ @worksheet.is_column_struckthrough(0).should == true
1447
+ end
1448
+
1449
+ it 'should cause error if a negative argument is passed in' do
1450
+ lambda {
1451
+ @worksheet.is_column_struckthrough(-1)
1452
+ }.should raise_error
1453
+ end
1454
+
1455
+ it 'should return nil if a (nonnegative) column which does not exist is passed in' do
1456
+ @worksheet.is_column_struckthrough(11).should be_nil
1457
+ end
1458
+ end
1459
+
1460
+ describe '.get_column_width' do
1461
+ it 'should return 10 (base column width) if no width specified for column' do
1462
+ @worksheet.get_column_width(0).should == 10
1463
+ end
1464
+
1465
+ it 'should correctly reflect width if specified for column' do
1466
+ @worksheet.change_column_width(0, 30)
1467
+ @worksheet.get_column_width(0).should == 30
1468
+ end
1469
+
1470
+ it 'should return nil if a column which does not exist is passed in' do
1471
+ @worksheet.get_column_width(11).should be_nil
1472
+ end
1473
+
1474
+ it 'should cause error if a negative argument is passed in' do
1475
+ lambda {
1476
+ @worksheet.get_column_width(-1)
1477
+ }.should raise_error
1478
+ end
1479
+ end
1480
+
1481
+ describe '.get_column_fill' do
1482
+ it 'should return white (ffffff) if no fill color specified for column' do
1483
+ @worksheet.get_column_fill(0).should == 'ffffff'
1484
+ end
1485
+
1486
+ it 'should correctly reflect fill color if specified for column' do
1487
+ @worksheet.change_column_fill(0, '000000')
1488
+ @worksheet.get_column_fill(0).should == '000000'
1489
+ end
1490
+
1491
+ it 'should return nil if a column which does not exist is passed in' do
1492
+ @worksheet.get_column_fill(11).should be_nil
1493
+ end
1494
+
1495
+ it 'should cause error if a negative argument is passed in' do
1496
+ lambda {
1497
+ @worksheet.get_column_fill(-1)
1498
+ }.should raise_error
1499
+ end
1500
+ end
1501
+
1502
+ describe '.get_column_horizontal_alignment' do
1503
+ it 'should return nil if no alignment specified for column' do
1504
+ @worksheet.get_column_horizontal_alignment(0).should be_nil
1505
+ end
1506
+
1507
+ it 'should return nil if a column which does not exist is passed in' do
1508
+ @worksheet.get_column_horizontal_alignment(11).should be_nil
1509
+ end
1510
+
1511
+ it 'should cause error if a negative argument is passed in' do
1512
+ lambda {
1513
+ @worksheet.get_column_horizontal_alignment(-1)
1514
+ }.should raise_error
1515
+ end
1516
+
1517
+ it 'should return correct horizontal alignment if it is set for that column' do
1518
+ @worksheet.change_column_horizontal_alignment(0, 'center')
1519
+ @worksheet.get_column_horizontal_alignment(0).should == 'center'
1520
+ end
1521
+ end
1522
+
1523
+ describe '.get_column_vertical_alignment' do
1524
+ it 'should return nil if no alignment specified for column' do
1525
+ @worksheet.get_column_vertical_alignment(0).should be_nil
1526
+ end
1527
+
1528
+ it 'should return nil if a column which does not exist is passed in' do
1529
+ @worksheet.get_column_vertical_alignment(11).should be_nil
1530
+ end
1531
+
1532
+ it 'should cause error if a negative argument is passed in' do
1533
+ lambda {
1534
+ @worksheet.get_column_vertical_alignment(-1)
1535
+ }.should raise_error
1536
+ end
1537
+
1538
+ it 'should return correct vertical alignment if it is set for that column' do
1539
+ @worksheet.change_column_vertical_alignment(0, 'center')
1540
+ @worksheet.get_column_vertical_alignment(0).should == 'center'
1541
+ end
1542
+ end
1543
+
1544
+ describe '.get_column_border_top' do
1545
+ it 'should return nil if no border is specified for that column in that direction' do
1546
+ @worksheet.get_column_border_top(0).should be_nil
1547
+ end
1548
+
1549
+ it 'should return type of border that this column has on top' do
1550
+ @worksheet.change_column_border_top(0,'thin')
1551
+ @worksheet.get_column_border_top(0).should == 'thin'
1552
+ end
1553
+
1554
+ it 'should cause error if a negative argument is passed in' do
1555
+ lambda {
1556
+ @worksheet.get_column_border_top(-1)
1557
+ }.should raise_error
1558
+ end
1559
+
1560
+ it 'should return nil if a column which does not exist is passed in' do
1561
+ @worksheet.get_column_border_top(11).should be_nil
1562
+ end
1563
+ end
1564
+
1565
+ describe '.get_column_border_left' do
1566
+ it 'should return nil if no border is specified for that column in that direction' do
1567
+ @worksheet.get_column_border_left(0).should be_nil
1568
+ end
1569
+
1570
+ it 'should return type of border that this column has on left' do
1571
+ @worksheet.change_column_border_left(0,'thin')
1572
+ @worksheet.get_column_border_left(0).should == 'thin'
1573
+ end
1574
+
1575
+ it 'should cause error if a negative argument is passed in' do
1576
+ lambda {
1577
+ @worksheet.get_column_border_left(-1)
1578
+ }.should raise_error
1579
+ end
1580
+
1581
+ it 'should return nil if a column which does not exist is passed in' do
1582
+ @worksheet.get_column_border_left(11).should be_nil
1583
+ end
1584
+ end
1585
+
1586
+ describe '.get_column_border_right' do
1587
+ it 'should return nil if no border is specified for that column in that direction' do
1588
+ @worksheet.get_column_border_right(0).should be_nil
1589
+ end
1590
+
1591
+ it 'should return type of border that this column has on right' do
1592
+ @worksheet.change_column_border_right(0,'thin')
1593
+ @worksheet.get_column_border_right(0).should == 'thin'
1594
+ end
1595
+
1596
+ it 'should cause error if a negative argument is passed in' do
1597
+ lambda {
1598
+ @worksheet.get_column_border_right(-1)
1599
+ }.should raise_error
1600
+ end
1601
+
1602
+ it 'should return nil if a column which does not exist is passed in' do
1603
+ @worksheet.get_column_border_right(11).should be_nil
1604
+ end
1605
+ end
1606
+
1607
+
1608
+ describe '.get_column_border_bottom' do
1609
+ it 'should return nil if no border is specified for that column in that direction' do
1610
+ @worksheet.get_column_border_bottom(0).should be_nil
1611
+ end
1612
+
1613
+ it 'should return type of border that this column has on bottom' do
1614
+ @worksheet.change_column_border_bottom(0,'thin')
1615
+ @worksheet.get_column_border_bottom(0).should == 'thin'
1616
+ end
1617
+
1618
+ it 'should cause error if a negative argument is passed in' do
1619
+ lambda {
1620
+ @worksheet.get_column_border_bottom(-1)
1621
+ }.should raise_error
1622
+ end
1623
+
1624
+ it 'should return nil if a column which does not exist is passed in' do
1625
+ @worksheet.get_column_border_bottom(11).should be_nil
1626
+ end
1627
+ end
1628
+
1629
+ describe '.get_column_border_diagonal' do
1630
+ it 'should return nil if no border is specified for that column in that direction' do
1631
+ @worksheet.get_column_border_diagonal(0).should be_nil
1632
+ end
1633
+
1634
+ it 'should return type of border that this column has on diagonal' do
1635
+ @worksheet.change_column_border_diagonal(0,'thin')
1636
+ @worksheet.get_column_border_diagonal(0).should == 'thin'
1637
+ end
1638
+
1639
+ it 'should cause error if a negative argument is passed in' do
1640
+ lambda {
1641
+ @worksheet.get_column_border_diagonal(-1)
1642
+ }.should raise_error
1643
+ end
1644
+
1645
+ it 'should return nil if a column which does not exist is passed in' do
1646
+ @worksheet.get_column_border_diagonal(11).should be_nil
1647
+ end
1648
+ end
1649
+
1650
+ end