sheetjs_sheetjs/bits/70_csheet.js
SheetJS 663270b762 XLS/XLSX/XLSB Interpret Chartsheets as Data Tables
- chartsheets are now stored as sheets with "!type" set to "chart"
- fixed Strict XML Workbook Relationships
- stubbed support for dialog and macro sheets
- removed legacy XLS `!range` field
2017-03-27 17:41:14 -04:00

48 lines
1.5 KiB
JavaScript

RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
/* 18.3 Worksheets also covers Chartsheets */
function parse_cs_xml(data/*:?string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(!data) return data;
/* 18.3.1.12 chartsheet CT_ChartSheet */
if(!rels) rels = {'!id':{}};
var s = {'!type':"chart", '!chart':null, '!rel':""};
var m;
/* 18.3.1.36 drawing CT_Drawing */
if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1];
if(rels['!id'][s['!rel']]) s['!chart'] = rels['!id'][s['!rel']];
return s;
}
/* [MS-XLSB] 2.1.7.7 Chart Sheet */
function parse_cs_bin(data, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(!data) return data;
if(!rels) rels = {'!id':{}};
var s = {'!type':"chart", '!chart':null, '!rel':""};
var pass = false;
recordhopper(data, function cs_parse(val, Record) {
switch(Record.n) {
case 'BrtDrawing': s['!rel'] = val; break;
case 'BrtBeginSheet': break;
case 'BrtCsProp': break; // TODO
case 'BrtBeginCsViews': break; // TODO
case 'BrtBeginCsView': break; // TODO
case 'BrtEndCsView': break; // TODO
case 'BrtEndCsViews': break; // TODO
case 'BrtCsProtection': break; // TODO
case 'BrtMargins': break; // TODO
case 'BrtCsPageSetup': break; // TODO
case 'BrtEndSheet': break; // TODO
case 'BrtBeginHeaderFooter': break; // TODO
case 'BrtEndHeaderFooter': break; // TODO
default: if(!pass || opts.WTF) throw new Error("Unexpected record " + Record.n);
}
}, opts);
if(rels['!id'][s['!rel']]) s['!chart'] = rels['!id'][s['!rel']];
return s;
}