sheetjs-clone/bits/78_wbbin.js
SheetJS 2cb06e0fb8 version bump 0.5.6: custom properties
- custom properties (h/t @hmalphettes)
- new option bookProps
- added minified target (using uglify-js)
2014-02-14 01:25:46 -05:00

59 lines
1.9 KiB
JavaScript

/* [MS-XLSB] 2.4.301 BrtBundleSh */
var parse_BrtBundleSh = function(data, length) {
var z = {};
z.hsState = data.read_shift(4); //ST_SheetState
z.iTabID = data.read_shift(4);
z.strRelID = parse_RelID(data,length-8);
z.name = parse_XLWideString(data);
return z;
};
/* [MS-XLSB] 2.1.7.60 Workbook */
var parse_wb_bin = function(data) {
var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
var pass = false, z;
recordhopper(data, function(val, R) {
switch(R.n) {
case 'BrtBundleSh': wb.Sheets.push(val); break;
case 'BrtBeginBook': break;
case 'BrtFileVersion': break;
case 'BrtWbProp': break;
case 'BrtBeginBookViews': break;
case 'BrtBookView': break;
case 'BrtEndBookViews': break;
case 'BrtBeginBundleShs': break;
case 'BrtEndBundleShs': break;
case 'BrtBeginFnGroup': break;
case 'BrtEndFnGroup': break;
case 'BrtBeginExternals': break;
case 'BrtSupSelf': break;
case 'BrtExternSheet': break;
case 'BrtEndExternals': break;
case 'BrtName': break;
case 'BrtCalcProp': break;
case 'BrtBeginPivotCacheIDs': break;
case 'BrtBeginPivotCacheID': break;
case 'BrtEndPivotCacheID': break;
case 'BrtEndPivotCacheIDs': break;
case 'BrtFileRecover': break;
case 'BrtFRTBegin': pass = true; break;
case 'BrtFRTEnd': pass = false; break;
case 'BrtEndBook': break;
//default: if(!pass) throw new Error("Unexpected record " + R.n);
}
});
/* defaults */
for(z in WBPropsDef) if(typeof wb.WBProps[z] === 'undefined') wb.WBProps[z] = WBPropsDef[z];
for(z in CalcPrDef) if(typeof wb.CalcPr[z] === 'undefined') wb.CalcPr[z] = CalcPrDef[z];
wb.WBView.forEach(function(w){for(var z in WBViewDef) if(typeof w[z] === 'undefined') w[z]=WBViewDef[z]; });
wb.Sheets.forEach(function(w){for(var z in SheetDef) if(typeof w[z] === 'undefined') w[z]=SheetDef[z]; });
_ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904, 'date1904');
return wb;
};