Module: Spreadsheet::Excel::Reader::Biff5

Defined in:
lib/spreadsheet/excel/reader/biff5.rb

Overview

of Excel grows.

Instance Method Summary collapse

Instance Method Details

#read_range_address_list(work, len) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/spreadsheet/excel/reader/biff5.rb', line 20

def read_range_address_list work, len
  # Cell range address, BIFF2-BIFF5:
  # Offset  Size  Contents
  # 0       2     Index to first row
  # 2       2     Index to last row
  # 4       1     Index to first column
  # 5       1     Index to last column
  #
  offset = 0, results = []
  return results if len < 2
  count = work[0..1].unpack('v').first
  offset = 2
  count.times do |i|
    results << work[offset...offset+6].unpack('v2c2')
    offset += 6
  end
  results
end

#read_string(work, count_length = 1) ⇒ Object

Read a String of 8-bit Characters



11
12
13
14
15
16
17
18
# File 'lib/spreadsheet/excel/reader/biff5.rb', line 11

def read_string work, count_length=1
  # Offset    Size  Contents
  #      0  1 or 2  Length of the string (character count, ln)
  # 1 or 2      ln  Character array (8-bit characters)
  fmt = count_length == 1 ? 'C' : 'v'
  length, = work.unpack fmt
  work[count_length, length]
end