444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
# File 'lib/spreadsheet/excel/writer/workbook.rb', line 444
def _write_sst workbook, writer, offset, total, strings
sst = {}
worksheets(workbook).each do |worksheet|
offset += worksheet.boundsheet_size
@sst[worksheet] = sst
end
sst_size = strings.size
data = [total, sst_size].pack "V2"
op = 0x00fc
wide = 0
offsets = []
strings.each_with_index do |string, idx|
sst.store string, idx
op_offset = data.size + 4
if idx % SST_CHUNKSIZE == 0
offsets.push [offset + writer.pos + op_offset, op_offset]
end
, packed, next_wide = _unicode_string string, 2
must_fit = .size + wide + 1
while data.size + must_fit > @recordsize_limit
op, data, wide = write_string_part writer, op, data, wide
end
wide = next_wide
data << << packed
end
until data.empty?
op, data, wide = write_string_part writer, op, data, wide
end
write_extsst workbook, offsets, writer
end
|