version bump 0.10.7: autocorrections for bad files
- recalculate SSF for malformed files (fixes #506 h/t @asksahil) - malformed shared string (fixes #445 h/t @Ramzec) - SSF added to TS def (fixes #711 h/t @duckywang1) - Norsk property names - resolved gitbook processing issues
This commit is contained in:
parent
739c4f220c
commit
00f25cfe1e
|
@ -13,19 +13,19 @@ node_js:
|
|||
matrix:
|
||||
include:
|
||||
- node_js: "6"
|
||||
env: TZ="America/New_York"
|
||||
env: TZ="America/New_York" FMTS=misc
|
||||
- node_js: "8"
|
||||
env: TZ="America/Los_Angeles"
|
||||
- node_js: "6"
|
||||
env: TZ="Europe/London"
|
||||
env: TZ="Europe/London" FMTS=misc
|
||||
- node_js: "8"
|
||||
env: TZ="Europe/Berlin"
|
||||
- node_js: "6"
|
||||
env: TZ="Asia/Kolkata"
|
||||
env: TZ="Asia/Kolkata" FMTS=misc
|
||||
- node_js: "7"
|
||||
env: TZ="Asia/Shanghai"
|
||||
- node_js: "8"
|
||||
env: TZ="Asia/Seoul"
|
||||
env: TZ="Asia/Seoul" FMTS=misc
|
||||
before_install:
|
||||
- "npm install -g npm@4.3.0"
|
||||
- "npm install -g mocha@2.x voc"
|
||||
|
|
3
Makefile
3
Makefile
|
@ -205,8 +205,9 @@ readme: README.md ## Update README Table of Contents
|
|||
|
||||
.PHONY: book
|
||||
book: readme graph ## Update summary for documentation
|
||||
printf "# Summary\n\n- [xlsx](README.md#xlsx)\n" > misc/docs/SUMMARY.md
|
||||
printf "# Summary\n\n- [xlsx](README.md#sheetjs-js-xlsx)\n" > misc/docs/SUMMARY.md
|
||||
markdown-toc README.md | sed 's/(#/(README.md#/g'>> misc/docs/SUMMARY.md
|
||||
<README.md grep -vE "(details|summary)>" > misc/docs/README.md
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
|
|
14
README.md
14
README.md
|
@ -59,12 +59,12 @@ enhancements, additional features by request, and dedicated support.
|
|||
* [ECMAScript 5 Compatibility](#ecmascript-5-compatibility)
|
||||
- [Philosophy](#philosophy)
|
||||
- [Parsing Workbooks](#parsing-workbooks)
|
||||
* [Complete Examples](#complete-examples)
|
||||
* [Parsing Examples](#parsing-examples)
|
||||
* [Streaming Read](#streaming-read)
|
||||
- [Working with the Workbook](#working-with-the-workbook)
|
||||
* [Complete Examples](#complete-examples-1)
|
||||
* [Parsing and Writing Examples](#parsing-and-writing-examples)
|
||||
- [Writing Workbooks](#writing-workbooks)
|
||||
* [Complete Examples](#complete-examples-2)
|
||||
* [Writing Examples](#writing-examples)
|
||||
* [Streaming Write](#streaming-write)
|
||||
- [Interface](#interface)
|
||||
* [Parsing functions](#parsing-functions)
|
||||
|
@ -403,7 +403,7 @@ input_dom_element.addEventListener('change', handleFile, false);
|
|||
</details>
|
||||
|
||||
|
||||
### Complete Examples
|
||||
### Parsing Examples
|
||||
|
||||
- <http://oss.sheetjs.com/js-xlsx/> HTML5 File API / Base64 Text / Web Workers
|
||||
|
||||
|
@ -550,7 +550,9 @@ wb.Sheets[ws_name] = ws;
|
|||
</details>
|
||||
|
||||
|
||||
### Complete Examples
|
||||
### Parsing and Writing Examples
|
||||
|
||||
- <http://sheetjs.com/demos/modify.html> read + modify + write files
|
||||
|
||||
- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> node
|
||||
|
||||
|
@ -607,7 +609,7 @@ saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), "test.xlsx");
|
|||
```
|
||||
</details>
|
||||
|
||||
### Complete Examples
|
||||
### Writing Examples
|
||||
|
||||
- <http://sheetjs.com/demos/table.html> exporting an HTML table
|
||||
- <http://sheetjs.com/demos/writexlsx.html> generates a simple file
|
||||
|
|
|
@ -1 +1 @@
|
|||
XLSX.version = '0.10.6';
|
||||
XLSX.version = '0.10.7';
|
||||
|
|
|
@ -135,9 +135,9 @@ var matchtag = (function() {
|
|||
var vtregex = (function(){ var vt_cache = {};
|
||||
return function vt_regex(bt) {
|
||||
if(vt_cache[bt] !== undefined) return vt_cache[bt];
|
||||
return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">(.*?)</(?:vt:)?" + bt + ">", 'g') );
|
||||
return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)</(?:vt:)?" + bt + ">", 'g') );
|
||||
};})();
|
||||
var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>(.*)</;
|
||||
var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)</;
|
||||
function parseVector(data) {
|
||||
var h = parsexmltag(data);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ function write_UInt32LE(x/*:number*/, o) {
|
|||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.168 */
|
||||
function parse_XLWideString(data)/*:string*/ {
|
||||
function parse_XLWideString(data/*::, length*/)/*:string*/ {
|
||||
var cchCharacters = data.read_shift(4);
|
||||
return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, 'dbcs');
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ var parse_XLSBCodeName = parse_XLWideString;
|
|||
var write_XLSBCodeName = write_XLWideString;
|
||||
|
||||
/* [MS-XLSB] 2.5.166 */
|
||||
function parse_XLNullableWideString(data)/*:string*/ {
|
||||
function parse_XLNullableWideString(data/*::, length*/)/*:string*/ {
|
||||
var cchCharacters = data.read_shift(4);
|
||||
return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift(cchCharacters, 'dbcs');
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ function write_RkNumber(data/*:number*/, o) {
|
|||
|
||||
|
||||
/* [MS-XLSB] 2.5.117 RfX */
|
||||
function parse_RfX(data)/*:Range*/ {
|
||||
function parse_RfX(data /*::, length*/)/*:Range*/ {
|
||||
var cell/*:Range*/ = ({s: {}, e: {}}/*:any*/);
|
||||
cell.s.r = data.read_shift(4);
|
||||
cell.e.r = data.read_shift(4);
|
||||
|
|
|
@ -26,7 +26,7 @@ var CORE_PROPS_REGEX/*:Array<RegExp>*/ = (function() {
|
|||
for(var i = 0; i < CORE_PROPS.length; ++i) {
|
||||
var f = CORE_PROPS[i];
|
||||
var g = "(?:"+ f[0].substr(0,f[0].indexOf(":")) +":)"+ f[0].substr(f[0].indexOf(":")+1);
|
||||
r[i] = new RegExp("<" + g + "[^>]*>(.*)<\/" + g + ">");
|
||||
r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">");
|
||||
}
|
||||
return r;
|
||||
})();
|
||||
|
|
|
@ -25,7 +25,7 @@ function parse_ext_props(data, p) {
|
|||
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
|
||||
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
|
||||
case "raw":
|
||||
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>(.*)<\/" + f[0] + ">"));
|
||||
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
|
||||
if(cur && cur.length > 0) q[f[1]] = cur[1];
|
||||
break;
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ function parse_ext_props(data, p) {
|
|||
case "Fogli di lavoro":
|
||||
case "Folhas de cálculo":
|
||||
case "Planilhas":
|
||||
case "Regneark":
|
||||
case "Werkbladen":
|
||||
p.Worksheets = len;
|
||||
p.SheetNames = parts.slice(idx, idx + len);
|
||||
|
@ -56,6 +57,7 @@ function parse_ext_props(data, p) {
|
|||
|
||||
case "Named Ranges":
|
||||
case "Benannte Bereiche":
|
||||
case "Navngivne områder":
|
||||
p.NamedRanges = len;
|
||||
p.DefinedNames = parts.slice(idx, idx + len);
|
||||
break;
|
||||
|
|
|
@ -108,7 +108,7 @@ function parse_VtVector(blob, cb) {
|
|||
}
|
||||
|
||||
/* [MS-OLEPS] 2.15 TypedPropertyValue */
|
||||
function parse_TypedPropertyValue(blob, type, _opts) {
|
||||
function parse_TypedPropertyValue(blob, type/*:number*/, _opts) {
|
||||
var t = blob.read_shift(2), ret, opts = _opts||{};
|
||||
blob.l += 2;
|
||||
if(type !== VT_VARIANT)
|
||||
|
@ -124,7 +124,7 @@ function parse_TypedPropertyValue(blob, type, _opts) {
|
|||
case 0x41 /*VT_BLOB*/: return parse_BLOB(blob);
|
||||
case 0x47 /*VT_CF*/: return parse_ClipboardData(blob);
|
||||
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw && 4).replace(chr0,'');
|
||||
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t, 4).replace(chr0,'');
|
||||
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,'');
|
||||
case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPair(blob);
|
||||
case 0x101E /*VT_LPSTR*/: return parse_VtVecUnalignedLpstr(blob);
|
||||
default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t);
|
||||
|
@ -277,8 +277,8 @@ function parslurp(blob, length, cb) {
|
|||
|
||||
function parsebool(blob, length) { return blob.read_shift(length) === 0x1; }
|
||||
|
||||
function parseuint16(blob) { return blob.read_shift(2, 'u'); }
|
||||
function parseuint16a(blob, length) { return parslurp(blob,length,parseuint16);}
|
||||
function parseuint16(blob/*::, length:?number, opts:?any*/) { return blob.read_shift(2, 'u'); }
|
||||
function parseuint16a(blob, length/*:: :?number, opts:?any*/) { return parslurp(blob,length,parseuint16);}
|
||||
|
||||
/* --- 2.5 Structures --- */
|
||||
|
||||
|
@ -286,7 +286,7 @@ function parseuint16a(blob, length) { return parslurp(blob,length,parseuint16);}
|
|||
var parse_Boolean = parsebool;
|
||||
|
||||
/* [MS-XLS] 2.5.10 Bes (boolean or error) */
|
||||
function parse_Bes(blob) {
|
||||
function parse_Bes(blob/*::, length*/) {
|
||||
var v = blob.read_shift(1), t = blob.read_shift(1);
|
||||
return t === 0x01 ? v : v === 0x01;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ function parse_XLUnicodeString2(blob, length, opts) {
|
|||
var parse_ControlInfo = parsenoop;
|
||||
|
||||
/* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */
|
||||
var parse_URLMoniker = function(blob/*, length, opts*/) {
|
||||
var parse_URLMoniker = function(blob/*::, length, opts*/) {
|
||||
var len = blob.read_shift(4), start = blob.l;
|
||||
var extra = false;
|
||||
if(len > 24) {
|
||||
|
|
|
@ -292,15 +292,15 @@ var SYLK = (function() {
|
|||
return [arr, sht];
|
||||
}
|
||||
|
||||
function sylk_to_sheet(str/*:string*/, opts)/*:Worksheet*/ {
|
||||
var aoasht = sylk_to_aoa(str, opts);
|
||||
function sylk_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ {
|
||||
var aoasht = sylk_to_aoa(d, opts);
|
||||
var aoa = aoasht[0], ws = aoasht[1];
|
||||
var o = aoa_to_sheet(aoa, opts);
|
||||
keys(ws).forEach(function(k) { o[k] = ws[k]; });
|
||||
return o;
|
||||
}
|
||||
|
||||
function sylk_to_workbook(str/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(sylk_to_sheet(str, opts), opts); }
|
||||
function sylk_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(sylk_to_sheet(d, opts), opts); }
|
||||
|
||||
function write_ws_cell_sylk(cell/*:Cell*/, ws/*:Worksheet*/, R/*:number*/, C/*:number*/, opts)/*:string*/ {
|
||||
var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K";
|
||||
|
@ -580,7 +580,7 @@ var PRN = (function() {
|
|||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
|
||||
function prn_to_workbook(str/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(prn_to_sheet(str, opts), opts); }
|
||||
function prn_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(prn_to_sheet(d, opts), opts); }
|
||||
|
||||
function sheet_to_prn(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
|
|
|
@ -163,7 +163,7 @@ var parse_rs = (function parse_rs_factory() {
|
|||
|
||||
/* 18.4.8 si CT_Rst */
|
||||
var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r>/;
|
||||
var sirphregex = /<(?:\w+:)?rPh.*?>(.*?)<\/(?:\w+:)?rPh>/g;
|
||||
var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;
|
||||
function parse_si(x, opts) {
|
||||
var html = opts ? opts.cellHTML : true;
|
||||
var z = {};
|
||||
|
|
|
@ -17,44 +17,48 @@ function parse_borders(t, styles, themes, opts) {
|
|||
case '</border>': break;
|
||||
|
||||
/* note: not in spec, appears to be CT_BorderPr */
|
||||
case '<left': case '<left/>': break;
|
||||
case '<left/>': break;
|
||||
case '<left': case '<left>': break;
|
||||
case '</left>': break;
|
||||
|
||||
/* note: not in spec, appears to be CT_BorderPr */
|
||||
case '<right': case '<right/>': break;
|
||||
case '<right/>': break;
|
||||
case '<right': case '<right>': break;
|
||||
case '</right>': break;
|
||||
|
||||
/* 18.8.43 top CT_BorderPr */
|
||||
case '<top': case '<top/>': break;
|
||||
case '<top/>': break;
|
||||
case '<top': case '<top>': break;
|
||||
case '</top>': break;
|
||||
|
||||
/* 18.8.6 bottom CT_BorderPr */
|
||||
case '<bottom': case '<bottom/>': break;
|
||||
case '<bottom/>': break;
|
||||
case '<bottom': case '<bottom>': break;
|
||||
case '</bottom>': break;
|
||||
|
||||
/* 18.8.13 diagonal CT_BorderPr */
|
||||
case '<diagonal': case '<diagonal/>': break;
|
||||
case '<diagonal': case '<diagonal>': case '<diagonal/>': break;
|
||||
case '</diagonal>': break;
|
||||
|
||||
/* 18.8.25 horizontal CT_BorderPr */
|
||||
case '<horizontal': case '<horizontal/>': break;
|
||||
case '<horizontal': case '<horizontal>': case '<horizontal/>': break;
|
||||
case '</horizontal>': break;
|
||||
|
||||
/* 18.8.44 vertical CT_BorderPr */
|
||||
case '<vertical': case '<vertical/>': break;
|
||||
case '<vertical': case '<vertical>': case '<vertical/>': break;
|
||||
case '</vertical>': break;
|
||||
|
||||
/* 18.8.37 start CT_BorderPr */
|
||||
case '<start': case '<start/>': break;
|
||||
case '<start': case '<start>': case '<start/>': break;
|
||||
case '</start>': break;
|
||||
|
||||
/* 18.8.16 end CT_BorderPr */
|
||||
case '<end': case '<end/>': break;
|
||||
case '<end': case '<end>': case '<end/>': break;
|
||||
case '</end>': break;
|
||||
|
||||
/* 18.8.? color CT_Color */
|
||||
case '<color': case '<color/>': break;
|
||||
case '</color>': break;
|
||||
case '<color': case '<color>': break;
|
||||
case '<color/>': case '</color>': break;
|
||||
|
||||
default: if(opts && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in borders');
|
||||
}
|
||||
|
@ -71,7 +75,7 @@ function parse_fills(t, styles, themes, opts) {
|
|||
case '<fills': case '<fills>': case '</fills>': break;
|
||||
|
||||
/* 18.8.20 fill CT_Fill */
|
||||
case '<fill>': break;
|
||||
case '<fill>': case '<fill': break;
|
||||
case '</fill>': styles.Fills.push(fill); fill = {}; break;
|
||||
|
||||
/* 18.8.24 gradientFill CT_GradientFill */
|
||||
|
@ -204,7 +208,7 @@ function parse_fonts(t, styles, themes, opts) {
|
|||
if(!font.color) font.color = {};
|
||||
if(y.auto) font.color.auto = parsexmlbool(y.auto);
|
||||
|
||||
if(y.rgb) font.color.rgb = y.rgb;
|
||||
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];
|
||||
|
@ -240,7 +244,14 @@ function parse_numFmts(t, styles, opts) {
|
|||
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) SSF.load(f,j);
|
||||
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');
|
||||
|
@ -271,13 +282,16 @@ function parse_cellXfs(t, styles, opts) {
|
|||
case '<cellXfs': case '<cellXfs>': case '<cellXfs/>': case '</cellXfs>': break;
|
||||
|
||||
/* 18.8.45 xf CT_Xf */
|
||||
case '<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;
|
||||
|
||||
|
@ -316,15 +330,16 @@ function write_cellXfs(cellXfs)/*:string*/ {
|
|||
|
||||
/* 18.8 Styles CT_Stylesheet*/
|
||||
var parse_sty_xml= (function make_pstyx() {
|
||||
var numFmtRegex = /<numFmts([^>]*)>.*<\/numFmts>/;
|
||||
var cellXfRegex = /<cellXfs([^>]*)>.*<\/cellXfs>/;
|
||||
var fillsRegex = /<fills([^>]*)>.*<\/fills>/;
|
||||
var fontsRegex = /<fonts([^>]*)>.*<\/fonts>/;
|
||||
var bordersRegex = /<borders([^>]*)>.*<\/borders>/;
|
||||
var numFmtRegex = /<numFmts([^>]*)>[\S\s]*?<\/numFmts>/;
|
||||
var cellXfRegex = /<cellXfs([^>]*)>[\S\s]*?<\/cellXfs>/;
|
||||
var fillsRegex = /<fills([^>]*)>[\S\s]*?<\/fills>/;
|
||||
var fontsRegex = /<fonts([^>]*)>[\S\s]*?<\/fonts>/;
|
||||
var bordersRegex = /<borders([^>]*)>[\S\s]*?<\/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;
|
||||
|
||||
|
|
|
@ -259,14 +259,14 @@ function parse_sty_bin(data, themes, opts) {
|
|||
function write_FMTS_bin(ba, NF/*:?SSFTable*/) {
|
||||
if(!NF) return;
|
||||
var cnt = 0;
|
||||
[[5,8],[23,26],[41,44],[/*63*/57,/*66],[164,*/392]].forEach(function(r) {
|
||||
[[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) {
|
||||
/*:: if(!NF) return; */
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) ++cnt;
|
||||
});
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginFmts", write_UInt32LE(cnt));
|
||||
[[5,8],[23,26],[41,44],[/*63*/57,/*66],[164,*/392]].forEach(function(r) {
|
||||
[[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) {
|
||||
/*:: if(!NF) return; */
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, "BrtFmt", write_BrtFmt(i, NF[i]));
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ RELS.DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/d
|
|||
RELS.MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";
|
||||
|
||||
/* macro and dialog sheet stubs */
|
||||
function parse_ds_bin() { return {'!type':'dialog'}; }
|
||||
function parse_ds_xml() { return {'!type':'dialog'}; }
|
||||
function parse_ms_bin() { return {'!type':'macro'}; }
|
||||
function parse_ms_xml() { return {'!type':'macro'}; }
|
||||
function parse_ds_bin(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
|
||||
function parse_ds_xml(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
|
||||
function parse_ms_bin(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }
|
||||
function parse_ms_xml(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }
|
||||
|
|
|
@ -25,7 +25,7 @@ function parse_RgceArea(blob, length, opts) {
|
|||
return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} };
|
||||
}
|
||||
/* BIFF 2-5 encodes flags in the row field */
|
||||
function parse_RgceArea_BIFF2(blob/*, length, opts*/) {
|
||||
function parse_RgceArea_BIFF2(blob/*::, length, opts*/) {
|
||||
var r=parse_ColRelU(blob, 2), R=parse_ColRelU(blob, 2);
|
||||
var c=blob.read_shift(1);
|
||||
var C=blob.read_shift(1);
|
||||
|
@ -33,7 +33,7 @@ function parse_RgceArea_BIFF2(blob/*, length, opts*/) {
|
|||
}
|
||||
|
||||
/* 2.5.198.105 TODO */
|
||||
function parse_RgceAreaRel(blob, length/*, opts*/) {
|
||||
function parse_RgceAreaRel(blob, length/*::, opts*/) {
|
||||
var r=blob.read_shift(length == 12 ? 4 : 2), R=blob.read_shift(length == 12 ? 4 : 2);
|
||||
var c=parse_ColRelU(blob, 2);
|
||||
var C=parse_ColRelU(blob, 2);
|
||||
|
@ -66,7 +66,7 @@ function parse_RgceLocRel(blob, length, opts) {
|
|||
if(cRel == 1) while(cl > 0x1FFF) cl = cl - 0x4000;
|
||||
return {r:r,c:cl,cRel:cRel,rRel:rRel};
|
||||
}
|
||||
function parse_RgceLocRel_BIFF2(blob, length) {
|
||||
function parse_RgceLocRel_BIFF2(blob, length/*::, opts*/) {
|
||||
var rl = blob.read_shift(2);
|
||||
var c = blob.read_shift(1);
|
||||
var rRel = (rl & 0x8000) >> 15, cRel = (rl & 0x4000) >> 14;
|
||||
|
@ -555,7 +555,7 @@ function parse_Formula(blob, length, opts) {
|
|||
}
|
||||
|
||||
/* 2.5.133 TODO: how to emit empty strings? */
|
||||
function parse_FormulaValue(blob) {
|
||||
function parse_FormulaValue(blob/*::, length*/) {
|
||||
var b;
|
||||
if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n'];
|
||||
switch(blob[blob.l]) {
|
||||
|
|
|
@ -75,8 +75,8 @@ function parse_ws_xml(data/*:?string*/, opts, rels, wb, themes, styles)/*:Worksh
|
|||
s["!ref"] = encode_range(tmpref);
|
||||
}
|
||||
}
|
||||
if(mergecells.length > 0) s["!merges"] = mergecells;
|
||||
if(columns.length > 0) s["!cols"] = columns;
|
||||
if(mergecells.length > 0) s["!merges"] = mergecells;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,8 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
|
|||
var ri = 0, x = "", cells = [], cref = [], idx=0, i=0, cc=0, d="", p/*:any*/;
|
||||
var tag, tagr = 0, tagc = 0;
|
||||
var sstr, ftag;
|
||||
var fmtid = 0, fillid = 0, do_format = Array.isArray(styles.CellXf), cf;
|
||||
var fmtid = 0, fillid = 0;
|
||||
var do_format = Array.isArray(styles.CellXf), cf;
|
||||
var arrayf = [];
|
||||
var sharedf = [];
|
||||
var dense = Array.isArray(s);
|
||||
|
@ -326,14 +327,15 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
|
|||
p.v = parseFloat(p.v);
|
||||
break;
|
||||
case 's':
|
||||
sstr = strs[parseInt(p.v, 10)];
|
||||
if(typeof p.v == 'undefined') {
|
||||
if(!opts.sheetStubs) continue;
|
||||
p.t = 'z';
|
||||
} else {
|
||||
sstr = strs[parseInt(p.v, 10)];
|
||||
p.v = sstr.t;
|
||||
p.r = sstr.r;
|
||||
if(opts.cellHTML) p.h = sstr.h;
|
||||
}
|
||||
p.v = sstr.t;
|
||||
p.r = sstr.r;
|
||||
if(opts.cellHTML) p.h = sstr.h;
|
||||
break;
|
||||
case 'str':
|
||||
p.t = "s";
|
||||
|
|
|
@ -9,7 +9,7 @@ function parse_numCache(data) {
|
|||
});
|
||||
|
||||
/* 21.2.2.71 formatCode CT_Xstring */
|
||||
var nf = unescapexml((data.match(/<c:formatCode>(.*?)<\/c:formatCode>/) || ["","General"])[1]);
|
||||
var nf = unescapexml((data.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/) || ["","General"])[1]);
|
||||
|
||||
return [col, nf];
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ function parse_chart(data, name/*:string*/, opts, rels, wb, csheet) {
|
|||
var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} };
|
||||
|
||||
/* 21.2.2.120 numCache CT_NumData */
|
||||
(data.match(/<c:numCache>.*?<\/c:numCache>/gm)||[]).forEach(function(nc) {
|
||||
(data.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) {
|
||||
var cache = parse_numCache(nc);
|
||||
refguess.s.r = refguess.s.c = 0;
|
||||
refguess.e.c = C;
|
||||
|
|
|
@ -59,7 +59,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
|||
}
|
||||
if(dir.workbooks.length === 0) {
|
||||
binname = "xl/workbook.bin";
|
||||
if(!getzipfile(zip,binname,true)) throw new Error("Could not find workbook");
|
||||
if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook");
|
||||
dir.workbooks.push(binname);
|
||||
xlsb = true;
|
||||
}
|
||||
|
|
|
@ -134,8 +134,7 @@ function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array<string>*/ {
|
|||
var y = "", x, val="";
|
||||
if(sheet == null || sheet["!ref"] == null) return [];
|
||||
var r = safe_decode_range(sheet['!ref']), rr = "", cols = [], C;
|
||||
var cmds = new Array((r.e.r-r.s.r+1)*(r.e.c-r.s.c+1));
|
||||
var i = 0;
|
||||
var cmds/*:Array<string>*/ = [];
|
||||
var dense = Array.isArray(sheet);
|
||||
for(C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C);
|
||||
for(var R = r.s.r; R <= r.e.r; ++R) {
|
||||
|
@ -159,10 +158,9 @@ function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array<string>*/ {
|
|||
else if(x.v === undefined) continue;
|
||||
else if(x.t == 's') val = "'" + x.v;
|
||||
else val = ""+x.v;
|
||||
cmds[i++] = y + "=" + val;
|
||||
cmds[cmds.length] = y + "=" + val;
|
||||
}
|
||||
}
|
||||
cmds.length = i;
|
||||
return cmds;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"title": "SheetJS js-xlsx",
|
||||
"author": "sheetjs",
|
||||
"gitbook": "3.2.2",
|
||||
"plugins": ["anchorjs", "ga", "sidebar-ad", "-sharing", "-search", "advanced-emoji"],
|
||||
"plugins": ["anchorjs", "ga", "sidebar-ad", "-sharing", "-search", "advanced-emoji", "-lunr"],
|
||||
"pluginsConfig": {
|
||||
"anchorjs": {
|
||||
"icon": "#",
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@
|
|||
/*global global, exports, module, require:false, process:false, Buffer:false */
|
||||
var XLSX = {};
|
||||
(function make_xlsx(XLSX){
|
||||
XLSX.version = '0.10.6';
|
||||
XLSX.version = '0.10.7';
|
||||
var current_codepage = 1200;
|
||||
/*global cptable:true */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
|
@ -1730,9 +1730,9 @@ var matchtag = (function() {
|
|||
var vtregex = (function(){ var vt_cache = {};
|
||||
return function vt_regex(bt) {
|
||||
if(vt_cache[bt] !== undefined) return vt_cache[bt];
|
||||
return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">(.*?)</(?:vt:)?" + bt + ">", 'g') );
|
||||
return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)</(?:vt:)?" + bt + ">", 'g') );
|
||||
};})();
|
||||
var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>(.*)</;
|
||||
var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)</;
|
||||
function parseVector(data) {
|
||||
var h = parsexmltag(data);
|
||||
|
||||
|
@ -2391,7 +2391,7 @@ function write_RkNumber(data, o) {
|
|||
|
||||
|
||||
/* [MS-XLSB] 2.5.117 RfX */
|
||||
function parse_RfX(data) {
|
||||
function parse_RfX(data ) {
|
||||
var cell = ({s: {}, e: {}});
|
||||
cell.s.r = data.read_shift(4);
|
||||
cell.e.r = data.read_shift(4);
|
||||
|
@ -3254,7 +3254,7 @@ var CORE_PROPS_REGEX = (function() {
|
|||
for(var i = 0; i < CORE_PROPS.length; ++i) {
|
||||
var f = CORE_PROPS[i];
|
||||
var g = "(?:"+ f[0].substr(0,f[0].indexOf(":")) +":)"+ f[0].substr(f[0].indexOf(":")+1);
|
||||
r[i] = new RegExp("<" + g + "[^>]*>(.*)<\/" + g + ">");
|
||||
r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">");
|
||||
}
|
||||
return r;
|
||||
})();
|
||||
|
@ -3334,7 +3334,7 @@ function parse_ext_props(data, p) {
|
|||
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
|
||||
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
|
||||
case "raw":
|
||||
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>(.*)<\/" + f[0] + ">"));
|
||||
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
|
||||
if(cur && cur.length > 0) q[f[1]] = cur[1];
|
||||
break;
|
||||
}
|
||||
|
@ -3358,6 +3358,7 @@ function parse_ext_props(data, p) {
|
|||
case "Fogli di lavoro":
|
||||
case "Folhas de cálculo":
|
||||
case "Planilhas":
|
||||
case "Regneark":
|
||||
case "Werkbladen":
|
||||
p.Worksheets = len;
|
||||
p.SheetNames = parts.slice(idx, idx + len);
|
||||
|
@ -3365,6 +3366,7 @@ function parse_ext_props(data, p) {
|
|||
|
||||
case "Named Ranges":
|
||||
case "Benannte Bereiche":
|
||||
case "Navngivne områder":
|
||||
p.NamedRanges = len;
|
||||
p.DefinedNames = parts.slice(idx, idx + len);
|
||||
break;
|
||||
|
@ -3692,7 +3694,7 @@ function parse_TypedPropertyValue(blob, type, _opts) {
|
|||
case 0x41 /*VT_BLOB*/: return parse_BLOB(blob);
|
||||
case 0x47 /*VT_CF*/: return parse_ClipboardData(blob);
|
||||
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw && 4).replace(chr0,'');
|
||||
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t, 4).replace(chr0,'');
|
||||
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,'');
|
||||
case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPair(blob);
|
||||
case 0x101E /*VT_LPSTR*/: return parse_VtVecUnalignedLpstr(blob);
|
||||
default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t);
|
||||
|
@ -3928,7 +3930,7 @@ function parse_XLUnicodeString2(blob, length, opts) {
|
|||
var parse_ControlInfo = parsenoop;
|
||||
|
||||
/* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */
|
||||
var parse_URLMoniker = function(blob/*, length, opts*/) {
|
||||
var parse_URLMoniker = function(blob) {
|
||||
var len = blob.read_shift(4), start = blob.l;
|
||||
var extra = false;
|
||||
if(len > 24) {
|
||||
|
@ -5431,15 +5433,15 @@ var SYLK = (function() {
|
|||
return [arr, sht];
|
||||
}
|
||||
|
||||
function sylk_to_sheet(str, opts) {
|
||||
var aoasht = sylk_to_aoa(str, opts);
|
||||
function sylk_to_sheet(d, opts) {
|
||||
var aoasht = sylk_to_aoa(d, opts);
|
||||
var aoa = aoasht[0], ws = aoasht[1];
|
||||
var o = aoa_to_sheet(aoa, opts);
|
||||
keys(ws).forEach(function(k) { o[k] = ws[k]; });
|
||||
return o;
|
||||
}
|
||||
|
||||
function sylk_to_workbook(str, opts) { return sheet_to_workbook(sylk_to_sheet(str, opts), opts); }
|
||||
function sylk_to_workbook(d, opts) { return sheet_to_workbook(sylk_to_sheet(d, opts), opts); }
|
||||
|
||||
function write_ws_cell_sylk(cell, ws, R, C, opts) {
|
||||
var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K";
|
||||
|
@ -5719,7 +5721,7 @@ var PRN = (function() {
|
|||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
|
||||
function prn_to_workbook(str, opts) { return sheet_to_workbook(prn_to_sheet(str, opts), opts); }
|
||||
function prn_to_workbook(d, opts) { return sheet_to_workbook(prn_to_sheet(d, opts), opts); }
|
||||
|
||||
function sheet_to_prn(ws, opts) {
|
||||
var o = [];
|
||||
|
@ -6253,7 +6255,7 @@ var parse_rs = (function parse_rs_factory() {
|
|||
|
||||
/* 18.4.8 si CT_Rst */
|
||||
var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r>/;
|
||||
var sirphregex = /<(?:\w+:)?rPh.*?>(.*?)<\/(?:\w+:)?rPh>/g;
|
||||
var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;
|
||||
function parse_si(x, opts) {
|
||||
var html = opts ? opts.cellHTML : true;
|
||||
var z = {};
|
||||
|
@ -6811,44 +6813,48 @@ function parse_borders(t, styles, themes, opts) {
|
|||
case '</border>': break;
|
||||
|
||||
/* note: not in spec, appears to be CT_BorderPr */
|
||||
case '<left': case '<left/>': break;
|
||||
case '<left/>': break;
|
||||
case '<left': case '<left>': break;
|
||||
case '</left>': break;
|
||||
|
||||
/* note: not in spec, appears to be CT_BorderPr */
|
||||
case '<right': case '<right/>': break;
|
||||
case '<right/>': break;
|
||||
case '<right': case '<right>': break;
|
||||
case '</right>': break;
|
||||
|
||||
/* 18.8.43 top CT_BorderPr */
|
||||
case '<top': case '<top/>': break;
|
||||
case '<top/>': break;
|
||||
case '<top': case '<top>': break;
|
||||
case '</top>': break;
|
||||
|
||||
/* 18.8.6 bottom CT_BorderPr */
|
||||
case '<bottom': case '<bottom/>': break;
|
||||
case '<bottom/>': break;
|
||||
case '<bottom': case '<bottom>': break;
|
||||
case '</bottom>': break;
|
||||
|
||||
/* 18.8.13 diagonal CT_BorderPr */
|
||||
case '<diagonal': case '<diagonal/>': break;
|
||||
case '<diagonal': case '<diagonal>': case '<diagonal/>': break;
|
||||
case '</diagonal>': break;
|
||||
|
||||
/* 18.8.25 horizontal CT_BorderPr */
|
||||
case '<horizontal': case '<horizontal/>': break;
|
||||
case '<horizontal': case '<horizontal>': case '<horizontal/>': break;
|
||||
case '</horizontal>': break;
|
||||
|
||||
/* 18.8.44 vertical CT_BorderPr */
|
||||
case '<vertical': case '<vertical/>': break;
|
||||
case '<vertical': case '<vertical>': case '<vertical/>': break;
|
||||
case '</vertical>': break;
|
||||
|
||||
/* 18.8.37 start CT_BorderPr */
|
||||
case '<start': case '<start/>': break;
|
||||
case '<start': case '<start>': case '<start/>': break;
|
||||
case '</start>': break;
|
||||
|
||||
/* 18.8.16 end CT_BorderPr */
|
||||
case '<end': case '<end/>': break;
|
||||
case '<end': case '<end>': case '<end/>': break;
|
||||
case '</end>': break;
|
||||
|
||||
/* 18.8.? color CT_Color */
|
||||
case '<color': case '<color/>': break;
|
||||
case '</color>': break;
|
||||
case '<color': case '<color>': break;
|
||||
case '<color/>': case '</color>': break;
|
||||
|
||||
default: if(opts && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in borders');
|
||||
}
|
||||
|
@ -6865,7 +6871,7 @@ function parse_fills(t, styles, themes, opts) {
|
|||
case '<fills': case '<fills>': case '</fills>': break;
|
||||
|
||||
/* 18.8.20 fill CT_Fill */
|
||||
case '<fill>': break;
|
||||
case '<fill>': case '<fill': break;
|
||||
case '</fill>': styles.Fills.push(fill); fill = {}; break;
|
||||
|
||||
/* 18.8.24 gradientFill CT_GradientFill */
|
||||
|
@ -6998,7 +7004,7 @@ function parse_fonts(t, styles, themes, opts) {
|
|||
if(!font.color) font.color = {};
|
||||
if(y.auto) font.color.auto = parsexmlbool(y.auto);
|
||||
|
||||
if(y.rgb) font.color.rgb = y.rgb;
|
||||
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];
|
||||
|
@ -7034,7 +7040,14 @@ function parse_numFmts(t, styles, opts) {
|
|||
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) SSF.load(f,j);
|
||||
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');
|
||||
|
@ -7065,13 +7078,16 @@ function parse_cellXfs(t, styles, opts) {
|
|||
case '<cellXfs': case '<cellXfs>': case '<cellXfs/>': case '</cellXfs>': break;
|
||||
|
||||
/* 18.8.45 xf CT_Xf */
|
||||
case '<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;
|
||||
|
||||
|
@ -7110,15 +7126,16 @@ function write_cellXfs(cellXfs) {
|
|||
|
||||
/* 18.8 Styles CT_Stylesheet*/
|
||||
var parse_sty_xml= (function make_pstyx() {
|
||||
var numFmtRegex = /<numFmts([^>]*)>.*<\/numFmts>/;
|
||||
var cellXfRegex = /<cellXfs([^>]*)>.*<\/cellXfs>/;
|
||||
var fillsRegex = /<fills([^>]*)>.*<\/fills>/;
|
||||
var fontsRegex = /<fonts([^>]*)>.*<\/fonts>/;
|
||||
var bordersRegex = /<borders([^>]*)>.*<\/borders>/;
|
||||
var numFmtRegex = /<numFmts([^>]*)>[\S\s]*?<\/numFmts>/;
|
||||
var cellXfRegex = /<cellXfs([^>]*)>[\S\s]*?<\/cellXfs>/;
|
||||
var fillsRegex = /<fills([^>]*)>[\S\s]*?<\/fills>/;
|
||||
var fontsRegex = /<fonts([^>]*)>[\S\s]*?<\/fonts>/;
|
||||
var bordersRegex = /<borders([^>]*)>[\S\s]*?<\/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;
|
||||
|
||||
|
@ -7432,13 +7449,13 @@ function parse_sty_bin(data, themes, opts) {
|
|||
function write_FMTS_bin(ba, NF) {
|
||||
if(!NF) return;
|
||||
var cnt = 0;
|
||||
[[5,8],[23,26],[41,44],[/*63*/57,/*66],[164,*/392]].forEach(function(r) {
|
||||
[[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) ++cnt;
|
||||
});
|
||||
|
||||
if(cnt == 0) return;
|
||||
write_record(ba, "BrtBeginFmts", write_UInt32LE(cnt));
|
||||
[[5,8],[23,26],[41,44],[/*63*/57,/*66],[164,*/392]].forEach(function(r) {
|
||||
[[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) write_record(ba, "BrtFmt", write_BrtFmt(i, NF[i]));
|
||||
});
|
||||
write_record(ba, "BrtEndFmts");
|
||||
|
@ -8235,10 +8252,10 @@ RELS.DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/d
|
|||
RELS.MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";
|
||||
|
||||
/* macro and dialog sheet stubs */
|
||||
function parse_ds_bin() { return {'!type':'dialog'}; }
|
||||
function parse_ds_xml() { return {'!type':'dialog'}; }
|
||||
function parse_ms_bin() { return {'!type':'macro'}; }
|
||||
function parse_ms_xml() { return {'!type':'macro'}; }
|
||||
function parse_ds_bin(data, opts, rels, wb, themes, styles) { return {'!type':'dialog'}; }
|
||||
function parse_ds_xml(data, opts, rels, wb, themes, styles) { return {'!type':'dialog'}; }
|
||||
function parse_ms_bin(data, opts, rels, wb, themes, styles) { return {'!type':'macro'}; }
|
||||
function parse_ms_xml(data, opts, rels, wb, themes, styles) { return {'!type':'macro'}; }
|
||||
/* TODO: it will be useful to parse the function str */
|
||||
var rc_to_a1 = (function(){
|
||||
var rcregex = /(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g;
|
||||
|
@ -8308,7 +8325,7 @@ function parse_RgceArea(blob, length, opts) {
|
|||
return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} };
|
||||
}
|
||||
/* BIFF 2-5 encodes flags in the row field */
|
||||
function parse_RgceArea_BIFF2(blob/*, length, opts*/) {
|
||||
function parse_RgceArea_BIFF2(blob) {
|
||||
var r=parse_ColRelU(blob, 2), R=parse_ColRelU(blob, 2);
|
||||
var c=blob.read_shift(1);
|
||||
var C=blob.read_shift(1);
|
||||
|
@ -8316,7 +8333,7 @@ function parse_RgceArea_BIFF2(blob/*, length, opts*/) {
|
|||
}
|
||||
|
||||
/* 2.5.198.105 TODO */
|
||||
function parse_RgceAreaRel(blob, length/*, opts*/) {
|
||||
function parse_RgceAreaRel(blob, length) {
|
||||
var r=blob.read_shift(length == 12 ? 4 : 2), R=blob.read_shift(length == 12 ? 4 : 2);
|
||||
var c=parse_ColRelU(blob, 2);
|
||||
var C=parse_ColRelU(blob, 2);
|
||||
|
@ -10729,8 +10746,8 @@ function parse_ws_xml(data, opts, rels, wb, themes, styles) {
|
|||
s["!ref"] = encode_range(tmpref);
|
||||
}
|
||||
}
|
||||
if(mergecells.length > 0) s["!merges"] = mergecells;
|
||||
if(columns.length > 0) s["!cols"] = columns;
|
||||
if(mergecells.length > 0) s["!merges"] = mergecells;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -10893,7 +10910,8 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
|
|||
var ri = 0, x = "", cells = [], cref = [], idx=0, i=0, cc=0, d="", p;
|
||||
var tag, tagr = 0, tagc = 0;
|
||||
var sstr, ftag;
|
||||
var fmtid = 0, fillid = 0, do_format = Array.isArray(styles.CellXf), cf;
|
||||
var fmtid = 0, fillid = 0;
|
||||
var do_format = Array.isArray(styles.CellXf), cf;
|
||||
var arrayf = [];
|
||||
var sharedf = [];
|
||||
var dense = Array.isArray(s);
|
||||
|
@ -10980,14 +10998,15 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
|
|||
p.v = parseFloat(p.v);
|
||||
break;
|
||||
case 's':
|
||||
sstr = strs[parseInt(p.v, 10)];
|
||||
if(typeof p.v == 'undefined') {
|
||||
if(!opts.sheetStubs) continue;
|
||||
p.t = 'z';
|
||||
} else {
|
||||
sstr = strs[parseInt(p.v, 10)];
|
||||
p.v = sstr.t;
|
||||
p.r = sstr.r;
|
||||
if(opts.cellHTML) p.h = sstr.h;
|
||||
}
|
||||
p.v = sstr.t;
|
||||
p.r = sstr.r;
|
||||
if(opts.cellHTML) p.h = sstr.h;
|
||||
break;
|
||||
case 'str':
|
||||
p.t = "s";
|
||||
|
@ -11994,7 +12013,7 @@ function parse_numCache(data) {
|
|||
});
|
||||
|
||||
/* 21.2.2.71 formatCode CT_Xstring */
|
||||
var nf = unescapexml((data.match(/<c:formatCode>(.*?)<\/c:formatCode>/) || ["","General"])[1]);
|
||||
var nf = unescapexml((data.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/) || ["","General"])[1]);
|
||||
|
||||
return [col, nf];
|
||||
}
|
||||
|
@ -12009,7 +12028,7 @@ function parse_chart(data, name, opts, rels, wb, csheet) {
|
|||
var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} };
|
||||
|
||||
/* 21.2.2.120 numCache CT_NumData */
|
||||
(data.match(/<c:numCache>.*?<\/c:numCache>/gm)||[]).forEach(function(nc) {
|
||||
(data.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) {
|
||||
var cache = parse_numCache(nc);
|
||||
refguess.s.r = refguess.s.c = 0;
|
||||
refguess.e.c = C;
|
||||
|
@ -17029,7 +17048,7 @@ function parse_zip(zip, opts) {
|
|||
}
|
||||
if(dir.workbooks.length === 0) {
|
||||
binname = "xl/workbook.bin";
|
||||
if(!getzipfile(zip,binname,true)) throw new Error("Could not find workbook");
|
||||
if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook");
|
||||
dir.workbooks.push(binname);
|
||||
xlsb = true;
|
||||
}
|
||||
|
@ -17626,8 +17645,7 @@ function sheet_to_formulae(sheet) {
|
|||
var y = "", x, val="";
|
||||
if(sheet == null || sheet["!ref"] == null) return [];
|
||||
var r = safe_decode_range(sheet['!ref']), rr = "", cols = [], C;
|
||||
var cmds = new Array((r.e.r-r.s.r+1)*(r.e.c-r.s.c+1));
|
||||
var i = 0;
|
||||
var cmds = [];
|
||||
var dense = Array.isArray(sheet);
|
||||
for(C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C);
|
||||
for(var R = r.s.r; R <= r.e.r; ++R) {
|
||||
|
@ -17651,10 +17669,9 @@ function sheet_to_formulae(sheet) {
|
|||
else if(x.v === undefined) continue;
|
||||
else if(x.t == 's') val = "'" + x.v;
|
||||
else val = ""+x.v;
|
||||
cmds[i++] = y + "=" + val;
|
||||
cmds[cmds.length] = y + "=" + val;
|
||||
}
|
||||
}
|
||||
cmds.length = i;
|
||||
return cmds;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -144,7 +144,7 @@ input_dom_element.addEventListener('change', handleFile, false);
|
|||
</details>
|
||||
|
||||
|
||||
### Complete Examples
|
||||
### Parsing Examples
|
||||
|
||||
- <http://oss.sheetjs.com/js-xlsx/> HTML5 File API / Base64 Text / Web Workers
|
||||
|
||||
|
|
|
@ -50,7 +50,9 @@ wb.Sheets[ws_name] = ws;
|
|||
</details>
|
||||
|
||||
|
||||
### Complete Examples
|
||||
### Parsing and Writing Examples
|
||||
|
||||
- <http://sheetjs.com/demos/modify.html> read + modify + write files
|
||||
|
||||
- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> node
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), "test.xlsx");
|
|||
```
|
||||
</details>
|
||||
|
||||
### Complete Examples
|
||||
### Writing Examples
|
||||
|
||||
- <http://sheetjs.com/demos/table.html> exporting an HTML table
|
||||
- <http://sheetjs.com/demos/writexlsx.html> generates a simple file
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../README.md
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,18 @@
|
|||
# Summary
|
||||
|
||||
- [xlsx](README.md#xlsx)
|
||||
- [xlsx](README.md#sheetjs-js-xlsx)
|
||||
- [Installation](README.md#installation)
|
||||
* [JS Ecosystem Demos](README.md#js-ecosystem-demos)
|
||||
* [Optional Modules](README.md#optional-modules)
|
||||
* [ECMAScript 5 Compatibility](README.md#ecmascript-5-compatibility)
|
||||
- [Philosophy](README.md#philosophy)
|
||||
- [Parsing Workbooks](README.md#parsing-workbooks)
|
||||
* [Complete Examples](README.md#complete-examples)
|
||||
* [Parsing Examples](README.md#parsing-examples)
|
||||
* [Streaming Read](README.md#streaming-read)
|
||||
- [Working with the Workbook](README.md#working-with-the-workbook)
|
||||
* [Complete Examples](README.md#complete-examples-1)
|
||||
* [Parsing and Writing Examples](README.md#parsing-and-writing-examples)
|
||||
- [Writing Workbooks](README.md#writing-workbooks)
|
||||
* [Complete Examples](README.md#complete-examples-2)
|
||||
* [Writing Examples](README.md#writing-examples)
|
||||
* [Streaming Write](README.md#streaming-write)
|
||||
- [Interface](README.md#interface)
|
||||
* [Parsing functions](README.md#parsing-functions)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.10.6",
|
||||
"version": "0.10.7",
|
||||
"author": "sheetjs",
|
||||
"description": "Excel (XLSB/XLSX/XLS/XML) ODS and other spreadsheet format (CSV/DIF/DBF/SYLK) parser and writer",
|
||||
"keywords": [ "excel", "xls", "xlsx", "xlsb", "xlsm", "ods", "csv", "dbf", "dif", "sylk", "office", "spreadsheet" ],
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../dist/xlsx.core.min.js
|
|
@ -4,7 +4,7 @@
|
|||
/** Version string */
|
||||
export const version: string;
|
||||
|
||||
/** Defined SSF */
|
||||
/** SSF Formatter Library */
|
||||
export const SSF: any;
|
||||
|
||||
/** Attempts to read filename and parse */
|
||||
|
|