Locking and Unlocking of cells #1390

Open
grantfayvor wants to merge 2 commits from grantfayvor/master into master
19 changed files with 3636 additions and 2310 deletions

View File

@ -57,11 +57,11 @@ dist: dist-deps $(TARGET) bower.json ## Prepare JS files for distribution
<$(TARGET) sed "s/require('stream')/{}/g;s/require('....*')/undefined/g" > dist/$(TARGET)
cp LICENSE dist/
uglifyjs shim.js $(UGLIFYOPTS) -o dist/shim.min.js --preamble "$$(head -n 1 bits/00_header.js)"
uglifyjs $(DISTHDR) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
uglifyjs $(DISTHDR) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).min.js
uglifyjs $(DISTHDR) $(REQS) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
uglifyjs $(DISTHDR) $(REQS) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).core.min.js --source-map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).core.min.js
uglifyjs $(DISTHDR) $(REQS) $(ADDONS) dist/$(TARGET) $(AUXTARGETS) $(UGLIFYOPTS) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
uglifyjs $(DISTHDR) $(REQS) $(ADDONS) dist/$(TARGET) $(AUXTARGETS) $(UGLIFYOPTS) -o dist/$(LIB).full.min.js --source-map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).full.min.js
cat <(head -n 1 bits/00_header.js) shim.js $(DISTHDR) $(REQS) dist/$(TARGET) > dist/$(LIB).extendscript.js

View File

@ -926,6 +926,7 @@ Cell objects are plain JS objects with keys and values following the convention:
| `z` | number format string associated with the cell (if requested) |
| `l` | cell hyperlink object (`.Target` holds link, `.Tooltip` is tooltip) |
| `s` | the style/theme of the cell (if applicable) |
| `p` | set to truthy value to remove the lock for a password protected cell |
Built-in export utilities (such as the CSV exporter) will use the `w` text if it
is available. To change a value, be sure to delete `cell.w` (or set it to
@ -935,6 +936,8 @@ text from the number format (`cell.z`) and the raw value if possible.
The actual array formula is stored in the `f` field of the first cell in the
array range. Other cells in the range will omit the `f` field.
When protecting a sheet with ws["!protect"] use cell.p to unlock the cell
#### Data Types
The raw value is stored in the `v` value property, interpreted based on the `t`

View File

@ -1,421 +1,652 @@
/* 18.8.5 borders CT_Borders */
function parse_borders(t, styles, themes, opts) {
styles.Borders = [];
var border = {}/*, sub_border = {}*/;
var pass = false;
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x);
switch(strip_ns(y[0])) {
case '<borders': case '<borders>': case '</borders>': break;
styles.Borders = [];
var border = {} /*, sub_border = {}*/ ;
var pass = false;
t[0].match(tagregex).forEach(function (x) {
var y = parsexmltag(x);
switch (strip_ns(y[0])) {
case '<borders':
case '<borders>':
case '</borders>':
break;
/* 18.8.4 border CT_Border */
case '<border': case '<border>': case '<border/>':
border = {};
if (y.diagonalUp) { border.diagonalUp = y.diagonalUp; }
if (y.diagonalDown) { border.diagonalDown = y.diagonalDown; }
styles.Borders.push(border);
break;
case '</border>': break;
/* 18.8.4 border CT_Border */
case '<border':
case '<border>':
case '<border/>':
border = {};
if (y.diagonalUp) {
border.diagonalUp = y.diagonalUp;
}
if (y.diagonalDown) {
border.diagonalDown = y.diagonalDown;
}
styles.Borders.push(border);
break;
case '</border>':
break;
/* note: not in spec, appears to be CT_BorderPr */
case '<left/>': break;
case '<left': case '<left>': break;
case '</left>': break;
/* note: not in spec, appears to be CT_BorderPr */
case '<left/>':
break;
case '<left':
case '<left>':
break;
case '</left>':
break;
/* note: not in spec, appears to be CT_BorderPr */
case '<right/>': break;
case '<right': case '<right>': break;
case '</right>': break;
/* note: not in spec, appears to be CT_BorderPr */
case '<right/>':
break;
case '<right':
case '<right>':
break;
case '</right>':
break;
/* 18.8.43 top CT_BorderPr */
case '<top/>': break;
case '<top': case '<top>': break;
case '</top>': break;
/* 18.8.43 top CT_BorderPr */
case '<top/>':
break;
case '<top':
case '<top>':
break;
case '</top>':
break;
/* 18.8.6 bottom CT_BorderPr */
case '<bottom/>': break;
case '<bottom': case '<bottom>': break;
case '</bottom>': break;
/* 18.8.6 bottom CT_BorderPr */
case '<bottom/>':
break;
case '<bottom':
case '<bottom>':
break;
case '</bottom>':
break;
/* 18.8.13 diagonal CT_BorderPr */
case '<diagonal': case '<diagonal>': case '<diagonal/>': break;
case '</diagonal>': break;
/* 18.8.13 diagonal CT_BorderPr */
case '<diagonal':
case '<diagonal>':
case '<diagonal/>':
break;
case '</diagonal>':
break;
/* 18.8.25 horizontal CT_BorderPr */
case '<horizontal': case '<horizontal>': case '<horizontal/>': break;
case '</horizontal>': break;
/* 18.8.25 horizontal CT_BorderPr */
case '<horizontal':
case '<horizontal>':
case '<horizontal/>':
break;
case '</horizontal>':
break;
/* 18.8.44 vertical CT_BorderPr */
case '<vertical': case '<vertical>': case '<vertical/>': break;
case '</vertical>': break;
/* 18.8.44 vertical CT_BorderPr */
case '<vertical':
case '<vertical>':
case '<vertical/>':
break;
case '</vertical>':
break;
/* 18.8.37 start CT_BorderPr */
case '<start': case '<start>': case '<start/>': break;
case '</start>': break;
/* 18.8.37 start CT_BorderPr */
case '<start':
case '<start>':
case '<start/>':
break;
case '</start>':
break;
/* 18.8.16 end CT_BorderPr */
case '<end': case '<end>': case '<end/>': break;
case '</end>': break;
/* 18.8.16 end CT_BorderPr */
case '<end':
case '<end>':
case '<end/>':
break;
case '</end>':
break;
/* 18.8.? color CT_Color */
case '<color': case '<color>': break;
case '<color/>': case '</color>': break;
/* 18.8.? color CT_Color */
case '<color':
case '<color>':
break;
case '<color/>':
case '</color>':
break;
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst': case '<extLst>': case '</extLst>': break;
case '<ext': pass = true; break;
case '</ext>': pass = false; break;
default: if(opts && opts.WTF) {
if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders');
}
}
});
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst':
case '<extLst>':
case '</extLst>':
break;
case '<ext':
pass = true;
break;
case '</ext>':
pass = false;
break;
default:
if (opts && opts.WTF) {
if (!pass) throw new Error('unrecognized ' + y[0] + ' in borders');
}
}
});
}
/* 18.8.21 fills CT_Fills */
function parse_fills(t, styles, themes, opts) {
styles.Fills = [];
var fill = {};
var pass = false;
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x);
switch(strip_ns(y[0])) {
case '<fills': case '<fills>': case '</fills>': break;
styles.Fills = [];
var fill = {};
var pass = false;
t[0].match(tagregex).forEach(function (x) {
var y = parsexmltag(x);
switch (strip_ns(y[0])) {
case '<fills':
case '<fills>':
case '</fills>':
break;
/* 18.8.20 fill CT_Fill */
case '<fill>': case '<fill': case '<fill/>':
fill = {}; styles.Fills.push(fill); break;
case '</fill>': break;
/* 18.8.20 fill CT_Fill */
case '<fill>':
case '<fill':
case '<fill/>':
fill = {};
styles.Fills.push(fill);
break;
case '</fill>':
break;
/* 18.8.24 gradientFill CT_GradientFill */
case '<gradientFill>': break;
case '<gradientFill':
case '</gradientFill>': styles.Fills.push(fill); fill = {}; break;
/* 18.8.24 gradientFill CT_GradientFill */
case '<gradientFill>':
break;
case '<gradientFill':
case '</gradientFill>':
styles.Fills.push(fill);
fill = {};
break;
/* 18.8.32 patternFill CT_PatternFill */
case '<patternFill': case '<patternFill>':
if(y.patternType) fill.patternType = y.patternType;
break;
case '<patternFill/>': case '</patternFill>': break;
/* 18.8.32 patternFill CT_PatternFill */
case '<patternFill':
case '<patternFill>':
if (y.patternType) fill.patternType = y.patternType;
break;
case '<patternFill/>':
case '</patternFill>':
break;
/* 18.8.3 bgColor CT_Color */
case '<bgColor':
if(!fill.bgColor) fill.bgColor = {};
if(y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);
if(y.theme) fill.bgColor.theme = parseInt(y.theme, 10);
if(y.tint) fill.bgColor.tint = parseFloat(y.tint);
/* Excel uses ARGB strings */
if(y.rgb) fill.bgColor.rgb = y.rgb.slice(-6);
break;
case '<bgColor/>': case '</bgColor>': break;
/* 18.8.3 bgColor CT_Color */
case '<bgColor':
if (!fill.bgColor) fill.bgColor = {};
if (y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);
if (y.theme) fill.bgColor.theme = parseInt(y.theme, 10);
if (y.tint) fill.bgColor.tint = parseFloat(y.tint);
/* Excel uses ARGB strings */
if (y.rgb) fill.bgColor.rgb = y.rgb.slice(-6);
break;
case '<bgColor/>':
case '</bgColor>':
break;
/* 18.8.19 fgColor CT_Color */
case '<fgColor':
if(!fill.fgColor) fill.fgColor = {};
if(y.theme) fill.fgColor.theme = parseInt(y.theme, 10);
if(y.tint) fill.fgColor.tint = parseFloat(y.tint);
/* Excel uses ARGB strings */
if(y.rgb) fill.fgColor.rgb = y.rgb.slice(-6);
break;
case '<fgColor/>': case '</fgColor>': break;
/* 18.8.19 fgColor CT_Color */
case '<fgColor':
if (!fill.fgColor) fill.fgColor = {};
if (y.theme) fill.fgColor.theme = parseInt(y.theme, 10);
if (y.tint) fill.fgColor.tint = parseFloat(y.tint);
/* Excel uses ARGB strings */
if (y.rgb) fill.fgColor.rgb = y.rgb.slice(-6);
break;
case '<fgColor/>':
case '</fgColor>':
break;
/* 18.8.38 stop CT_GradientStop */
case '<stop': case '<stop/>': break;
case '</stop>': break;
/* 18.8.38 stop CT_GradientStop */
case '<stop':
case '<stop/>':
break;
case '</stop>':
break;
/* 18.8.? color CT_Color */
case '<color': case '<color/>': break;
case '</color>': break;
/* 18.8.? color CT_Color */
case '<color':
case '<color/>':
break;
case '</color>':
break;
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst': case '<extLst>': case '</extLst>': break;
case '<ext': pass = true; break;
case '</ext>': pass = false; break;
default: if(opts && opts.WTF) {
if(!pass) throw new Error('unrecognized ' + y[0] + ' in fills');
}
}
});
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst':
case '<extLst>':
case '</extLst>':
break;
case '<ext':
pass = true;
break;
case '</ext>':
pass = false;
break;
default:
if (opts && opts.WTF) {
if (!pass) throw new Error('unrecognized ' + y[0] + ' in fills');
}
}
});
}
/* 18.8.23 fonts CT_Fonts */
function parse_fonts(t, styles, themes, opts) {
styles.Fonts = [];
var font = {};
var pass = false;
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x);
switch(strip_ns(y[0])) {
case '<fonts': case '<fonts>': case '</fonts>': break;
styles.Fonts = [];
var font = {};
var pass = false;
t[0].match(tagregex).forEach(function (x) {
var y = parsexmltag(x);
switch (strip_ns(y[0])) {
case '<fonts':
case '<fonts>':
case '</fonts>':
break;
/* 18.8.22 font CT_Font */
case '<font': case '<font>': break;
case '</font>': case '<font/>':
styles.Fonts.push(font);
font = {};
break;
/* 18.8.22 font CT_Font */
case '<font':
case '<font>':
break;
case '</font>':
case '<font/>':
styles.Fonts.push(font);
font = {};
break;
/* 18.8.29 name CT_FontName */
case '<name': if(y.val) font.name = y.val; break;
case '<name/>': case '</name>': break;
/* 18.8.29 name CT_FontName */
case '<name':
if (y.val) font.name = y.val;
break;
case '<name/>':
case '</name>':
break;
/* 18.8.2 b CT_BooleanProperty */
case '<b': font.bold = y.val ? parsexmlbool(y.val) : 1; break;
case '<b/>': font.bold = 1; break;
/* 18.8.2 b CT_BooleanProperty */
case '<b':
font.bold = y.val ? parsexmlbool(y.val) : 1;
break;
case '<b/>':
font.bold = 1;
break;
/* 18.8.26 i CT_BooleanProperty */
case '<i': font.italic = y.val ? parsexmlbool(y.val) : 1; break;
case '<i/>': font.italic = 1; break;
/* 18.8.26 i CT_BooleanProperty */
case '<i':
font.italic = y.val ? parsexmlbool(y.val) : 1;
break;
case '<i/>':
font.italic = 1;
break;
/* 18.4.13 u CT_UnderlineProperty */
case '<u':
switch(y.val) {
case "none": font.underline = 0x00; break;
case "single": font.underline = 0x01; break;
case "double": font.underline = 0x02; break;
case "singleAccounting": font.underline = 0x21; break;
case "doubleAccounting": font.underline = 0x22; break;
} break;
case '<u/>': font.underline = 1; break;
/* 18.4.13 u CT_UnderlineProperty */
case '<u':
switch (y.val) {
case "none":
font.underline = 0x00;
break;
case "single":
font.underline = 0x01;
break;
case "double":
font.underline = 0x02;
break;
case "singleAccounting":
font.underline = 0x21;
break;
case "doubleAccounting":
font.underline = 0x22;
break;
}
break;
case '<u/>':
font.underline = 1;
break;
/* 18.4.10 strike CT_BooleanProperty */
case '<strike': font.strike = y.val ? parsexmlbool(y.val) : 1; break;
case '<strike/>': font.strike = 1; break;
/* 18.4.10 strike CT_BooleanProperty */
case '<strike':
font.strike = y.val ? parsexmlbool(y.val) : 1;
break;
case '<strike/>':
font.strike = 1;
break;
/* 18.4.2 outline CT_BooleanProperty */
case '<outline': font.outline = y.val ? parsexmlbool(y.val) : 1; break;
case '<outline/>': font.outline = 1; break;
/* 18.4.2 outline CT_BooleanProperty */
case '<outline':
font.outline = y.val ? parsexmlbool(y.val) : 1;
break;
case '<outline/>':
font.outline = 1;
break;
/* 18.8.36 shadow CT_BooleanProperty */
case '<shadow': font.shadow = y.val ? parsexmlbool(y.val) : 1; break;
case '<shadow/>': font.shadow = 1; break;
/* 18.8.36 shadow CT_BooleanProperty */
case '<shadow':
font.shadow = y.val ? parsexmlbool(y.val) : 1;
break;
case '<shadow/>':
font.shadow = 1;
break;
/* 18.8.12 condense CT_BooleanProperty */
case '<condense': font.condense = y.val ? parsexmlbool(y.val) : 1; break;
case '<condense/>': font.condense = 1; break;
/* 18.8.12 condense CT_BooleanProperty */
case '<condense':
font.condense = y.val ? parsexmlbool(y.val) : 1;
break;
case '<condense/>':
font.condense = 1;
break;
/* 18.8.17 extend CT_BooleanProperty */
case '<extend': font.extend = y.val ? parsexmlbool(y.val) : 1; break;
case '<extend/>': font.extend = 1; break;
/* 18.8.17 extend CT_BooleanProperty */
case '<extend':
font.extend = y.val ? parsexmlbool(y.val) : 1;
break;
case '<extend/>':
font.extend = 1;
break;
/* 18.4.11 sz CT_FontSize */
case '<sz': if(y.val) font.sz = +y.val; break;
case '<sz/>': case '</sz>': break;
/* 18.4.11 sz CT_FontSize */
case '<sz':
if (y.val) font.sz = +y.val;
break;
case '<sz/>':
case '</sz>':
break;
/* 18.4.14 vertAlign CT_VerticalAlignFontProperty */
case '<vertAlign': if(y.val) font.vertAlign = y.val; break;
case '<vertAlign/>': case '</vertAlign>': break;
/* 18.4.14 vertAlign CT_VerticalAlignFontProperty */
case '<vertAlign':
if (y.val) font.vertAlign = y.val;
break;
case '<vertAlign/>':
case '</vertAlign>':
break;
/* 18.8.18 family CT_FontFamily */
case '<family': if(y.val) font.family = parseInt(y.val,10); break;
case '<family/>': case '</family>': break;
/* 18.8.18 family CT_FontFamily */
case '<family':
if (y.val) font.family = parseInt(y.val, 10);
break;
case '<family/>':
case '</family>':
break;
/* 18.8.35 scheme CT_FontScheme */
case '<scheme': if(y.val) font.scheme = y.val; break;
case '<scheme/>': case '</scheme>': break;
/* 18.8.35 scheme CT_FontScheme */
case '<scheme':
if (y.val) font.scheme = y.val;
break;
case '<scheme/>':
case '</scheme>':
break;
/* 18.4.1 charset CT_IntProperty */
case '<charset':
if(y.val == '1') break;
y.codepage = CS2CP[parseInt(y.val, 10)];
break;
/* 18.4.1 charset CT_IntProperty */
case '<charset':
if (y.val == '1') break;
y.codepage = CS2CP[parseInt(y.val, 10)];
break;
/* 18.?.? color CT_Color */
case '<color':
if(!font.color) font.color = {};
if(y.auto) font.color.auto = parsexmlbool(y.auto);
/* 18.?.? color CT_Color */
case '<color':
if (!font.color) font.color = {};
if (y.auto) font.color.auto = parsexmlbool(y.auto);
if(y.rgb) font.color.rgb = y.rgb.slice(-6);
else if(y.indexed) {
font.color.index = parseInt(y.indexed, 10);
var icv = XLSIcv[font.color.index];
if(font.color.index == 81) icv = XLSIcv[1];
if(!icv) throw new Error(x);
font.color.rgb = icv[0].toString(16) + icv[1].toString(16) + icv[2].toString(16);
} else if(y.theme) {
font.color.theme = parseInt(y.theme, 10);
if(y.tint) font.color.tint = parseFloat(y.tint);
if(y.theme && themes.themeElements && themes.themeElements.clrScheme) {
font.color.rgb = rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb, font.color.tint || 0);
}
}
if (y.rgb) font.color.rgb = y.rgb.slice(-6);
else if (y.indexed) {
font.color.index = parseInt(y.indexed, 10);
var icv = XLSIcv[font.color.index];
if (font.color.index == 81) icv = XLSIcv[1];
if (!icv) throw new Error(x);
font.color.rgb = icv[0].toString(16) + icv[1].toString(16) + icv[2].toString(16);
} else if (y.theme) {
font.color.theme = parseInt(y.theme, 10);
if (y.tint) font.color.tint = parseFloat(y.tint);
if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {
font.color.rgb = rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb, font.color.tint || 0);
}
}
break;
case '<color/>': case '</color>': break;
break;
case '<color/>':
case '</color>':
break;
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst': case '<extLst>': case '</extLst>': break;
case '<ext': pass = true; break;
case '</ext>': pass = false; break;
default: if(opts && opts.WTF) {
if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts');
}
}
});
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst':
case '<extLst>':
case '</extLst>':
break;
case '<ext':
pass = true;
break;
case '</ext>':
pass = false;
break;
default:
if (opts && opts.WTF) {
if (!pass) throw new Error('unrecognized ' + y[0] + ' in fonts');
}
}
});
}
/* 18.8.31 numFmts CT_NumFmts */
function parse_numFmts(t, styles, opts) {
styles.NumberFmt = [];
var k/*Array<number>*/ = (keys(SSF._table)/*:any*/);
for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]];
var m = t[0].match(tagregex);
if(!m) return;
for(i=0; i < m.length; ++i) {
var y = parsexmltag(m[i]);
switch(strip_ns(y[0])) {
case '<numFmts': case '</numFmts>': case '<numFmts/>': case '<numFmts>': break;
case '<numFmt': {
var f=unescapexml(utf8read(y.formatCode)), j=parseInt(y.numFmtId,10);
styles.NumberFmt[j] = f;
if(j>0) {
if(j > 0x188) {
for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break;
styles.NumberFmt[j] = f;
}
SSF.load(f,j);
}
} break;
case '</numFmt>': break;
default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts');
}
}
styles.NumberFmt = [];
var k /*Array<number>*/ = (keys(SSF._table) /*:any*/ );
for (var i = 0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]];
var m = t[0].match(tagregex);
if (!m) return;
for (i = 0; i < m.length; ++i) {
var y = parsexmltag(m[i]);
switch (strip_ns(y[0])) {
case '<numFmts':
case '</numFmts>':
case '<numFmts/>':
case '<numFmts>':
break;
case '<numFmt':
{
var f = unescapexml(utf8read(y.formatCode)),
j = parseInt(y.numFmtId, 10);
styles.NumberFmt[j] = f;
if (j > 0) {
if (j > 0x188) {
for (j = 0x188; j > 0x3c; --j)
if (styles.NumberFmt[j] == null) break;
styles.NumberFmt[j] = f;
}
SSF.load(f, j);
}
}
break;
case '</numFmt>':
break;
default:
if (opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts');
}
}
}
function write_numFmts(NF/*:{[n:number|string]:string}*//*::, opts*/) {
var o = ["<numFmts>"];
[[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) {
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) o[o.length] = (writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
});
if(o.length === 1) return "";
o[o.length] = ("</numFmts>");
o[0] = writextag('numFmts', null, { count:o.length-2 }).replace("/>", ">");
return o.join("");
function write_numFmts(NF /*:{[n:number|string]:string}*/ /*::, opts*/ ) {
var o = ["<numFmts>"];
[
[5, 8],
[23, 26],
[41, 44],
[ /*63*/ 50, /*66],[164,*/ 392]
].forEach(function (r) {
for (var i = r[0]; i <= r[1]; ++i)
if (NF[i] != null) o[o.length] = (writextag('numFmt', null, {
numFmtId: i,
formatCode: escapexml(NF[i])
}));
});
if (o.length === 1) return "";
o[o.length] = ("</numFmts>");
o[0] = writextag('numFmts', null, {
count: o.length - 2
}).replace("/>", ">");
return o.join("");
}
/* 18.8.10 cellXfs CT_CellXfs */
var cellXF_uint = [ "numFmtId", "fillId", "fontId", "borderId", "xfId" ];
var cellXF_bool = [ "applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix" ];
var cellXF_uint = ["numFmtId", "fillId", "fontId", "borderId", "xfId"];
var cellXF_bool = ["applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix"];
function parse_cellXfs(t, styles, opts) {
styles.CellXf = [];
var xf;
var pass = false;
t[0].match(tagregex).forEach(function(x) {
var y = parsexmltag(x), i = 0;
switch(strip_ns(y[0])) {
case '<cellXfs': case '<cellXfs>': case '<cellXfs/>': case '</cellXfs>': break;
styles.CellXf = [];
var xf;
var pass = false;
t[0].match(tagregex).forEach(function (x) {
var y = parsexmltag(x),
i = 0;
switch (strip_ns(y[0])) {
case '<cellXfs':
case '<cellXfs>':
case '<cellXfs/>':
case '</cellXfs>':
break;
/* 18.8.45 xf CT_Xf */
case '<xf': case '<xf/>':
xf = y;
delete xf[0];
for(i = 0; i < cellXF_uint.length; ++i) if(xf[cellXF_uint[i]])
xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10);
for(i = 0; i < cellXF_bool.length; ++i) if(xf[cellXF_bool[i]])
xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]);
if(xf.numFmtId > 0x188) {
for(i = 0x188; i > 0x3c; --i) if(styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { xf.numFmtId = i; break; }
}
styles.CellXf.push(xf); break;
case '</xf>': break;
/* 18.8.45 xf CT_Xf */
case '<xf':
case '<xf/>':
xf = y;
delete xf[0];
for (i = 0; i < cellXF_uint.length; ++i)
if (xf[cellXF_uint[i]])
xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10);
for (i = 0; i < cellXF_bool.length; ++i)
if (xf[cellXF_bool[i]])
xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]);
if (xf.numFmtId > 0x188) {
for (i = 0x188; i > 0x3c; --i)
if (styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) {
xf.numFmtId = i;
break;
}
}
styles.CellXf.push(xf);
break;
case '</xf>':
break;
/* 18.8.1 alignment CT_CellAlignment */
case '<alignment': case '<alignment/>':
var alignment = {};
if(y.vertical) alignment.vertical = y.vertical;
if(y.horizontal) alignment.horizontal = y.horizontal;
if(y.textRotation != null) alignment.textRotation = y.textRotation;
if(y.indent) alignment.indent = y.indent;
if(y.wrapText) alignment.wrapText = y.wrapText;
xf.alignment = alignment;
break;
case '</alignment>': break;
/* 18.8.1 alignment CT_CellAlignment */
case '<alignment':
case '<alignment/>':
var alignment = {};
if (y.vertical) alignment.vertical = y.vertical;
if (y.horizontal) alignment.horizontal = y.horizontal;
if (y.textRotation != null) alignment.textRotation = y.textRotation;
if (y.indent) alignment.indent = y.indent;
if (y.wrapText) alignment.wrapText = y.wrapText;
xf.alignment = alignment;
break;
case '</alignment>':
break;
/* 18.8.33 protection CT_CellProtection */
case '<protection': case '</protection>': case '<protection/>': break;
/* 18.8.33 protection CT_CellProtection */
case '<protection':
case '</protection>':
case '<protection/>':
break;
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst': case '<extLst>': case '</extLst>': break;
case '<ext': pass = true; break;
case '</ext>': pass = false; break;
default: if(opts && opts.WTF) {
if(!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs');
}
}
});
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst':
case '<extLst>':
case '</extLst>':
break;
case '<ext':
pass = true;
break;
case '</ext>':
pass = false;
break;
default:
if (opts && opts.WTF) {
if (!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs');
}
}
});
}
function write_cellXfs(cellXfs)/*:string*/ {
var o/*:Array<string>*/ = [];
o[o.length] = (writextag('cellXfs',null));
cellXfs.forEach(function(c) { o[o.length] = (writextag('xf', null, c)); });
o[o.length] = ("</cellXfs>");
if(o.length === 2) return "";
o[0] = writextag('cellXfs',null, {count:o.length-2}).replace("/>",">");
return o.join("");
function write_cellXfs(cellXfs) /*:string*/ {
var o /*:Array<string>*/ = [];
o[o.length] = (writextag('cellXfs', null));
cellXfs.forEach(function (c) {
var other;
if (c.applyProtection) {
other = writextag('protection', null, {
locked: 0
});
}
o[o.length] = (writextag('xf', other, c));
});
o[o.length] = ("</cellXfs>");
if (o.length === 2) return "";
o[0] = writextag('cellXfs', null, {
count: o.length - 2
}).replace("/>", ">");
return o.join("");
}
/* 18.8 Styles CT_Stylesheet*/
var parse_sty_xml= (function make_pstyx() {
var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/;
var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/;
var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/;
var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/;
var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;
var parse_sty_xml = (function make_pstyx() {
var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/;
var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/;
var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/;
var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/;
var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;
return function parse_sty_xml(data, themes, opts) {
var styles = {};
if(!data) return styles;
data = data.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");
/* 18.8.39 styleSheet CT_Stylesheet */
var t;
return function parse_sty_xml(data, themes, opts) {
var styles = {};
if (!data) return styles;
data = data.replace(/<!--([\s\S]*?)-->/mg, "").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm, "");
/* 18.8.39 styleSheet CT_Stylesheet */
var t;
/* 18.8.31 numFmts CT_NumFmts ? */
if((t=data.match(numFmtRegex))) parse_numFmts(t, styles, opts);
/* 18.8.31 numFmts CT_NumFmts ? */
if ((t = data.match(numFmtRegex))) parse_numFmts(t, styles, opts);
/* 18.8.23 fonts CT_Fonts ? */
if((t=data.match(fontsRegex))) parse_fonts(t, styles, themes, opts);
/* 18.8.23 fonts CT_Fonts ? */
if ((t = data.match(fontsRegex))) parse_fonts(t, styles, themes, opts);
/* 18.8.21 fills CT_Fills ? */
if((t=data.match(fillsRegex))) parse_fills(t, styles, themes, opts);
/* 18.8.21 fills CT_Fills ? */
if ((t = data.match(fillsRegex))) parse_fills(t, styles, themes, opts);
/* 18.8.5 borders CT_Borders ? */
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
/* 18.8.5 borders CT_Borders ? */
if ((t = data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
/* 18.8.10 cellXfs CT_CellXfs ? */
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
/* 18.8.10 cellXfs CT_CellXfs ? */
if ((t = data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
/* 18.8.8 cellStyles CT_CellStyles ? */
/* 18.8.15 dxfs CT_Dxfs ? */
/* 18.8.42 tableStyles CT_TableStyles ? */
/* 18.8.11 colors CT_Colors ? */
/* 18.2.10 extLst CT_ExtensionList ? */
/* 18.8.8 cellStyles CT_CellStyles ? */
/* 18.8.15 dxfs CT_Dxfs ? */
/* 18.8.42 tableStyles CT_TableStyles ? */
/* 18.8.11 colors CT_Colors ? */
/* 18.2.10 extLst CT_ExtensionList ? */
return styles;
};
return styles;
};
})();
var STYLES_XML_ROOT = writextag('styleSheet', null, {
'xmlns': XMLNS.main[0],
'xmlns:vt': XMLNS.vt
'xmlns': XMLNS.main[0],
'xmlns:vt': XMLNS.vt
});
RELS.STY = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ {
var o = [XML_HEADER, STYLES_XML_ROOT], w;
if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w;
o[o.length] = ('<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>');
o[o.length] = ('<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>');
o[o.length] = ('<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>');
o[o.length] = ('<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>');
if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w);
o[o.length] = ('<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>');
o[o.length] = ('<dxfs count="0"/>');
o[o.length] = ('<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>');
function write_sty_xml(wb /*:Workbook*/ , opts) /*:string*/ {
var o = [XML_HEADER, STYLES_XML_ROOT],
w;
if (wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w;
o[o.length] = ('<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>');
o[o.length] = ('<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>');
o[o.length] = ('<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>');
o[o.length] = ('<cellStyleXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyProtection="1"><protection locked="0"/></xf></cellStyleXfs>');
if ((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w);
o[o.length] = ('<cellStyles count="2"><cellStyle name="Normal" xfId="0" builtinId="0"/><cellStyle name="Unprotected" xfId="1" builtinId="1"/></cellStyles>');
o[o.length] = ('<dxfs count="0"/>');
o[o.length] = ('<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>');
if(o.length>2){ o[o.length] = ('</styleSheet>'); o[1]=o[1].replace("/>",">"); }
return o.join("");
}
if (o.length > 2) {
o[o.length] = ('</styleSheet>');
o[1] = o[1].replace("/>", ">");
}
return o.join("");
}

View File

@ -2,130 +2,175 @@ var strs = {}; // shared strings
var _ssfopts = {}; // spreadsheet formatting options
RELS.WS = [
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
"http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
"http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"
];
/*global Map */
var browser_has_Map = typeof Map !== 'undefined';
function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
var i = 0, len = sst.length;
if(rev) {
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
var revarr = browser_has_Map ? rev.get(str) : rev[str];
for(; i < revarr.length; ++i) {
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
}
}
} else for(; i < len; ++i) {
if(sst[i].t === str) { sst.Count ++; return i; }
}
sst[len] = ({t:str}/*:any*/); sst.Count ++; sst.Unique ++;
if(rev) {
if(browser_has_Map) {
if(!rev.has(str)) rev.set(str, []);
rev.get(str).push(len);
} else {
if(!rev.hasOwnProperty(str)) rev[str] = [];
rev[str].push(len);
}
}
return len;
function get_sst_id(sst /*:SST*/ , str /*:string*/ , rev) /*:number*/ {
var i = 0,
len = sst.length;
if (rev) {
if (browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
var revarr = browser_has_Map ? rev.get(str) : rev[str];
for (; i < revarr.length; ++i) {
if (sst[revarr[i]].t === str) {
sst.Count++;
return revarr[i];
}
}
}
} else
for (; i < len; ++i) {
if (sst[i].t === str) {
sst.Count++;
return i;
}
}
sst[len] = ({
t: str
} /*:any*/ );
sst.Count++;
sst.Unique++;
if (rev) {
if (browser_has_Map) {
if (!rev.has(str)) rev.set(str, []);
rev.get(str).push(len);
} else {
if (!rev.hasOwnProperty(str)) rev[str] = [];
rev[str].push(len);
}
}
return len;
}
function col_obj_w(C/*:number*/, col) {
var p = ({min:C+1,max:C+1}/*:any*/);
/* wch (chars), wpx (pixels) */
var wch = -1;
if(col.MDW) MDW = col.MDW;
if(col.width != null) p.customWidth = 1;
else if(col.wpx != null) wch = px2char(col.wpx);
else if(col.wch != null) wch = col.wch;
if(wch > -1) { p.width = char2width(wch); p.customWidth = 1; }
else if(col.width != null) p.width = col.width;
if(col.hidden) p.hidden = true;
return p;
function col_obj_w(C /*:number*/ , col) {
var p = ({
min: C + 1,
max: C + 1
} /*:any*/ );
/* wch (chars), wpx (pixels) */
var wch = -1;
if (col.MDW) MDW = col.MDW;
if (col.width != null) p.customWidth = 1;
else if (col.wpx != null) wch = px2char(col.wpx);
else if (col.wch != null) wch = col.wch;
if (wch > -1) {
p.width = char2width(wch);
p.customWidth = 1;
} else if (col.width != null) p.width = col.width;
if (col.hidden) p.hidden = true;
return p;
}
function default_margins(margins/*:Margins*/, mode/*:?string*/) {
if(!margins) return;
var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3];
if(mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5];
if(margins.left == null) margins.left = defs[0];
if(margins.right == null) margins.right = defs[1];
if(margins.top == null) margins.top = defs[2];
if(margins.bottom == null) margins.bottom = defs[3];
if(margins.header == null) margins.header = defs[4];
if(margins.footer == null) margins.footer = defs[5];
function default_margins(margins /*:Margins*/ , mode /*:?string*/ ) {
if (!margins) return;
var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3];
if (mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5];
if (margins.left == null) margins.left = defs[0];
if (margins.right == null) margins.right = defs[1];
if (margins.top == null) margins.top = defs[2];
if (margins.bottom == null) margins.bottom = defs[3];
if (margins.header == null) margins.header = defs[4];
if (margins.footer == null) margins.footer = defs[5];
}
function get_cell_style(styles/*:Array<any>*/, cell/*:Cell*/, opts) {
var z = opts.revssf[cell.z != null ? cell.z : "General"];
var i = 0x3c, len = styles.length;
if(z == null && opts.ssf) {
for(; i < 0x188; ++i) if(opts.ssf[i] == null) {
SSF.load(cell.z, i);
// $FlowIgnore
opts.ssf[i] = cell.z;
opts.revssf[cell.z] = z = i;
break;
}
}
for(i = 0; i != len; ++i) if(styles[i].numFmtId === z) return i;
styles[len] = {
numFmtId:z,
fontId:0,
fillId:0,
borderId:0,
xfId:0,
applyNumberFormat:1
};
return len;
function get_cell_style(styles /*:Array<any>*/ , cell /*:Cell*/ , opts) {
var z = opts.revssf[cell.z != null ? cell.z : "General"];
var i = 0x3c,
result;
if (z == null && opts.ssf) {
for (; i < 0x188; ++i)
if (opts.ssf[i] == null) {
SSF.load(cell.z, i);
// $FlowIgnore
opts.ssf[i] = cell.z;
opts.revssf[cell.z] = z = i;
break;
}
}
if (cell.p && !styles.find(function(s){ return !!s.applyProtection; })) {
styles[styles.length] = {
numFmtId: z,
fontId: 0,
fillId: 0,
borderId: 0,
xfId: 1,
applyNumberFormat: 1,
applyProtection: 1
};
}
for (i = 0; i != styles.length; ++i) {
if (styles[i].numFmtId === z) {
if (cell.p && !styles[i].applyProtection) {
continue;
}
result = i;
break;
}
}
if (result == undefined) {
var len = styles.length;
styles[len] = {
numFmtId: z,
fontId: 0,
fillId: 0,
borderId: 0,
xfId: 0,
applyNumberFormat: 1
};
result = len;
}
return result;
}
function safe_format(p/*:Cell*/, fmtid/*:number*/, fillid/*:?number*/, opts, themes, styles) {
if(p.t === 'z') return;
if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v);
try {
if(opts.cellNF) p.z = SSF._table[fmtid];
} catch(e) { if(opts.WTF) throw e; }
if(!opts || opts.cellText !== false) try {
if(SSF._table[fmtid] == null) SSF.load(SSFImplicit[fmtid] || "General", fmtid);
if(p.t === 'e') p.w = p.w || BErr[p.v];
else if(fmtid === 0) {
if(p.t === 'n') {
if((p.v|0) === p.v) p.w = SSF._general_int(p.v);
else p.w = SSF._general_num(p.v);
}
else if(p.t === 'd') {
var dd = datenum(p.v);
if((dd|0) === dd) p.w = SSF._general_int(dd);
else p.w = SSF._general_num(dd);
}
else if(p.v === undefined) return "";
else p.w = SSF._general(p.v,_ssfopts);
}
else if(p.t === 'd') p.w = SSF.format(fmtid,datenum(p.v),_ssfopts);
else p.w = SSF.format(fmtid,p.v,_ssfopts);
} catch(e) { if(opts.WTF) throw e; }
if(!opts.cellStyles) return;
if(fillid != null) try {
p.s = styles.Fills[fillid];
if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0);
if(opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb;
}
if (p.s.bgColor && p.s.bgColor.theme) {
p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0);
if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
}
} catch(e) { if(opts.WTF && styles.Fills) throw e; }
function safe_format(p /*:Cell*/ , fmtid /*:number*/ , fillid /*:?number*/ , opts, themes, styles) {
if (p.t === 'z') return;
if (p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v);
try {
if (opts.cellNF) p.z = SSF._table[fmtid];
} catch (e) {
if (opts.WTF) throw e;
}
if (!opts || opts.cellText !== false) try {
if (SSF._table[fmtid] == null) SSF.load(SSFImplicit[fmtid] || "General", fmtid);
if (p.t === 'e') p.w = p.w || BErr[p.v];
else if (fmtid === 0) {
if (p.t === 'n') {
if ((p.v | 0) === p.v) p.w = SSF._general_int(p.v);
else p.w = SSF._general_num(p.v);
} else if (p.t === 'd') {
var dd = datenum(p.v);
if ((dd | 0) === dd) p.w = SSF._general_int(dd);
else p.w = SSF._general_num(dd);
} else if (p.v === undefined) return "";
else p.w = SSF._general(p.v, _ssfopts);
} else if (p.t === 'd') p.w = SSF.format(fmtid, datenum(p.v), _ssfopts);
else p.w = SSF.format(fmtid, p.v, _ssfopts);
} catch (e) {
if (opts.WTF) throw e;
}
if (!opts.cellStyles) return;
if (fillid != null) try {
p.s = styles.Fills[fillid];
if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0);
if (opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb;
}
if (p.s.bgColor && p.s.bgColor.theme) {
p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0);
if (opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
}
} catch (e) {
if (opts.WTF && styles.Fills) throw e;
}
}
function check_ws(ws/*:Worksheet*/, sname/*:string*/, i/*:number*/) {
if(ws && ws['!ref']) {
var range = safe_decode_range(ws['!ref']);
if(range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws['!ref']);
}
}
function check_ws(ws /*:Worksheet*/ , sname /*:string*/ , i /*:number*/ ) {
if (ws && ws['!ref']) {
var range = safe_decode_range(ws['!ref']);
if (range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws['!ref']);
}
}

3
dist/shim.min.js generated vendored

File diff suppressed because one or more lines are too long

18
dist/xlsx.core.min.js generated vendored

File diff suppressed because one or more lines are too long

1
dist/xlsx.core.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/xlsx.core.min.map generated vendored

File diff suppressed because one or more lines are too long

1174
dist/xlsx.extendscript.js generated vendored

File diff suppressed because it is too large Load Diff

24
dist/xlsx.full.min.js generated vendored

File diff suppressed because one or more lines are too long

1
dist/xlsx.full.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/xlsx.full.min.map generated vendored

File diff suppressed because one or more lines are too long

1174
dist/xlsx.js generated vendored

File diff suppressed because it is too large Load Diff

15
dist/xlsx.min.js generated vendored

File diff suppressed because one or more lines are too long

1
dist/xlsx.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/xlsx.min.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,7 @@ Cell objects are plain JS objects with keys and values following the convention:
| `z` | number format string associated with the cell (if requested) |
| `l` | cell hyperlink object (`.Target` holds link, `.Tooltip` is tooltip) |
| `s` | the style/theme of the cell (if applicable) |
| `p` | set to truthy value to remove the lock for a password protected cell |
Built-in export utilities (such as the CSV exporter) will use the `w` text if it
is available. To change a value, be sure to delete `cell.w` (or set it to
@ -24,3 +25,5 @@ text from the number format (`cell.z`) and the raw value if possible.
The actual array formula is stored in the `f` field of the first cell in the
array range. Other cells in the range will omit the `f` field.
When protecting a sheet with ws["!protect"] use cell.p to unlock the cell

File diff suppressed because it is too large Load Diff

1174
xlsx.js generated

File diff suppressed because it is too large Load Diff