2014-03-23 21:30:00 +00:00
|
|
|
/* [MS-XLSB] 2.4.651 BrtFmt */
|
2017-02-10 19:23:01 +00:00
|
|
|
function parse_BrtFmt(data, length/*:number*/) {
|
2014-01-31 11:52:18 +00:00
|
|
|
var ifmt = data.read_shift(2);
|
|
|
|
var stFmtCode = parse_XLWideString(data,length-2);
|
|
|
|
return [ifmt, stFmtCode];
|
|
|
|
}
|
2014-01-28 16:38:02 +00:00
|
|
|
|
2014-03-29 02:05:50 +00:00
|
|
|
/* [MS-XLSB] 2.4.653 BrtFont TODO */
|
2017-02-10 19:23:01 +00:00
|
|
|
function parse_BrtFont(data, length/*:number*/) {
|
|
|
|
var out = ({flags:{}}/*:any*/);
|
2014-06-29 18:29:45 +00:00
|
|
|
out.dyHeight = data.read_shift(2);
|
2014-03-29 02:05:50 +00:00
|
|
|
out.grbit = parse_FontFlags(data, 2);
|
2014-06-29 18:29:45 +00:00
|
|
|
out.bls = data.read_shift(2);
|
|
|
|
out.sss = data.read_shift(2);
|
|
|
|
out.uls = data.read_shift(1);
|
|
|
|
out.bFamily = data.read_shift(1);
|
|
|
|
out.bCharSet = data.read_shift(1);
|
2014-03-29 02:05:50 +00:00
|
|
|
data.l++;
|
|
|
|
out.brtColor = parse_BrtColor(data, 8);
|
2014-06-29 18:29:45 +00:00
|
|
|
out.bFontScheme = data.read_shift(1);
|
2014-03-29 02:05:50 +00:00
|
|
|
out.name = parse_XLWideString(data, length - 21);
|
|
|
|
|
|
|
|
out.flags.Bold = out.bls === 0x02BC;
|
|
|
|
out.flags.Italic = out.grbit.fItalic;
|
|
|
|
out.flags.Strikeout = out.grbit.fStrikeout;
|
|
|
|
out.flags.Outline = out.grbit.fOutline;
|
|
|
|
out.flags.Shadow = out.grbit.fShadow;
|
|
|
|
out.flags.Condense = out.grbit.fCondense;
|
|
|
|
out.flags.Extend = out.grbit.fExtend;
|
|
|
|
out.flags.Sub = out.sss & 0x2;
|
|
|
|
out.flags.Sup = out.sss & 0x1;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2014-03-23 21:30:00 +00:00
|
|
|
/* [MS-XLSB] 2.4.816 BrtXF */
|
2017-02-10 19:23:01 +00:00
|
|
|
function parse_BrtXF(data, length/*:number*/) {
|
2014-01-31 11:52:18 +00:00
|
|
|
var ixfeParent = data.read_shift(2);
|
|
|
|
var ifmt = data.read_shift(2);
|
|
|
|
parsenoop(data, length-4);
|
|
|
|
return {ixfe:ixfeParent, ifmt:ifmt };
|
|
|
|
}
|
|
|
|
|
2014-03-23 21:30:00 +00:00
|
|
|
/* [MS-XLSB] 2.1.7.50 Styles */
|
2017-03-19 06:50:30 +00:00
|
|
|
function parse_sty_bin(data, themes, opts) {
|
2017-03-18 23:25:50 +00:00
|
|
|
var styles = {};
|
2017-02-10 19:23:01 +00:00
|
|
|
styles.NumberFmt = ([]/*:any*/);
|
2014-01-31 11:52:18 +00:00
|
|
|
for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y];
|
2014-02-07 10:53:40 +00:00
|
|
|
|
2014-01-31 11:52:18 +00:00
|
|
|
styles.CellXf = [];
|
2017-04-20 03:24:48 +00:00
|
|
|
styles.Fonts = [];
|
2017-04-08 06:55:35 +00:00
|
|
|
var state = [];
|
2014-01-31 11:52:18 +00:00
|
|
|
var pass = false;
|
2017-04-09 04:03:19 +00:00
|
|
|
recordhopper(data, function hopper_sty(val, R_n, RT) {
|
|
|
|
switch(RT) {
|
|
|
|
case 0x002C: /* 'BrtFmt' */
|
2014-01-31 11:52:18 +00:00
|
|
|
styles.NumberFmt[val[0]] = val[1]; SSF.load(val[1], val[0]);
|
|
|
|
break;
|
2017-04-20 03:24:48 +00:00
|
|
|
case 0x002B: /* 'BrtFont' */
|
|
|
|
styles.Fonts.push(val);
|
|
|
|
break;
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0401: /* 'BrtKnownFonts' */ break;
|
|
|
|
case 0x002D: /* 'BrtFill' */ break;
|
|
|
|
case 0x002E: /* 'BrtBorder' */ break;
|
|
|
|
case 0x002F: /* 'BrtXF' */
|
2017-04-08 06:55:35 +00:00
|
|
|
if(state[state.length - 1] == "BrtBeginCellXFs") {
|
2014-01-31 11:52:18 +00:00
|
|
|
styles.CellXf.push(val);
|
|
|
|
}
|
2017-04-09 04:03:19 +00:00
|
|
|
break;
|
|
|
|
case 0x0030: /* 'BrtStyle' */
|
|
|
|
case 0x01FB: /* 'BrtDXF' */
|
|
|
|
case 0x023C: /* 'BrtMRUColor' */
|
|
|
|
case 0x01DB: /* 'BrtIndexedColor': */
|
|
|
|
break;
|
2017-04-08 06:55:35 +00:00
|
|
|
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0493: /* 'BrtDXF14' */
|
|
|
|
case 0x0836: /* 'BrtDXF15' */
|
|
|
|
case 0x046A: /* 'BrtSlicerStyleElement' */
|
|
|
|
case 0x0200: /* 'BrtTableStyleElement' */
|
|
|
|
case 0x082F: /* 'BrtTimelineStyleElement' */
|
|
|
|
/* case 'BrtUid' */
|
|
|
|
break;
|
2017-04-08 06:55:35 +00:00
|
|
|
|
2017-04-09 04:03:19 +00:00
|
|
|
case 0x0023: /* 'BrtFRTBegin' */
|
|
|
|
pass = true; break;
|
|
|
|
case 0x0024: /* 'BrtFRTEnd' */
|
|
|
|
pass = false; break;
|
|
|
|
case 0x0025: /* 'BrtACBegin' */
|
|
|
|
state.push(R_n); break;
|
|
|
|
case 0x0026: /* 'BrtACEnd' */
|
|
|
|
state.pop(); break;
|
2017-04-08 06:55:35 +00:00
|
|
|
|
|
|
|
default:
|
2017-04-09 04:03:19 +00:00
|
|
|
if((R_n||"").indexOf("Begin") > 0) state.push(R_n);
|
|
|
|
else if((R_n||"").indexOf("End") > 0) state.pop();
|
|
|
|
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n);
|
2014-01-31 11:52:18 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return styles;
|
2014-01-28 16:38:02 +00:00
|
|
|
}
|
2014-05-29 22:30:03 +00:00
|
|
|
|
2014-07-28 13:22:32 +00:00
|
|
|
/* [MS-XLSB] 2.1.7.50 Styles */
|
|
|
|
function write_sty_bin(data, opts) {
|
|
|
|
var ba = buf_array();
|
|
|
|
write_record(ba, "BrtBeginStyleSheet");
|
|
|
|
/* [FMTS] */
|
|
|
|
/* [FONTS] */
|
|
|
|
/* [FILLS] */
|
|
|
|
/* [BORDERS] */
|
|
|
|
/* CELLSTYLEXFS */
|
|
|
|
/* CELLXFS*/
|
|
|
|
/* STYLES */
|
|
|
|
/* DXFS */
|
|
|
|
/* TABLESTYLES */
|
|
|
|
/* [COLORPALETTE] */
|
|
|
|
/* FRTSTYLESHEET*/
|
|
|
|
write_record(ba, "BrtEndStyleSheet");
|
|
|
|
return ba.end();
|
|
|
|
}
|