sheetjs-clone/bits/78_wbbin.js
SheetJS 6990e66a56 version bump 0.4.1: more XLSB + cleanup
- updated ssf to 0.5.4
- cleaned up CSV string output
- added CSV tests (from test_files)
- passes lint
- inlineStr actually parses <is> block
- more XLSB bits
2014-01-29 01:00:09 -05:00

54 lines
1.7 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 '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;
case '': 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;
};