forked from sheetjs/sheetjs
SheetJS
a3d9c4d9ac
- basic style + theme parsing, option .cellStyles (h/t @eladxxx) - more XLSB writing stubs - correct resolution of .xml/.bin files - sheet_to_json improvements from js-xls o opts.header = 1 for array of arrays o opts.header = 'A' for spreadsheet column labels o custom opts.header array for custom labels o opts.range = n starts from row n o opts.range = range restricts writer to work within the specified range - Makefile adapted to work with cygwin on windows
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
/* [MS-XLSB] 2.4.28 BrtBeginComment */
|
|
var parse_BrtBeginComment = function(data, length) {
|
|
var out = {};
|
|
out.iauthor = data.read_shift(4);
|
|
var rfx = parse_UncheckedRfX(data, 16);
|
|
out.rfx = rfx.s;
|
|
out.ref = encode_cell(rfx.s);
|
|
data.l += 16; /*var guid = parse_GUID(data); */
|
|
return out;
|
|
};
|
|
|
|
/* [MS-XLSB] 2.4.324 BrtCommentAuthor */
|
|
var parse_BrtCommentAuthor = parse_XLWideString;
|
|
|
|
/* [MS-XLSB] 2.4.325 BrtCommentText */
|
|
var parse_BrtCommentText = parse_RichStr;
|
|
|
|
/* [MS-XLSB] 2.1.7.8 Comments */
|
|
function parse_comments_bin(data, opts) {
|
|
var out = [];
|
|
var authors = [];
|
|
var c = {};
|
|
var pass = false;
|
|
recordhopper(data, function(val, R, RT) {
|
|
switch(R.n) {
|
|
case 'BrtCommentAuthor': authors.push(val); break;
|
|
case 'BrtBeginComment': c = val; break;
|
|
case 'BrtCommentText': c.t = val.t; c.h = val.h; c.r = val.r; break;
|
|
case 'BrtEndComment':
|
|
c.author = authors[c.iauthor];
|
|
delete c.iauthor;
|
|
if(opts.sheetRows && opts.sheetRows <= c.rfx.r) break;
|
|
delete c.rfx; out.push(c); break;
|
|
case 'BrtBeginComments': break;
|
|
case 'BrtEndComments': break;
|
|
case 'BrtBeginCommentAuthors': break;
|
|
case 'BrtEndCommentAuthors': break;
|
|
case 'BrtBeginCommentList': break;
|
|
case 'BrtEndCommentList': break;
|
|
default: if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R.n);
|
|
}
|
|
});
|
|
return out;
|
|
}
|
|
|
|
function write_comments_bin(data, opts) { }
|