Class: MergedCellsRecord

Inherits:
BiffRecord show all
Defined in:
lib/surpass/biff_record.rb

Overview

This record contains all merged cell ranges of the current sheet.

Record MERGEDCELLS, BIFF8:

Offset Size Contents 0 var. Cell range address list with all merged ranges


A cell range address list consists of a field with the number of ranges and the list of the range addresses.

Cell range address list, BIFF8:

Offset Size Contents 0 2 Number of following cell range addresses (nm) 2 8*nm List of nm cell range addresses


Cell range address, BIFF8:

Offset Size Contents 0 2 Index to first row 2 2 Index to last row 4 2 Index to first column 6 2 Index to last column

Constant Summary collapse

RECORD_ID =
0x00E5

Constants inherited from BiffRecord

BiffRecord::BIFF_LIMIT, BiffRecord::CONTINUE_RECORD_ID

Instance Attribute Summary

Attributes inherited from BiffRecord

#record_data

Instance Method Summary collapse

Methods inherited from BiffRecord

#record_header

Constructor Details

#initialize(merged_list) ⇒ MergedCellsRecord

Returns a new instance of MergedCellsRecord.



1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
# File 'lib/surpass/biff_record.rb', line 1302

def initialize(merged_list)
  @record_data = ''
  
  i = merged_list.length - 1
  while i >= 0 do
    j = 0
    merged = ''
    while (i >= 0) && (j < 0x403) do
      r1, r2, c1, c2 = merged_list[i]
      merged += [r1, r2, c1, c2].pack('v4')
      i -= 1
      j += 1
    end
    @record_data += [RECORD_ID, merged.length + 2, j].pack('v3') + merged
  end
end

Instance Method Details

#to_biffObject

for some reason Excel doesn’t use CONTINUE



1320
1321
1322
# File 'lib/surpass/biff_record.rb', line 1320

def to_biff
  @record_data
end