Class: ExtSSTRecord
- Inherits:
-
BiffRecord
- Object
- BiffRecord
- ExtSSTRecord
- Defined in:
- lib/surpass/biff_record.rb
Overview
This record occurs in conjunction with the SST record. It is used by Excel to create a hash table with stream offsets to the SST record to optimise string search operations. Excel may not shorten this record if strings are deleted from the shared string table, so the last part might contain invalid data. The stream indexes in this record divide the SST into portions containing a constant number of strings.
Record EXTSST, BIFF8:
Offset Size Contents 0 2 Number of strings in a portion, this number is >=8 2 var. List of OFFSET structures for all portions. Each OFFSET contains the following data:
Offset Size Contents
0 4 Absolute stream position of first string of the portion
4 2 Position of first string of the portion inside of current record,
including record header. This counter restarts at zero, if the SST
record is continued with a CONTINUE record.
6 2 Not used
Constant Summary collapse
- RECORD_ID =
0x00FF
Constants inherited from BiffRecord
BiffRecord::BIFF_LIMIT, BiffRecord::CONTINUE_RECORD_ID
Instance Attribute Summary
Attributes inherited from BiffRecord
Instance Method Summary collapse
-
#initialize(sst_stream_pos, str_placement, portions_len) ⇒ ExtSSTRecord
constructor
A new instance of ExtSSTRecord.
Methods inherited from BiffRecord
Constructor Details
#initialize(sst_stream_pos, str_placement, portions_len) ⇒ ExtSSTRecord
Returns a new instance of ExtSSTRecord.
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 |
# File 'lib/surpass/biff_record.rb', line 1041 def initialize(sst_stream_pos, str_placement, portions_len) extsst = {} abs_stream_pos = sst_stream_pos str_counter = 0 portion_counter = 0 while (str_counter < str_placement.length) do str_chunk_num, pos_in_chunk = str_placement[str_counter] if str_chunk_num != portion_counter portion_counter = str_chunk_num abs_stream_pos += portions_len[portion_counter-1] end str_stream_pos = abs_stream_pos + pos_in_chunk + 4 # header extsst[str_counter] = [pos_in_chunk, str_stream_pos] str_counter += 1 end exsst_str_count_delta = [8, str_placement.length*8/0x2000].max @record_data = [exsst_str_count_delta].pack('v') str_counter = 0 while (str_counter < str_placement.length) do @record_data += [extsst[str_counter][1], extsst[str_counter][0], 0].pack('Vvv') str_counter += exsst_str_count_delta end end |