2014-01-28 16:38:02 +00:00
|
|
|
/* 18.8.31 numFmts CT_NumFmts */
|
2014-04-04 23:03:43 +00:00
|
|
|
function parseNumFmts(t, opts) {
|
2014-01-28 16:38:02 +00:00
|
|
|
styles.NumberFmt = [];
|
|
|
|
for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y];
|
|
|
|
t[0].match(/<[^>]*>/g).forEach(function(x) {
|
|
|
|
var y = parsexmltag(x);
|
|
|
|
switch(y[0]) {
|
|
|
|
case '<numFmts': case '</numFmts>': case '<numFmts/>': break;
|
|
|
|
case '<numFmt': {
|
|
|
|
var f=unescapexml(y.formatCode), i=parseInt(y.numFmtId,10);
|
2014-02-26 19:30:32 +00:00
|
|
|
styles.NumberFmt[i] = f; if(i>0) SSF.load(f,i);
|
2014-01-28 16:38:02 +00:00
|
|
|
} break;
|
2014-04-04 23:03:43 +00:00
|
|
|
default: if(opts.WTF) throw 'unrecognized ' + y[0] + ' in numFmts';
|
2014-01-28 16:38:02 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 18.8.10 cellXfs CT_CellXfs */
|
2014-04-04 23:03:43 +00:00
|
|
|
function parseCXfs(t, opts) {
|
2014-01-28 16:38:02 +00:00
|
|
|
styles.CellXf = [];
|
|
|
|
t[0].match(/<[^>]*>/g).forEach(function(x) {
|
|
|
|
var y = parsexmltag(x);
|
|
|
|
switch(y[0]) {
|
|
|
|
case '<cellXfs': case '<cellXfs/>': case '</cellXfs>': break;
|
|
|
|
|
|
|
|
/* 18.8.45 xf CT_Xf */
|
2014-01-31 11:52:18 +00:00
|
|
|
case '<xf': delete y[0];
|
|
|
|
if(y.numFmtId) y.numFmtId = parseInt(y.numFmtId, 10);
|
2014-01-28 16:38:02 +00:00
|
|
|
styles.CellXf.push(y); break;
|
|
|
|
case '</xf>': break;
|
|
|
|
|
|
|
|
/* 18.8.1 alignment CT_CellAlignment */
|
2014-04-04 23:03:43 +00:00
|
|
|
case '<alignment': case '<alignment/>': break;
|
2014-01-28 16:38:02 +00:00
|
|
|
|
|
|
|
/* 18.8.33 protection CT_CellProtection */
|
|
|
|
case '<protection': case '</protection>': case '<protection/>': break;
|
|
|
|
|
|
|
|
case '<extLst': case '</extLst>': break;
|
|
|
|
case '<ext': break;
|
2014-04-04 23:03:43 +00:00
|
|
|
default: if(opts.WTF) throw 'unrecognized ' + y[0] + ' in cellXfs';
|
2014-01-28 16:38:02 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 18.8 Styles CT_Stylesheet*/
|
2014-04-04 23:03:43 +00:00
|
|
|
function parse_sty_xml(data, opts) {
|
2014-01-28 16:38:02 +00:00
|
|
|
/* 18.8.39 styleSheet CT_Stylesheet */
|
|
|
|
var t;
|
|
|
|
|
|
|
|
/* numFmts CT_NumFmts ? */
|
2014-04-04 23:03:43 +00:00
|
|
|
if((t=data.match(/<numFmts([^>]*)>.*<\/numFmts>/))) parseNumFmts(t, opts);
|
2014-01-28 16:38:02 +00:00
|
|
|
|
|
|
|
/* fonts CT_Fonts ? */
|
|
|
|
/* fills CT_Fills ? */
|
|
|
|
/* borders CT_Borders ? */
|
|
|
|
/* cellStyleXfs CT_CellStyleXfs ? */
|
|
|
|
|
|
|
|
/* cellXfs CT_CellXfs ? */
|
2014-04-04 23:03:43 +00:00
|
|
|
if((t=data.match(/<cellXfs([^>]*)>.*<\/cellXfs>/))) parseCXfs(t, opts);
|
2014-01-28 16:38:02 +00:00
|
|
|
|
|
|
|
/* dxfs CT_Dxfs ? */
|
|
|
|
/* tableStyles CT_TableStyles ? */
|
|
|
|
/* colors CT_Colors ? */
|
|
|
|
/* extLst CT_ExtensionList ? */
|
|
|
|
|
|
|
|
return styles;
|
|
|
|
}
|