/* 18.8.21 fills CT_Fills */
function parse_fills(t, opts) {
styles.Fills = [];
var fill = {};
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x);
switch(y[0]) {
case '': case '': break;
/* 18.8.20 fill CT_Fill */
case '': break;
case '': styles.Fills.push(fill); fill = {}; break;
/* 18.8.32 patternFill CT_PatternFill */
case '': case '': break;
/* 18.8.3 bgColor CT_Color */
case '': case '': break;
/* 18.8.19 fgColor CT_Color */
case '': case '': break;
default: if(opts.WTF) throw 'unrecognized ' + y[0] + ' in fills';
}
});
}
/* 18.8.31 numFmts CT_NumFmts */
function parse_numFmts(t, opts) {
styles.NumberFmt = [];
var k = keys(SSF._table);
for(var i=0; i != k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]];
var m = t[0].match(tagregex);
for(i=0; i != m.length; ++i) {
var y = parsexmltag(m[i]);
switch(y[0]) {
case '': case '': case '': break;
case '0) SSF.load(f,j);
} break;
default: if(opts.WTF) throw 'unrecognized ' + y[0] + ' in numFmts';
}
}
}
function write_numFmts(NF, opts) {
var o = [""];
[[5,8],[23,26],[41,44],[63,66],[164,392]].forEach(function(r) {
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] !== undefined) o[o.length] = (writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
});
o[o.length] = ("");
if(o.length === 2) return "";
o[0] = writextag('numFmts', null, { count:o.length-2 }).replace("/>", ">");
return o.join("");
}
/* 18.8.10 cellXfs CT_CellXfs */
function parse_cellXfs(t, opts) {
styles.CellXf = [];
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x);
switch(y[0]) {
case '': case '': case '': break;
/* 18.8.45 xf CT_Xf */
case '': break;
/* 18.8.1 alignment CT_CellAlignment */
case '': break;
/* 18.8.33 protection CT_CellProtection */
case '': case '': break;
case '': break;
case '");
if(o.length === 2) return "";
o[0] = writextag('cellXfs',null, {count:o.length-2}).replace("/>",">");
return o.join("");
}
/* 18.8 Styles CT_Stylesheet*/
function parse_sty_xml(data, opts) {
/* 18.8.39 styleSheet CT_Stylesheet */
var t;
/* numFmts CT_NumFmts ? */
if((t=data.match(/]*)>.*<\/numFmts>/))) parse_numFmts(t, opts);
/* fonts CT_Fonts ? */
/* fills CT_Fills */
if((t=data.match(/]*)>.*<\/fills>/))) parse_fills(t, opts);
/* borders CT_Borders ? */
/* cellStyleXfs CT_CellStyleXfs ? */
/* cellXfs CT_CellXfs ? */
if((t=data.match(/]*)>.*<\/cellXfs>/))) parse_cellXfs(t, opts);
/* dxfs CT_Dxfs ? */
/* tableStyles CT_TableStyles ? */
/* colors CT_Colors ? */
/* extLst CT_ExtensionList ? */
return styles;
}
var STYLES_XML_ROOT = writextag('styleSheet', null, {
'xmlns': XMLNS.main[0],
'xmlns:vt': XMLNS.vt
});
RELS.STY = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
function write_sty_xml(wb, opts) {
var o = [], p = {}, w;
o[o.length] = (XML_HEADER);
o[o.length] = (STYLES_XML_ROOT);
if((w = write_numFmts(wb.SSF))) o[o.length] = (w);
o[o.length] = ('');
o[o.length] = ('');
o[o.length] = ('');
o[o.length] = ('');
if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w);
o[o.length] = ('');
o[o.length] = ('');
o[o.length] = ('');
if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); }
return o.join("");
}