writeexcel 1.0.5 → 1.0.6

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 (69) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +8 -0
  3. data/README.rdoc +5 -0
  4. data/lib/writeexcel/biffwriter.rb +2 -1
  5. data/lib/writeexcel/chart.rb +2 -3
  6. data/lib/writeexcel/charts/area.rb +1 -1
  7. data/lib/writeexcel/charts/pie.rb +1 -1
  8. data/lib/writeexcel/charts/scatter.rb +1 -1
  9. data/lib/writeexcel/charts/stock.rb +1 -1
  10. data/lib/writeexcel/col_info.rb +2 -2
  11. data/lib/writeexcel/comments.rb +1 -1
  12. data/lib/writeexcel/convert_date_time.rb +7 -7
  13. data/lib/writeexcel/excelformulaparser.rb +49 -49
  14. data/lib/writeexcel/format.rb +1 -1
  15. data/lib/writeexcel/formula.rb +1 -1
  16. data/lib/writeexcel/helper.rb +3 -3
  17. data/lib/writeexcel/properties.rb +1 -1
  18. data/lib/writeexcel/shared_string_table.rb +5 -5
  19. data/lib/writeexcel/storage_lite.rb +2 -9
  20. data/lib/writeexcel/version.rb +1 -1
  21. data/lib/writeexcel/workbook.rb +13 -14
  22. data/lib/writeexcel/worksheet.rb +43 -35
  23. data/test/helper.rb +12 -4
  24. data/test/test_00_IEEE_double.rb +1 -1
  25. data/test/test_04_dimensions.rb +2 -2
  26. data/test/test_05_rows.rb +1 -1
  27. data/test/test_06_extsst.rb +1 -1
  28. data/test/test_11_date_time.rb +1 -1
  29. data/test/test_12_date_only.rb +1 -1
  30. data/test/test_13_date_seconds.rb +1 -1
  31. data/test/test_21_escher.rb +1 -1
  32. data/test/test_22_mso_drawing_group.rb +1 -1
  33. data/test/test_23_note.rb +1 -1
  34. data/test/test_24_txo.rb +1 -1
  35. data/test/test_25_position_object.rb +1 -1
  36. data/test/test_26_autofilter.rb +1 -1
  37. data/test/test_27_autofilter.rb +1 -1
  38. data/test/test_28_autofilter.rb +1 -1
  39. data/test/test_29_process_jpg.rb +1 -43
  40. data/test/test_30_validation_dval.rb +1 -1
  41. data/test/test_31_validation_dv_strings.rb +1 -1
  42. data/test/test_32_validation_dv_formula.rb +1 -1
  43. data/test/test_40_property_types.rb +1 -1
  44. data/test/test_41_properties.rb +1 -1
  45. data/test/test_42_set_properties.rb +2 -2
  46. data/test/test_50_name_stored.rb +1 -9
  47. data/test/test_51_name_print_area.rb +3 -13
  48. data/test/test_52_name_print_titles.rb +3 -21
  49. data/test/test_53_autofilter.rb +1 -5
  50. data/test/test_60_chart_generic.rb +3 -3
  51. data/test/test_61_chart_subclasses.rb +2 -1
  52. data/test/test_62_chart_formats.rb +9 -21
  53. data/test/test_63_chart_area_formats.rb +1 -1
  54. data/test/test_compatibility.rb +1 -1
  55. data/test/test_example_match.rb +835 -835
  56. data/test/test_format.rb +1 -114
  57. data/test/test_formula.rb +1 -1
  58. data/test/test_properties.rb +1 -2
  59. data/test/test_storage_lite.rb +2 -2
  60. data/test/test_workbook.rb +1 -66
  61. data/test/test_worksheet.rb +1 -18
  62. data/test/test_write_formula_does_not_change_formula_string.rb +1 -1
  63. data/writeexcel.gemspec +3 -2
  64. metadata +23 -20
  65. data/test/test_01_add_worksheet.rb +0 -43
  66. data/test/test_02_merge_formats.rb +0 -49
  67. data/test/test_biff.rb +0 -71
  68. data/test/test_big_workbook.rb +0 -17
  69. data/test/test_ole.rb +0 -102
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e036ee78c56e41a25c0c346a2cbc93b579e4f54d
4
- data.tar.gz: 20f79a79efa1699803e993ee52aa70665baabcea
2
+ SHA256:
3
+ metadata.gz: aef741d4929e644f22197dc922a779d1049e686bcda4458f8fdd07a1dc6d45a0
4
+ data.tar.gz: 7431195b6609b5220f0a72cab8df664594c2ad1a1f2124187fe13515c2dd9d16
5
5
  SHA512:
6
- metadata.gz: 1bb714fcc9f5a3ce118732cce6e4b21623237831ee25d5ab90970320140bc716cb88907ef3326f758f2a909fbdee8f45f1b9d926a72081361cd57d5fc11333a5
7
- data.tar.gz: 8b89087c85738f136750da5673e3e0fb4bf95158053dbb9d8d00345715c30d22d8372e68d7c1efddc6674a6a9537ed89b46c9d37ca0d4ca0e15e8a188b2b900a
6
+ metadata.gz: ced7ba9cea632a819acd69fd242a03939abd331eca99f3ff2604ea8429998fd467ee795bbbbef5a6ce1b3f66ed970b57583f6d0c85f9aefc311247aaba39c5ae
7
+ data.tar.gz: 38955288d47faa5dc1ec3b8aad5960b0bcac352b61c8503b975eb1c0446ae41785a306b84952797883621cc38f241a9e3343b364f5b8060abee869221fbff1aa
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.1.2
6
+ - 2.1.1
7
+ - 2.0.0
8
+ - 1.9.3
data/README.rdoc CHANGED
@@ -3,6 +3,7 @@
3
3
  Write to a cross-platform Excel binary file.
4
4
 
5
5
  {<img src="https://badge.fury.io/rb/writeexcel.png" alt="Gem Version" />}[http://badge.fury.io/rb/writeexcel]
6
+ {<img src="https://travis-ci.org/cxn03651/writeexcel.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/cxn03651/writeexcel]
6
7
 
7
8
  == Description
8
9
 
@@ -84,6 +85,10 @@ Example Code:
84
85
  * and ......
85
86
 
86
87
  == Recent Change
88
+ v1.0.6
89
+ * support Ruby 3.2
90
+ * use minitest gem instead of test-unit.
91
+
87
92
  v1.0.5
88
93
  * use test-unit gem instead of test/unit.
89
94
 
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # BIFFwriter - An abstract base class for Excel workbooks and worksheets.
4
5
  #
@@ -187,7 +188,7 @@ class BIFFWriter < WriteFile #:nodoc:
187
188
  # The header contains version and instance info packed into 2 bytes.
188
189
  header = version | (instance << 4)
189
190
 
190
- record = [header, type, length].pack('vvV') + data
191
+ [header, type, length].pack('vvV') + data
191
192
  end
192
193
 
193
194
  def not_using_tmpfile
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  ###############################################################################
3
4
  #
4
5
  # Chart - A writer class for Excel Charts.
@@ -649,8 +650,6 @@ class Chart < Worksheet
649
650
  # information required for _store_series() and the SERIES record.
650
651
  #
651
652
  def parse_series_formula(formula) # :nodoc:
652
- encoding = 0
653
- length = 0
654
653
  count = 0
655
654
  tokens = []
656
655
 
@@ -677,7 +676,7 @@ class Chart < Worksheet
677
676
 
678
677
  # Extract the range from the parse formula.
679
678
  if formula.ord == 0x3B
680
- ptg, ext_ref, row_1, row_2, col_1, col_2 = formula.unpack('Cv5')
679
+ row_1, row_2 = formula.unpack('Cv5')[2, 2]
681
680
 
682
681
  # TODO. Remove high bit on relative references.
683
682
  count = row_2 - row_1 + 1
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -54,9 +54,9 @@ class Worksheet < BIFFWriter
54
54
 
55
55
  def ixfe
56
56
  if @format && @format.respond_to?(:xf_index)
57
- ixfe = @format.xf_index
57
+ @format.xf_index
58
58
  else
59
- ixfe = 0x0F
59
+ 0x0F
60
60
  end
61
61
  end
62
62
 
@@ -252,7 +252,7 @@ class Worksheet < BIFFWriter
252
252
  when 65533 then 65529
253
253
  when 65534 then 65530
254
254
  when 65535 then 65531
255
- else @row -1
255
+ else @row - 1
256
256
  end
257
257
  end
258
258
 
@@ -81,7 +81,7 @@ module ConvertDateTime
81
81
  epoch = date_1904 ? 1904 : 1900
82
82
  offset = date_1904 ? 4 : 0
83
83
  norm = 300
84
- range = year -epoch
84
+ range = year - epoch
85
85
 
86
86
  # Set month days and check for leap year.
87
87
  mdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
@@ -92,15 +92,15 @@ module ConvertDateTime
92
92
  # Some boundary checks
93
93
  return nil if year < epoch or year > 9999
94
94
  return nil if month < 1 or month > 12
95
- return nil if day < 1 or day > mdays[month -1]
95
+ return nil if day < 1 or day > mdays[month - 1]
96
96
 
97
97
  # Accumulate the number of days since the epoch.
98
98
  days = mdays[0, month - 1].inject(day) {|result, mday| result + mday} # days from 1, Jan
99
- days += range *365 # Add days for past years
100
- days += ((range) / 4) # Add leapdays
101
- days -= ((range + offset) /100) # Subtract 100 year leapdays
102
- days += ((range + offset + norm)/400) # Add 400 year leapdays
103
- days -= leap # Already counted above
99
+ days += range * 365 # Add days for past years
100
+ days += ((range) / 4) # Add leapdays
101
+ days -= ((range + offset) / 100) # Subtract 100 year leapdays
102
+ days += ((range + offset + norm) / 400) # Add 400 year leapdays
103
+ days -= leap # Already counted above
104
104
 
105
105
  # Adjust for Excel erroneously treating 1900 as a leap year.
106
106
  days += 1 if !date_1904 and days > 59
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # DO NOT MODIFY!!!!
4
5
  # This file is automatically generated by Racc 1.4.11
@@ -293,14 +294,14 @@ Racc_debug_parser = false
293
294
 
294
295
  module_eval(<<'.,.,', 'excelformula.y', 20)
295
296
  def _reduce_2(val, _values, result)
296
- result = []
297
+ result = []
297
298
  result
298
299
  end
299
300
  .,.,
300
301
 
301
302
  module_eval(<<'.,.,', 'excelformula.y', 21)
302
303
  def _reduce_3(val, _values, result)
303
- result.push val[1], '_arg', '1'
304
+ result.push val[1], '_arg', '1'
304
305
  result
305
306
  end
306
307
  .,.,
@@ -309,84 +310,84 @@ module_eval(<<'.,.,', 'excelformula.y', 21)
309
310
 
310
311
  module_eval(<<'.,.,', 'excelformula.y', 24)
311
312
  def _reduce_5(val, _values, result)
312
- result = [ val[0], val[2], 'ptgAdd' ]
313
+ result = [ val[0], val[2], 'ptgAdd' ]
313
314
  result
314
315
  end
315
316
  .,.,
316
317
 
317
318
  module_eval(<<'.,.,', 'excelformula.y', 25)
318
319
  def _reduce_6(val, _values, result)
319
- result = [ val[0], val[2], 'ptgSub' ]
320
+ result = [ val[0], val[2], 'ptgSub' ]
320
321
  result
321
322
  end
322
323
  .,.,
323
324
 
324
325
  module_eval(<<'.,.,', 'excelformula.y', 26)
325
326
  def _reduce_7(val, _values, result)
326
- result = [ val[0], val[2], 'ptgMul' ]
327
+ result = [ val[0], val[2], 'ptgMul' ]
327
328
  result
328
329
  end
329
330
  .,.,
330
331
 
331
332
  module_eval(<<'.,.,', 'excelformula.y', 27)
332
333
  def _reduce_8(val, _values, result)
333
- result = [ val[0], val[2], 'ptgDiv' ]
334
+ result = [ val[0], val[2], 'ptgDiv' ]
334
335
  result
335
336
  end
336
337
  .,.,
337
338
 
338
339
  module_eval(<<'.,.,', 'excelformula.y', 28)
339
340
  def _reduce_9(val, _values, result)
340
- result = [ val[0], val[2], 'ptgPower' ]
341
+ result = [ val[0], val[2], 'ptgPower' ]
341
342
  result
342
343
  end
343
344
  .,.,
344
345
 
345
346
  module_eval(<<'.,.,', 'excelformula.y', 29)
346
347
  def _reduce_10(val, _values, result)
347
- result = [ val[0], val[2], 'ptgConcat' ]
348
+ result = [ val[0], val[2], 'ptgConcat' ]
348
349
  result
349
350
  end
350
351
  .,.,
351
352
 
352
353
  module_eval(<<'.,.,', 'excelformula.y', 30)
353
354
  def _reduce_11(val, _values, result)
354
- result = [ val[0], val[2], 'ptgLT' ]
355
+ result = [ val[0], val[2], 'ptgLT' ]
355
356
  result
356
357
  end
357
358
  .,.,
358
359
 
359
360
  module_eval(<<'.,.,', 'excelformula.y', 31)
360
361
  def _reduce_12(val, _values, result)
361
- result = [ val[0], val[2], 'ptgGT' ]
362
+ result = [ val[0], val[2], 'ptgGT' ]
362
363
  result
363
364
  end
364
365
  .,.,
365
366
 
366
367
  module_eval(<<'.,.,', 'excelformula.y', 32)
367
368
  def _reduce_13(val, _values, result)
368
- result = [ val[0], val[2], 'ptgLE' ]
369
+ result = [ val[0], val[2], 'ptgLE' ]
369
370
  result
370
371
  end
371
372
  .,.,
372
373
 
373
374
  module_eval(<<'.,.,', 'excelformula.y', 33)
374
375
  def _reduce_14(val, _values, result)
375
- result = [ val[0], val[2], 'ptgGE' ]
376
+ result = [ val[0], val[2], 'ptgGE' ]
376
377
  result
377
378
  end
378
379
  .,.,
379
380
 
380
381
  module_eval(<<'.,.,', 'excelformula.y', 34)
381
382
  def _reduce_15(val, _values, result)
382
- result = [ val[0], val[2], 'ptgNE' ]
383
+ result = [ val[0], val[2], 'ptgNE' ]
383
384
  result
384
385
  end
385
386
  .,.,
386
387
 
387
388
  module_eval(<<'.,.,', 'excelformula.y', 35)
388
389
  def _reduce_16(val, _values, result)
389
- result = [ val[0], val[2], 'ptgEQ' ]
390
+ result = [ val[0], val[2], 'ptgEQ' ]
390
391
  result
391
392
  end
392
393
  .,.,
@@ -395,14 +396,14 @@ module_eval(<<'.,.,', 'excelformula.y', 35)
395
396
 
396
397
  module_eval(<<'.,.,', 'excelformula.y', 38)
397
398
  def _reduce_18(val, _values, result)
398
- result = [ val[1], '_arg', '1', 'ptgParen']
399
+ result = [ val[1], '_arg', '1', 'ptgParen']
399
400
  result
400
401
  end
401
402
  .,.,
402
403
 
403
404
  module_eval(<<'.,.,', 'excelformula.y', 39)
404
405
  def _reduce_19(val, _values, result)
405
- result = [ '_num', '-1', val[1], 'ptgMul' ]
406
+ result = [ '_num', '-1', val[1], 'ptgMul' ]
406
407
  result
407
408
  end
408
409
  .,.,
@@ -411,63 +412,63 @@ module_eval(<<'.,.,', 'excelformula.y', 39)
411
412
 
412
413
  module_eval(<<'.,.,', 'excelformula.y', 41)
413
414
  def _reduce_21(val, _values, result)
414
- result = [ '_num', val[0] ]
415
+ result = [ '_num', val[0] ]
415
416
  result
416
417
  end
417
418
  .,.,
418
419
 
419
420
  module_eval(<<'.,.,', 'excelformula.y', 42)
420
421
  def _reduce_22(val, _values, result)
421
- result = [ '_str', val[0] ]
422
+ result = [ '_str', val[0] ]
422
423
  result
423
424
  end
424
425
  .,.,
425
426
 
426
427
  module_eval(<<'.,.,', 'excelformula.y', 43)
427
428
  def _reduce_23(val, _values, result)
428
- result = [ '_ref2d', val[0] ]
429
+ result = [ '_ref2d', val[0] ]
429
430
  result
430
431
  end
431
432
  .,.,
432
433
 
433
434
  module_eval(<<'.,.,', 'excelformula.y', 44)
434
435
  def _reduce_24(val, _values, result)
435
- result = [ '_ref3d', val[0] ]
436
+ result = [ '_ref3d', val[0] ]
436
437
  result
437
438
  end
438
439
  .,.,
439
440
 
440
441
  module_eval(<<'.,.,', 'excelformula.y', 45)
441
442
  def _reduce_25(val, _values, result)
442
- result = [ '_range2d', val[0] ]
443
+ result = [ '_range2d', val[0] ]
443
444
  result
444
445
  end
445
446
  .,.,
446
447
 
447
448
  module_eval(<<'.,.,', 'excelformula.y', 46)
448
449
  def _reduce_26(val, _values, result)
449
- result = [ '_range3d', val[0] ]
450
+ result = [ '_range3d', val[0] ]
450
451
  result
451
452
  end
452
453
  .,.,
453
454
 
454
455
  module_eval(<<'.,.,', 'excelformula.y', 47)
455
456
  def _reduce_27(val, _values, result)
456
- result = [ '_name', val[0] ]
457
+ result = [ '_name', val[0] ]
457
458
  result
458
459
  end
459
460
  .,.,
460
461
 
461
462
  module_eval(<<'.,.,', 'excelformula.y', 48)
462
463
  def _reduce_28(val, _values, result)
463
- result = [ 'ptgBool', '1' ]
464
+ result = [ 'ptgBool', '1' ]
464
465
  result
465
466
  end
466
467
  .,.,
467
468
 
468
469
  module_eval(<<'.,.,', 'excelformula.y', 49)
469
470
  def _reduce_29(val, _values, result)
470
- result = [ 'ptgBool', '0' ]
471
+ result = [ 'ptgBool', '0' ]
471
472
  result
472
473
  end
473
474
  .,.,
@@ -476,28 +477,28 @@ module_eval(<<'.,.,', 'excelformula.y', 49)
476
477
 
477
478
  module_eval(<<'.,.,', 'excelformula.y', 52)
478
479
  def _reduce_31(val, _values, result)
479
- result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
480
+ result = [ '_class', val[0], val[2], '_arg', val[2].size.to_s, '_func', val[0] ]
480
481
  result
481
482
  end
482
483
  .,.,
483
484
 
484
485
  module_eval(<<'.,.,', 'excelformula.y', 53)
485
486
  def _reduce_32(val, _values, result)
486
- result = [ '_func', val[0] ]
487
+ result = [ '_func', val[0] ]
487
488
  result
488
489
  end
489
490
  .,.,
490
491
 
491
492
  module_eval(<<'.,.,', 'excelformula.y', 55)
492
493
  def _reduce_33(val, _values, result)
493
- result = val
494
+ result = val
494
495
  result
495
496
  end
496
497
  .,.,
497
498
 
498
499
  module_eval(<<'.,.,', 'excelformula.y', 56)
499
500
  def _reduce_34(val, _values, result)
500
- result.push val[2]
501
+ result.push val[2]
501
502
  result
502
503
  end
503
504
  .,.,
@@ -515,70 +516,69 @@ end
515
516
  module Writeexcel
516
517
 
517
518
  class Node # :nodoc:
518
-
519
+
519
520
  def exec_list(nodes)
520
521
  v = nil
521
522
  nodes.each { |i| v = i.evaluate }
522
523
  v
523
524
  end
524
-
525
+
525
526
  def excelformulaparser_error(msg)
526
527
  raise ExcelFormulaParserError,
527
528
  "in #{fname}:#{lineno}: #{msg}"
528
529
  end
529
-
530
+
530
531
  end
531
-
532
+
532
533
  class RootNode < Node # :nodoc:
533
-
534
+
534
535
  def initialize(tree)
535
536
  @tree = tree
536
537
  end
537
-
538
+
538
539
  def evaluate
539
540
  exec_list @tree
540
541
  end
541
-
542
+
542
543
  end
543
-
544
-
544
+
545
+
545
546
  class FuncallNode < Node # :nodoc:
546
-
547
+
547
548
  def initialize(func, args)
548
549
  @func = func
549
550
  @args = args
550
551
  end
551
-
552
+
552
553
  def evaluate
553
554
  arg = @args.collect {|i| i.evaluate }
554
- out = []
555
555
  arg.each { |i| o.push i }
556
556
  o.push @func
557
557
  p o
558
558
  end
559
-
559
+
560
560
  end
561
-
561
+
562
562
  class NumberNode < Node # :nodoc:
563
-
563
+
564
564
  def initialize(val)
565
565
  @val = val
566
566
  end
567
-
567
+
568
568
  def evaluate
569
569
  p @val
570
570
  end
571
-
571
+
572
572
  end
573
-
573
+
574
574
  class OperateNode < Node # :nodoc:
575
-
575
+
576
576
  def initialize(op, left, right)
577
577
  @op = op
578
578
  @left = left
579
579
  @right = right
580
580
  end
581
-
581
+
582
582
  def evaluate
583
583
  o = []
584
584
  o.push @left
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  ##############################################################################
3
4
  #
4
5
  # Format - A class for defining Excel formatting.
@@ -1572,4 +1573,3 @@ class Format < Colors
1572
1573
  end # class Format
1573
1574
 
1574
1575
  end # module Writeexcel
1575
-
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  ###############################################################################
3
4
  #
4
5
  # Formula - A class for generating Excel formulas.
@@ -62,7 +63,6 @@ class Formula < ExcelFormulaParser #:nodoc:
62
63
  #
63
64
  def parse_tokens(tokens)
64
65
  parse_str = ''
65
- last_type = ''
66
66
  modifier = ''
67
67
  num_args = 0
68
68
  _class = 0
@@ -42,9 +42,9 @@
42
42
  private :utf8_to_16le
43
43
 
44
44
  def ascii_to_16be(ascii)
45
- ascii.unpack("C*").pack("n*")
46
- ruby_19 { ascii.force_encoding('UTF-16BE') }
47
- ascii
45
+ str_16be = ascii.unpack("C*").pack("n*")
46
+ ruby_19 { str_16be.force_encoding('UTF-16BE') }
47
+ str_16be
48
48
  end
49
49
  private :ascii_to_16be
50
50
 
@@ -178,7 +178,7 @@ end
178
178
  #
179
179
  def pack_VT_I2(value) #:nodoc:
180
180
  type = 0x0002
181
- data = [type, value].pack('VV')
181
+ [type, value].pack('VV')
182
182
  end
183
183
 
184
184
  ###############################################################################
@@ -109,10 +109,10 @@ class Workbook < BIFFWriter
109
109
  written += space_remaining
110
110
 
111
111
  # Reduce the current block length by the amount written
112
- block_length -= continue_limit -continue -align
112
+ block_length -= continue_limit - continue - align
113
113
 
114
114
  # Store the max size for this block
115
- block_sizes.push(continue_limit -align)
115
+ block_sizes.push(continue_limit - align)
116
116
 
117
117
  # If the current string was split then the next CONTINUE block
118
118
  # should have the string continue flag (grbit) set unless the
@@ -125,10 +125,10 @@ class Workbook < BIFFWriter
125
125
  end
126
126
  else
127
127
  # Store the max size for this block
128
- block_sizes.push(written +continue)
128
+ block_sizes.push(written + continue)
129
129
 
130
130
  # Not enough space to start the string in the current block
131
- block_length -= continue_limit -space_remaining -continue
131
+ block_length -= continue_limit - space_remaining - continue
132
132
  continue = 0
133
133
  end
134
134
 
@@ -145,7 +145,7 @@ class Workbook < BIFFWriter
145
145
  end
146
146
 
147
147
  # Store the max size for the last block unless it is empty
148
- block_sizes.push(written +continue) if written +continue != 0
148
+ block_sizes.push(written + continue) if written + continue != 0
149
149
 
150
150
  block_sizes
151
151
  end
@@ -55,8 +55,6 @@ class OLEStorageLite #:nodoc:
55
55
  end
56
56
  done << no
57
57
 
58
- rootblock = info[:root_start]
59
-
60
58
  #1. Get Information about itself
61
59
  pps = _getNthPps(no, info, data)
62
60
 
@@ -76,7 +74,6 @@ class OLEStorageLite #:nodoc:
76
74
  private :_getPpsTree
77
75
 
78
76
  def _getPpsSearch(no, info, name, data, icase, done = nil)
79
- rootblock = info[:root_start]
80
77
  #1. Check it self
81
78
  if done
82
79
  return [] if done.include?(no)
@@ -589,7 +586,6 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
589
586
  rh_info[:fileh] = sFile.binmode
590
587
  end
591
588
 
592
- iBlk = 0
593
589
  #1. Make an array of PPS (for Save)
594
590
  aList=[]
595
591
  if bNoAs
@@ -728,7 +724,6 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
728
724
  private :_saveHeader
729
725
 
730
726
  def _saveBigData(iStBlk, aList, rh_info)
731
- iRes = 0
732
727
  file = rh_info[:fileh]
733
728
 
734
729
  #1.Write Big (ge 0x1000) Data into Block
@@ -810,7 +805,7 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
810
805
  aPrev = aWk[0, iPos]
811
806
  aWk[0..iPos-1] = []
812
807
  aNext = aWk[1, iCnt - iPos - 1]
813
- aWk[1..(1 + iCnt - iPos -1 -1)] = []
808
+ aWk[1..(1 + iCnt - iPos - 1 - 1)] = []
814
809
  pps_array[iPos].prev_pps = _savePpsSetPnt(aPrev, aList, rh_info)
815
810
  pps_array[iPos].next_pps = _savePpsSetPnt(aNext, aList, rh_info)
816
811
  pps_array[iPos].dir_pps = _savePpsSetPnt(pps_array[iPos].child, aList, rh_info)
@@ -834,12 +829,10 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
834
829
  return pps_array[0].no
835
830
  #1.3 Array
836
831
  else
837
- iCnt = pps_array.size
838
832
  #1.3.1 Define Center
839
833
  iPos = 0 #int($iCnt/ 2); #$iCnt
840
834
 
841
835
  aWk = pps_array.dup
842
- aPrev = aWk[1, 1]
843
836
  aWk[1..1] = []
844
837
  aNext = aWk[1..aWk.size] #, $iCnt - $iPos -1);
845
838
  pps_array[iPos].prev_pps = _savePpsSetPnt2(pps_array, aList, rh_info)
@@ -975,7 +968,7 @@ class OLEStorageLitePPSFile < OLEStorageLitePPS #:nodoc:
975
968
  @pps_file.binmode
976
969
  end
977
970
 
978
- def append (data)
971
+ def append(data)
979
972
  return if data.nil?
980
973
  if @pps_file
981
974
  @pps_file << data
@@ -1,5 +1,5 @@
1
1
  require 'writeexcel'
2
2
 
3
3
  class WriteExcel < Workbook
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.6"
5
5
  end