491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
# File 'lib/spreadsheet/excel/writer/workbook.rb', line 491
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
|