2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.304 BrtBundleSh */
|
2017-02-10 19:23:01 +00:00
|
|
|
function parse_BrtBundleSh(data, length/*:number*/) {
|
2014-01-28 16:38:02 +00:00
|
|
|
var z = {};
|
2017-03-31 18:46:42 +00:00
|
|
|
z.Hidden = data.read_shift(4); //hsState ST_SheetState
|
2014-01-28 16:38:02 +00:00
|
|
|
z.iTabID = data.read_shift(4);
|
|
|
|
z.strRelID = parse_RelID(data,length-8);
|
|
|
|
z.name = parse_XLWideString(data);
|
|
|
|
return z;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
|
|
|
function write_BrtBundleSh(data, o) {
|
2014-05-29 22:30:03 +00:00
|
|
|
if(!o) o = new_buf(127);
|
2017-03-31 18:46:42 +00:00
|
|
|
o.write_shift(4, data.Hidden);
|
2014-05-29 22:30:03 +00:00
|
|
|
o.write_shift(4, data.iTabID);
|
|
|
|
write_RelID(data.strRelID, o);
|
2018-01-11 08:01:25 +00:00
|
|
|
write_XLWideString(data.name.slice(0,31), o);
|
2017-02-03 20:50:45 +00:00
|
|
|
return o.length > o.l ? o.slice(0, o.l) : o;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-05-29 22:30:03 +00:00
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.815 BrtWbProp */
|
2017-06-03 07:19:09 +00:00
|
|
|
function parse_BrtWbProp(data, length)/*:WBProps*/ {
|
|
|
|
var o/*:WBProps*/ = ({}/*:any*/);
|
2017-06-01 21:22:11 +00:00
|
|
|
var flags = data.read_shift(4);
|
|
|
|
o.defaultThemeVersion = data.read_shift(4);
|
2014-05-29 22:30:03 +00:00
|
|
|
var strName = (length > 8) ? parse_XLWideString(data) : "";
|
2017-11-20 01:51:14 +00:00
|
|
|
if(strName.length > 0) o.CodeName = strName;
|
2017-06-01 21:22:11 +00:00
|
|
|
o.autoCompressPictures = !!(flags & 0x10000);
|
|
|
|
o.backupFile = !!(flags & 0x40);
|
|
|
|
o.checkCompatibility = !!(flags & 0x1000);
|
|
|
|
o.date1904 = !!(flags & 0x01);
|
|
|
|
o.filterPrivacy = !!(flags & 0x08);
|
|
|
|
o.hidePivotFieldList = !!(flags & 0x400);
|
|
|
|
o.promptedSolutions = !!(flags & 0x10);
|
|
|
|
o.publishItems = !!(flags & 0x800);
|
|
|
|
o.refreshAllConnections = !!(flags & 0x40000);
|
|
|
|
o.saveExternalLinkValues = !!(flags & 0x80);
|
|
|
|
o.showBorderUnselectedTables = !!(flags & 0x04);
|
|
|
|
o.showInkAnnotation = !!(flags & 0x20);
|
|
|
|
o.showObjects = ["all", "placeholders", "none"][(flags >> 13) & 0x03];
|
|
|
|
o.showPivotChartFilter = !!(flags & 0x8000);
|
|
|
|
o.updateLinks = ["userSet", "never", "always"][(flags >> 8) & 0x03];
|
|
|
|
return o;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2017-06-03 07:19:09 +00:00
|
|
|
function write_BrtWbProp(data/*:?WBProps*/, o) {
|
2017-05-09 18:07:57 +00:00
|
|
|
if(!o) o = new_buf(72);
|
2017-06-03 07:19:09 +00:00
|
|
|
var flags = 0;
|
|
|
|
if(data) {
|
|
|
|
/* TODO: mirror parse_BrtWbProp fields */
|
2022-06-06 23:05:27 +00:00
|
|
|
if(data.date1904) flags |= 0x01;
|
2017-06-03 07:19:09 +00:00
|
|
|
if(data.filterPrivacy) flags |= 0x08;
|
|
|
|
}
|
|
|
|
o.write_shift(4, flags);
|
2014-05-29 22:30:03 +00:00
|
|
|
o.write_shift(4, 0);
|
2017-11-20 01:51:14 +00:00
|
|
|
write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o);
|
2017-03-31 00:47:35 +00:00
|
|
|
return o.slice(0, o.l);
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-05-29 22:30:03 +00:00
|
|
|
|
2014-06-29 18:29:45 +00:00
|
|
|
function parse_BrtFRTArchID$(data, length) {
|
2014-05-29 22:30:03 +00:00
|
|
|
var o = {};
|
|
|
|
data.read_shift(4);
|
|
|
|
o.ArchID = data.read_shift(4);
|
|
|
|
data.l += length - 8;
|
|
|
|
return o;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.687 BrtName */
|
2017-02-19 20:36:32 +00:00
|
|
|
function parse_BrtName(data, length, opts) {
|
|
|
|
var end = data.l + length;
|
2022-05-27 20:26:39 +00:00
|
|
|
var flags = data.read_shift(4);
|
2018-01-23 09:07:51 +00:00
|
|
|
data.l += 1; //var chKey = data.read_shift(1);
|
2017-02-19 20:36:32 +00:00
|
|
|
var itab = data.read_shift(4);
|
|
|
|
var name = parse_XLNameWideString(data);
|
|
|
|
var formula = parse_XLSBNameParsedFormula(data, 0, opts);
|
|
|
|
var comment = parse_XLNullableWideString(data);
|
2022-05-27 20:26:39 +00:00
|
|
|
if(flags & 0x20) name = "_xlnm." + name;
|
2017-03-31 00:47:35 +00:00
|
|
|
//if(0 /* fProc */) {
|
2017-02-19 20:36:32 +00:00
|
|
|
// unusedstring1: XLNullableWideString
|
|
|
|
// description: XLNullableWideString
|
|
|
|
// helpTopic: XLNullableWideString
|
|
|
|
// unusedstring2: XLNullableWideString
|
2017-03-31 00:47:35 +00:00
|
|
|
//}
|
2017-02-19 20:36:32 +00:00
|
|
|
data.l = end;
|
2022-05-27 20:26:39 +00:00
|
|
|
var out = ({Name:name, Ptg:formula, Flags: flags}/*:any*/);
|
2017-04-11 22:15:36 +00:00
|
|
|
if(itab < 0xFFFFFFF) out.Sheet = itab;
|
2017-12-15 01:18:40 +00:00
|
|
|
if(comment) out.Comment = comment;
|
2017-04-11 22:15:36 +00:00
|
|
|
return out;
|
2017-02-19 20:36:32 +00:00
|
|
|
}
|
2022-05-25 01:45:55 +00:00
|
|
|
function write_BrtName(name, wb) {
|
|
|
|
var o = new_buf(9);
|
2022-05-27 20:26:39 +00:00
|
|
|
var flags = 0;
|
|
|
|
var dname = name.Name;
|
|
|
|
if(XLSLblBuiltIn.indexOf(dname) > -1) { flags |= 0x20; dname = dname.slice(6); }
|
|
|
|
o.write_shift(4, flags); // flags
|
2022-05-25 01:45:55 +00:00
|
|
|
o.write_shift(1, 0); // chKey
|
|
|
|
o.write_shift(4, name.Sheet == null ? 0xFFFFFFFF : name.Sheet);
|
|
|
|
|
|
|
|
var arr = [
|
|
|
|
o,
|
2022-05-27 20:26:39 +00:00
|
|
|
write_XLWideString(dname),
|
|
|
|
write_XLSBNameParsedFormula(name.Ref, wb)
|
2022-05-25 01:45:55 +00:00
|
|
|
];
|
2022-05-27 20:26:39 +00:00
|
|
|
if(name.Comment) arr.push(write_XLNullableWideString(name.Comment));
|
2022-05-25 01:45:55 +00:00
|
|
|
else {
|
|
|
|
var x = new_buf(4);
|
|
|
|
x.write_shift(4, 0xFFFFFFFF);
|
|
|
|
arr.push(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
// if macro (flags & 0x0F):
|
|
|
|
// write_shift(4, 0xFFFFFFFF);
|
|
|
|
// write_XLNullableWideString(description)
|
|
|
|
// write_XLNullableWideString(helpTopic)
|
|
|
|
// write_shift(4, 0xFFFFFFFF);
|
|
|
|
|
2022-05-27 20:26:39 +00:00
|
|
|
return bconcat(arr);
|
2022-05-25 01:45:55 +00:00
|
|
|
}
|
2017-02-19 20:36:32 +00:00
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.1.7.61 Workbook */
|
2017-03-12 18:02:43 +00:00
|
|
|
function parse_wb_bin(data, opts)/*:WorkbookFile*/ {
|
2014-01-28 16:38:02 +00:00
|
|
|
var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
|
2019-04-01 14:25:15 +00:00
|
|
|
var state/*:Array<string>*/ = [];
|
2018-01-23 09:07:51 +00:00
|
|
|
var pass = false;
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2017-02-19 20:36:32 +00:00
|
|
|
if(!opts) opts = {};
|
|
|
|
opts.biff = 12;
|
|
|
|
|
2017-04-11 22:15:36 +00:00
|
|
|
var Names = [];
|
2017-11-15 18:14:02 +00:00
|
|
|
var supbooks = ([[]]/*:any*/);
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks.SheetNames = [];
|
2017-11-15 18:14:02 +00:00
|
|
|
supbooks.XTI = [];
|
2017-02-19 20:36:32 +00:00
|
|
|
|
2021-08-18 18:34:02 +00:00
|
|
|
XLSBRecordEnum[0x0010] = { n:"BrtFRTArchID$", f:parse_BrtFRTArchID$ };
|
|
|
|
|
2022-03-12 14:05:57 +00:00
|
|
|
recordhopper(data, function hopper_wb(val, R, RT) {
|
2017-04-09 04:03:19 +00:00
|
|
|
switch(RT) {
|
|
|
|
case 0x009C: /* 'BrtBundleSh' */
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks.SheetNames.push(val.name);
|
2017-04-09 04:03:19 +00:00
|
|
|
wb.Sheets.push(val); break;
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2017-07-10 22:18:18 +00:00
|
|
|
case 0x0099: /* 'BrtWbProp' */
|
|
|
|
wb.WBProps = val; break;
|
|
|
|
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0027: /* 'BrtName' */
|
2017-11-15 18:14:02 +00:00
|
|
|
if(val.Sheet != null) opts.SID = val.Sheet;
|
2017-04-11 22:15:36 +00:00
|
|
|
val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts);
|
2017-11-15 18:14:02 +00:00
|
|
|
delete opts.SID;
|
2017-04-11 22:15:36 +00:00
|
|
|
delete val.Ptg;
|
|
|
|
Names.push(val);
|
2017-02-19 20:36:32 +00:00
|
|
|
break;
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x040C: /* 'BrtNameExt' */ break;
|
|
|
|
|
2017-07-10 22:18:18 +00:00
|
|
|
case 0x0165: /* 'BrtSupSelf' */
|
|
|
|
case 0x0166: /* 'BrtSupSame' */
|
|
|
|
case 0x0163: /* 'BrtSupBookSrc' */
|
|
|
|
case 0x029B: /* 'BrtSupAddin' */
|
2017-11-15 18:14:02 +00:00
|
|
|
if(!supbooks[0].length) supbooks[0] = [RT, val];
|
|
|
|
else supbooks.push([RT, val]);
|
|
|
|
supbooks[supbooks.length - 1].XTI = [];
|
|
|
|
break;
|
2017-07-10 22:18:18 +00:00
|
|
|
case 0x016A: /* 'BrtExternSheet' */
|
2017-11-15 18:14:02 +00:00
|
|
|
if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; }
|
|
|
|
supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val);
|
|
|
|
supbooks.XTI = supbooks.XTI.concat(val);
|
|
|
|
break;
|
2017-07-10 22:18:18 +00:00
|
|
|
case 0x0169: /* 'BrtPlaceholderName' */
|
|
|
|
break;
|
2017-06-01 21:22:11 +00:00
|
|
|
|
2021-08-18 18:34:02 +00:00
|
|
|
case 0x0817: /* 'BrtAbsPath15' */
|
|
|
|
case 0x009E: /* 'BrtBookView' */
|
|
|
|
case 0x008F: /* 'BrtBeginBundleShs' */
|
|
|
|
case 0x0298: /* 'BrtBeginFnGroup' */
|
|
|
|
case 0x0161: /* 'BrtBeginExternals' */
|
|
|
|
break;
|
|
|
|
|
2018-03-19 21:42:55 +00:00
|
|
|
/* case 'BrtModelTimeGroupingCalcCol' */
|
|
|
|
case 0x0C00: /* 'BrtUid' */
|
2018-03-19 15:27:35 +00:00
|
|
|
case 0x0C01: /* 'BrtRevisionPtr' */
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0216: /* 'BrtBookProtection' */
|
|
|
|
case 0x02A5: /* 'BrtBookProtectionIso' */
|
|
|
|
case 0x009D: /* 'BrtCalcProp' */
|
|
|
|
case 0x0262: /* 'BrtCrashRecErr' */
|
|
|
|
case 0x0802: /* 'BrtDecoupledPivotCacheID' */
|
|
|
|
case 0x009B: /* 'BrtFileRecover' */
|
|
|
|
case 0x0224: /* 'BrtFileSharing' */
|
|
|
|
case 0x02A4: /* 'BrtFileSharingIso' */
|
|
|
|
case 0x0080: /* 'BrtFileVersion' */
|
|
|
|
case 0x0299: /* 'BrtFnGroup' */
|
|
|
|
case 0x0850: /* 'BrtModelRelationship' */
|
|
|
|
case 0x084D: /* 'BrtModelTable' */
|
|
|
|
case 0x0225: /* 'BrtOleSize' */
|
|
|
|
case 0x0805: /* 'BrtPivotTableRef' */
|
|
|
|
case 0x0254: /* 'BrtSmartTagType' */
|
|
|
|
case 0x081C: /* 'BrtTableSlicerCacheID' */
|
|
|
|
case 0x081B: /* 'BrtTableSlicerCacheIDs' */
|
|
|
|
case 0x0822: /* 'BrtTimelineCachePivotCacheID' */
|
|
|
|
case 0x018D: /* 'BrtUserBookView' */
|
|
|
|
case 0x009A: /* 'BrtWbFactoid' */
|
|
|
|
case 0x045D: /* 'BrtWbProp14' */
|
|
|
|
case 0x0229: /* 'BrtWebOpt' */
|
|
|
|
case 0x082B: /* 'BrtWorkBookPr15' */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0023: /* 'BrtFRTBegin' */
|
2022-03-12 14:05:57 +00:00
|
|
|
state.push(RT); pass = true; break;
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0024: /* 'BrtFRTEnd' */
|
2019-04-01 14:25:15 +00:00
|
|
|
state.pop(); pass = false; break;
|
|
|
|
case 0x0025: /* 'BrtACBegin' */
|
2022-03-12 14:05:57 +00:00
|
|
|
state.push(RT); pass = true; break;
|
2019-04-01 14:25:15 +00:00
|
|
|
case 0x0026: /* 'BrtACEnd' */
|
|
|
|
state.pop(); pass = false; break;
|
2017-04-09 04:03:19 +00:00
|
|
|
|
|
|
|
case 0x0010: /* 'BrtFRTArchID$' */ break;
|
|
|
|
|
2017-04-08 06:55:35 +00:00
|
|
|
default:
|
2022-03-12 14:05:57 +00:00
|
|
|
if(R.T){/* empty */}
|
|
|
|
else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */ && state[state.length-1] != 0x0023 /* BrtFRTBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16));
|
2014-01-28 16:38:02 +00:00
|
|
|
}
|
2017-02-19 20:36:32 +00:00
|
|
|
}, opts);
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2014-06-29 18:29:45 +00:00
|
|
|
parse_wb_defaults(wb);
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2017-03-12 18:02:43 +00:00
|
|
|
// $FlowIgnore
|
2017-02-19 20:36:32 +00:00
|
|
|
wb.Names = Names;
|
|
|
|
|
2017-11-15 18:14:02 +00:00
|
|
|
(wb/*:any*/).supbooks = supbooks;
|
2014-01-28 16:38:02 +00:00
|
|
|
return wb;
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2014-05-16 00:33:34 +00:00
|
|
|
|
2018-01-23 09:07:51 +00:00
|
|
|
function write_BUNDLESHS(ba, wb/*::, opts*/) {
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x008F /* BrtBeginBundleShs */);
|
2014-06-29 18:29:45 +00:00
|
|
|
for(var idx = 0; idx != wb.SheetNames.length; ++idx) {
|
2017-03-31 18:46:42 +00:00
|
|
|
var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0;
|
|
|
|
var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] };
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x009C /* BrtBundleSh */, write_BrtBundleSh(d));
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0090 /* BrtEndBundleShs */);
|
2014-05-29 22:30:03 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.649 BrtFileVersion */
|
2014-05-29 22:30:03 +00:00
|
|
|
function write_BrtFileVersion(data, o) {
|
|
|
|
if(!o) o = new_buf(127);
|
|
|
|
for(var i = 0; i != 4; ++i) o.write_shift(4, 0);
|
|
|
|
write_XLWideString("SheetJS", o);
|
|
|
|
write_XLWideString(XLSX.version, o);
|
|
|
|
write_XLWideString(XLSX.version, o);
|
|
|
|
write_XLWideString("7262", o);
|
2017-02-03 20:50:45 +00:00
|
|
|
return o.length > o.l ? o.slice(0, o.l) : o;
|
2014-05-29 22:30:03 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.301 BrtBookView */
|
2017-03-31 18:46:42 +00:00
|
|
|
function write_BrtBookView(idx, o) {
|
|
|
|
if(!o) o = new_buf(29);
|
|
|
|
o.write_shift(-4, 0);
|
|
|
|
o.write_shift(-4, 460);
|
|
|
|
o.write_shift(4, 28800);
|
|
|
|
o.write_shift(4, 17600);
|
|
|
|
o.write_shift(4, 500);
|
|
|
|
o.write_shift(4, idx);
|
|
|
|
o.write_shift(4, idx);
|
|
|
|
var flags = 0x78;
|
|
|
|
o.write_shift(1, flags);
|
|
|
|
return o.length > o.l ? o.slice(0, o.l) : o;
|
|
|
|
}
|
|
|
|
|
2018-01-23 09:07:51 +00:00
|
|
|
function write_BOOKVIEWS(ba, wb/*::, opts*/) {
|
2017-03-31 18:46:42 +00:00
|
|
|
/* required if hidden tab appears before visible tab */
|
|
|
|
if(!wb.Workbook || !wb.Workbook.Sheets) return;
|
|
|
|
var sheets = wb.Workbook.Sheets;
|
|
|
|
var i = 0, vistab = -1, hidden = -1;
|
|
|
|
for(; i < sheets.length; ++i) {
|
|
|
|
if(!sheets[i] || !sheets[i].Hidden && vistab == -1) vistab = i;
|
|
|
|
else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i;
|
|
|
|
}
|
|
|
|
if(hidden > vistab) return;
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0087 /* BrtBeginBookViews */);
|
|
|
|
write_record(ba, 0x009E /* BrtBookView */, write_BrtBookView(vistab));
|
2014-05-29 22:30:03 +00:00
|
|
|
/* 1*(BrtBookView *FRT) */
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0088 /* BrtEndBookViews */);
|
2014-05-29 22:30:03 +00:00
|
|
|
}
|
|
|
|
|
2022-05-25 01:45:55 +00:00
|
|
|
function write_BRTNAMES(ba, wb) {
|
|
|
|
if(!wb.Workbook || !wb.Workbook.Names) return;
|
|
|
|
wb.Workbook.Names.forEach(function(name) { try {
|
2022-05-27 20:26:39 +00:00
|
|
|
if(name.Flags & 0x0e) return; // TODO: macro name write
|
2022-05-25 01:45:55 +00:00
|
|
|
write_record(ba, 0x0027 /* BrtName */, write_BrtName(name, wb));
|
|
|
|
} catch(e) {
|
|
|
|
console.error("Could not serialize defined name " + JSON.stringify(name));
|
|
|
|
} });
|
|
|
|
}
|
|
|
|
|
|
|
|
function write_SELF_EXTERNS_xlsb(wb) {
|
|
|
|
var L = wb.SheetNames.length;
|
2022-05-27 20:26:39 +00:00
|
|
|
var o = new_buf(12 * L + 28);
|
|
|
|
o.write_shift(4, L + 2);
|
2022-05-25 01:45:55 +00:00
|
|
|
o.write_shift(4, 0); o.write_shift(4, -2); o.write_shift(4, -2); // workbook-level reference
|
2022-05-27 20:26:39 +00:00
|
|
|
o.write_shift(4, 0); o.write_shift(4, -1); o.write_shift(4, -1); // #REF!...
|
2022-05-25 01:45:55 +00:00
|
|
|
for(var i = 0; i < L; ++i) {
|
|
|
|
o.write_shift(4, 0); o.write_shift(4, i); o.write_shift(4, i);
|
|
|
|
}
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
function write_EXTERNALS_xlsb(ba, wb) {
|
|
|
|
write_record(ba, 0x0161 /* BrtBeginExternals */);
|
|
|
|
write_record(ba, 0x0165 /* BrtSupSelf */);
|
|
|
|
write_record(ba, 0x016A /* BrtExternSheet */, write_SELF_EXTERNS_xlsb(wb, 0));
|
|
|
|
write_record(ba, 0x0162 /* BrtEndExternals */);
|
|
|
|
}
|
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.305 BrtCalcProp */
|
2018-01-23 09:07:51 +00:00
|
|
|
/*function write_BrtCalcProp(data, o) {
|
2014-05-29 22:30:03 +00:00
|
|
|
if(!o) o = new_buf(26);
|
2018-01-23 09:07:51 +00:00
|
|
|
o.write_shift(4,0); // force recalc
|
2014-05-29 22:30:03 +00:00
|
|
|
o.write_shift(4,1);
|
|
|
|
o.write_shift(4,0);
|
|
|
|
write_Xnum(0, o);
|
|
|
|
o.write_shift(-4, 1023);
|
|
|
|
o.write_shift(1, 0x33);
|
|
|
|
o.write_shift(1, 0x00);
|
|
|
|
return o;
|
2018-01-23 09:07:51 +00:00
|
|
|
}*/
|
2014-05-29 22:30:03 +00:00
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.4.646 BrtFileRecover */
|
2018-01-23 09:07:51 +00:00
|
|
|
/*function write_BrtFileRecover(data, o) {
|
2014-05-29 22:30:03 +00:00
|
|
|
if(!o) o = new_buf(1);
|
|
|
|
o.write_shift(1,0);
|
|
|
|
return o;
|
2018-01-23 09:07:51 +00:00
|
|
|
}*/
|
2014-05-29 22:30:03 +00:00
|
|
|
|
2018-02-14 20:06:35 +00:00
|
|
|
/* [MS-XLSB] 2.1.7.61 Workbook */
|
2014-06-29 18:29:45 +00:00
|
|
|
function write_wb_bin(wb, opts) {
|
2014-05-29 22:30:03 +00:00
|
|
|
var ba = buf_array();
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0083 /* BrtBeginBook */);
|
|
|
|
write_record(ba, 0x0080 /* BrtFileVersion */, write_BrtFileVersion());
|
2014-05-29 22:30:03 +00:00
|
|
|
/* [[BrtFileSharingIso] BrtFileSharing] */
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0099 /* BrtWbProp */, write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null));
|
2014-05-29 22:30:03 +00:00
|
|
|
/* [ACABSPATH] */
|
|
|
|
/* [[BrtBookProtectionIso] BrtBookProtection] */
|
2017-03-31 18:46:42 +00:00
|
|
|
write_BOOKVIEWS(ba, wb, opts);
|
2014-05-29 22:30:03 +00:00
|
|
|
write_BUNDLESHS(ba, wb, opts);
|
|
|
|
/* [FNGROUP] */
|
2022-05-25 01:45:55 +00:00
|
|
|
write_EXTERNALS_xlsb(ba, wb);
|
|
|
|
if((wb.Workbook||{}).Names) write_BRTNAMES(ba, wb);
|
2022-03-12 14:05:57 +00:00
|
|
|
/* write_record(ba, 0x009D BrtCalcProp, write_BrtCalcProp()); */
|
2014-05-29 22:30:03 +00:00
|
|
|
/* [BrtOleSize] */
|
|
|
|
/* *(BrtUserBookView *FRT) */
|
|
|
|
/* [PIVOTCACHEIDS] */
|
|
|
|
/* [BrtWbFactoid] */
|
|
|
|
/* [SMARTTAGTYPES] */
|
|
|
|
/* [BrtWebOpt] */
|
2022-03-12 14:05:57 +00:00
|
|
|
/* write_record(ba, 0x009B BrtFileRecover, write_BrtFileRecover()); */
|
2014-05-29 22:30:03 +00:00
|
|
|
/* [WEBPUBITEMS] */
|
|
|
|
/* [CRERRS] */
|
|
|
|
/* FRTWORKBOOK */
|
2022-03-12 14:05:57 +00:00
|
|
|
write_record(ba, 0x0084 /* BrtEndBook */);
|
2014-05-16 00:33:34 +00:00
|
|
|
|
2014-05-29 22:30:03 +00:00
|
|
|
return ba.end();
|
2014-06-29 18:29:45 +00:00
|
|
|
}
|