2014-01-28 16:38:02 +00:00
|
|
|
/* [MS-XLSB] 2.4.219 BrtBeginSst */
|
2014-06-29 18:29:45 +00:00
|
|
|
function parse_BrtBeginSst(data, length) {
|
2014-01-28 16:38:02 +00:00
|
|
|
return [data.read_shift(4), data.read_shift(4)];
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-01-28 16:38:02 +00:00
|
|
|
|
|
|
|
/* [MS-XLSB] 2.1.7.45 Shared Strings */
|
2017-03-12 18:02:43 +00:00
|
|
|
function parse_sst_bin(data, opts)/*:SST*/ {
|
|
|
|
var s/*:SST*/ = ([]/*:any*/);
|
2014-03-29 22:53:15 +00:00
|
|
|
var pass = false;
|
2014-06-29 18:29:45 +00:00
|
|
|
recordhopper(data, function hopper_sst(val, R, RT) {
|
2014-01-28 16:38:02 +00:00
|
|
|
switch(R.n) {
|
|
|
|
case 'BrtBeginSst': s.Count = val[0]; s.Unique = val[1]; break;
|
|
|
|
case 'BrtSSTItem': s.push(val); break;
|
|
|
|
case 'BrtEndSst': return true;
|
2014-03-23 21:30:00 +00:00
|
|
|
/* TODO: produce a test case with a future record */
|
2014-03-19 17:53:20 +00:00
|
|
|
case 'BrtFRTBegin': pass = true; break;
|
|
|
|
case 'BrtFRTEnd': pass = false; break;
|
2014-03-23 21:30:00 +00:00
|
|
|
default: if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R.n);
|
2014-01-28 16:38:02 +00:00
|
|
|
}
|
2014-01-29 06:00:09 +00:00
|
|
|
});
|
2014-01-28 16:38:02 +00:00
|
|
|
return s;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-05-16 00:33:34 +00:00
|
|
|
|
2014-07-28 13:22:32 +00:00
|
|
|
function write_BrtBeginSst(sst, o) {
|
|
|
|
if(!o) o = new_buf(8);
|
|
|
|
o.write_shift(4, sst.Count);
|
|
|
|
o.write_shift(4, sst.Unique);
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
var write_BrtSSTItem = write_RichStr;
|
|
|
|
|
|
|
|
function write_sst_bin(sst, opts) {
|
|
|
|
var ba = buf_array();
|
|
|
|
write_record(ba, "BrtBeginSst", write_BrtBeginSst(sst));
|
|
|
|
for(var i = 0; i < sst.length; ++i) write_record(ba, "BrtSSTItem", write_BrtSSTItem(sst[i]));
|
|
|
|
write_record(ba, "BrtEndSst");
|
|
|
|
return ba.end();
|
|
|
|
}
|