version bump 0.16.7

- set active worksheet to first visible (fixes #1433 h/t @ManjunathSVBB)
This commit is contained in:
SheetJS 2020-09-11 04:38:33 -04:00
parent 0cc6cc9627
commit 82b7ada6c7
25 changed files with 420 additions and 246 deletions

View File

@ -1 +1 @@
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';

View File

@ -122,6 +122,7 @@ function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length
function fuzzynum(s/*:string*/)/*:number*/ {
var v/*:number*/ = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;

View File

@ -1,43 +1,43 @@
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -100,9 +100,9 @@ var SpecialProperties = {
/*::[*/0x72627262/*::]*/: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n");
@ -185,7 +185,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -295,4 +295,4 @@ var BErr = {
/*::[*/0x2B/*::]*/: "#GETTING_DATA",
/*::[*/0xFF/*::]*/: "#WTF?"
};
var RBErr = evert_num(BErr);
var RBErr = evert_num(BErr);

View File

@ -7,6 +7,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
}/*:any*/);

View File

@ -192,7 +192,17 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {

View File

@ -611,6 +611,8 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
@ -630,8 +632,6 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;

View File

@ -33,7 +33,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
var write_ws = function(ws, wb/*:Workbook*/, i/*:number*//*::, opts*/)/*:string*/ {
/* Section 9 Tables */
var o/*:Array<string>*/ = [];
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
var R=0,C=0, range = decode_range(ws['!ref']);
var marr/*:Array<Range>*/ = ws['!merges'] || [], mi = 0;
var dense = Array.isArray(ws);
@ -105,6 +105,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
var write_automatic_styles_ods = function(o/*:Array<string>*/) {
o.push(' <office:automatic-styles>\n');
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
o.push(' <number:month number:style="long"/>\n');
o.push(' <number:text>/</number:text>\n');
@ -113,11 +114,16 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
o.push(' <number:year/>\n');
o.push(' </number:date-style>\n');
/* table */
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
o.push(' </style:style>\n');
/* table cells, text */
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
/* page-layout */
o.push(' </office:automatic-styles>\n');
};

View File

@ -8,7 +8,8 @@ function fix_opts_func(defaults/*:Array<Array<any> >*/)/*:{(o:any):void}*/ {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -27,8 +28,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

76
dist/xlsx.extendscript.js generated vendored
View File

@ -9161,7 +9161,7 @@ module.exports = ZStream;
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -12017,6 +12017,7 @@ function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -13262,43 +13263,43 @@ function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatO
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -13361,9 +13362,9 @@ var SpecialProperties = {
0x72627262: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE = evert_key(DocSummaryPIDDSI, "n");
@ -13446,7 +13447,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr) { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr) { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -13556,7 +13557,8 @@ var BErr = {
0x2B: "#GETTING_DATA",
0xFF: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -13867,6 +13869,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
});
@ -22598,7 +22602,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb) {
}
function write_ws_xml_cell(cell, ref, ws, opts) {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -22634,7 +22638,7 @@ function write_ws_xml_cell(cell, ref, ws, opts) {
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -24354,7 +24358,17 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -25383,6 +25397,8 @@ Workbook.WBProps.date1904 = true;
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
@ -25402,8 +25418,6 @@ Workbook.WBProps.date1904 = true;
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
@ -29420,7 +29434,7 @@ var write_content_ods = (function() {
var write_ws = function(ws, wb, i) {
/* Section 9 Tables */
var o = [];
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
var R=0,C=0, range = decode_range(ws['!ref']);
var marr = ws['!merges'] || [], mi = 0;
var dense = Array.isArray(ws);
@ -29492,6 +29506,7 @@ var write_content_ods = (function() {
var write_automatic_styles_ods = function(o) {
o.push(' <office:automatic-styles>\n');
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
o.push(' <number:month number:style="long"/>\n');
o.push(' <number:text>/</number:text>\n');
@ -29500,11 +29515,16 @@ var write_content_ods = (function() {
o.push(' <number:year/>\n');
o.push(' </number:date-style>\n');
/* table */
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
o.push(' </style:style>\n');
/* table cells, text */
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
/* page-layout */
o.push(' </office:automatic-styles>\n');
};
@ -29647,7 +29667,8 @@ function fix_opts_func(defaults) {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -29666,8 +29687,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -30487,7 +30508,6 @@ function sheet_to_formulae(sheet) {
}
function sheet_add_json(_ws, js, opts) {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws = _ws || ({});

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

76
dist/xlsx.js generated vendored
View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -2860,6 +2860,7 @@ function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -4105,43 +4106,43 @@ function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatO
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -4204,9 +4205,9 @@ var SpecialProperties = {
0x72627262: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE = evert_key(DocSummaryPIDDSI, "n");
@ -4289,7 +4290,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr) { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr) { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -4399,7 +4400,8 @@ var BErr = {
0x2B: "#GETTING_DATA",
0xFF: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -4710,6 +4712,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
});
@ -13441,7 +13445,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb) {
}
function write_ws_xml_cell(cell, ref, ws, opts) {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -13477,7 +13481,7 @@ function write_ws_xml_cell(cell, ref, ws, opts) {
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -15197,7 +15201,17 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -16226,6 +16240,8 @@ Workbook.WBProps.date1904 = true;
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
@ -16245,8 +16261,6 @@ Workbook.WBProps.date1904 = true;
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
@ -20263,7 +20277,7 @@ var write_content_ods = (function() {
var write_ws = function(ws, wb, i) {
/* Section 9 Tables */
var o = [];
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
var R=0,C=0, range = decode_range(ws['!ref']);
var marr = ws['!merges'] || [], mi = 0;
var dense = Array.isArray(ws);
@ -20335,6 +20349,7 @@ var write_content_ods = (function() {
var write_automatic_styles_ods = function(o) {
o.push(' <office:automatic-styles>\n');
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
o.push(' <number:month number:style="long"/>\n');
o.push(' <number:text>/</number:text>\n');
@ -20343,11 +20358,16 @@ var write_content_ods = (function() {
o.push(' <number:year/>\n');
o.push(' </number:date-style>\n');
/* table */
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
o.push(' </style:style>\n');
/* table cells, text */
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
/* page-layout */
o.push(' </office:automatic-styles>\n');
};
@ -20490,7 +20510,8 @@ function fix_opts_func(defaults) {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -20509,8 +20530,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -21330,7 +21351,6 @@ function sheet_to_formulae(sheet) {
}
function sheet_add_json(_ws, js, opts) {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws = _ws || ({});

28
dist/xlsx.min.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/xlsx.min.map generated vendored

File diff suppressed because one or more lines are too long

14
dist/xlsx.mini.min.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/xlsx.mini.min.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.16.6",
"version": "0.16.7",
"author": "sheetjs",
"description": "SheetJS Spreadsheet data parser and writer",
"keywords": [

27
test.js
View File

@ -1224,6 +1224,23 @@ describe('parse features', function() {
});
}); }); });
describe('workbook codename unicode', function() {
var ws, wb;
var bef = (function() {
wb = X.utils.book_new();
ws = X.utils.aoa_to_sheet([[1]]);
X.utils.book_append_sheet(wb, ws, "Sheet1");
wb.Workbook = { WBProps: { CodeName: "本工作簿" } };
});
if(typeof before != 'undefined') before(bef);
else it('before', bef);
['xlsx', 'xlsb'].forEach(function(m) { it(m, function() {
var bstr = X.write(wb, {type: "binary", bookType: m});
var nwb = X.read(bstr, {type: "binary"});
assert.equal(nwb.Workbook.WBProps.CodeName, wb.Workbook.WBProps.CodeName);
}); });
});
describe('auto filter', function() {[
['xlsx', paths.afxlsx],
['xlsb', paths.afxlsb],
@ -1255,7 +1272,8 @@ describe('parse features', function() {
assert.equal(get_cell(wb2.Sheets.Sheet1, "A2").h, "&amp;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "B2").h, "&lt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "C2").h, "&gt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "<br/>");
var h = get_cell(wb2.Sheets.Sheet1, "D2").h;
assert(h == "&#x000a;" || h == "<br/>");
}); });
});
@ -2184,7 +2202,12 @@ describe('HTML', function() {
var expected_rows = [];
expected_rows[0] = expected_rows[2] = {hidden: true};
assert.equal(ws['!ref'], "A1:A3");
assert.deepEqual(ws['!rows'], expected_rows);
try {
assert.deepEqual(ws['!rows'], expected_rows);
} catch(e) {
expected_rows[1] = {};
assert.deepEqual(ws['!rows'], expected_rows);
}
assert.equal(get_cell(ws, "A1").v, "Foo");
assert.equal(get_cell(ws, "A2").v, "Bar");
assert.equal(get_cell(ws, "A3").v, "Baz");

27
tests/core.js generated
View File

@ -1224,6 +1224,23 @@ describe('parse features', function() {
});
}); }); });
describe('workbook codename unicode', function() {
var ws, wb;
var bef = (function() {
wb = X.utils.book_new();
ws = X.utils.aoa_to_sheet([[1]]);
X.utils.book_append_sheet(wb, ws, "Sheet1");
wb.Workbook = { WBProps: { CodeName: "本工作簿" } };
});
if(typeof before != 'undefined') before(bef);
else it('before', bef);
['xlsx', 'xlsb'].forEach(function(m) { it(m, function() {
var bstr = X.write(wb, {type: "binary", bookType: m});
var nwb = X.read(bstr, {type: "binary"});
assert.equal(nwb.Workbook.WBProps.CodeName, wb.Workbook.WBProps.CodeName);
}); });
});
describe('auto filter', function() {[
['xlsx', paths.afxlsx],
['xlsb', paths.afxlsb],
@ -1255,7 +1272,8 @@ describe('parse features', function() {
assert.equal(get_cell(wb2.Sheets.Sheet1, "A2").h, "&amp;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "B2").h, "&lt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "C2").h, "&gt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "<br/>");
var h = get_cell(wb2.Sheets.Sheet1, "D2").h;
assert(h == "&#x000a;" || h == "<br/>");
}); });
});
@ -2184,7 +2202,12 @@ describe('HTML', function() {
var expected_rows = [];
expected_rows[0] = expected_rows[2] = {hidden: true};
assert.equal(ws['!ref'], "A1:A3");
assert.deepEqual(ws['!rows'], expected_rows);
try {
assert.deepEqual(ws['!rows'], expected_rows);
} catch(e) {
expected_rows[1] = {};
assert.deepEqual(ws['!rows'], expected_rows);
}
assert.equal(get_cell(ws, "A1").v, "Foo");
assert.equal(get_cell(ws, "A2").v, "Bar");
assert.equal(get_cell(ws, "A3").v, "Baz");

View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
/*:: declare var cptable:any; */
/*global cptable:true, window */
@ -2940,6 +2940,7 @@ function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length
function fuzzynum(s/*:string*/)/*:number*/ {
var v/*:number*/ = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -4198,43 +4199,43 @@ function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatO
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -4297,9 +4298,9 @@ var SpecialProperties = {
/*::[*/0x72627262/*::]*/: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n");
@ -4382,7 +4383,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -4492,7 +4493,8 @@ var BErr = {
/*::[*/0x2B/*::]*/: "#GETTING_DATA",
/*::[*/0xFF/*::]*/: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -4803,6 +4805,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
}/*:any*/);
@ -13543,7 +13547,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ {
}
function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string*/ {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -13579,7 +13583,7 @@ function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -15302,7 +15306,17 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -16335,6 +16349,8 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
@ -16354,8 +16370,6 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
@ -20381,7 +20395,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
var write_ws = function(ws, wb/*:Workbook*/, i/*:number*//*::, opts*/)/*:string*/ {
/* Section 9 Tables */
var o/*:Array<string>*/ = [];
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
var R=0,C=0, range = decode_range(ws['!ref']);
var marr/*:Array<Range>*/ = ws['!merges'] || [], mi = 0;
var dense = Array.isArray(ws);
@ -20453,6 +20467,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
var write_automatic_styles_ods = function(o/*:Array<string>*/) {
o.push(' <office:automatic-styles>\n');
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
o.push(' <number:month number:style="long"/>\n');
o.push(' <number:text>/</number:text>\n');
@ -20461,11 +20476,16 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
o.push(' <number:year/>\n');
o.push(' </number:date-style>\n');
/* table */
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
o.push(' </style:style>\n');
/* table cells, text */
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
/* page-layout */
o.push(' </office:automatic-styles>\n');
};
@ -20609,7 +20629,8 @@ function fix_opts_func(defaults/*:Array<Array<any> >*/)/*:{(o:any):void}*/ {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -20628,8 +20649,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -21461,7 +21482,6 @@ function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array<string>*/ {
}
function sheet_add_json(_ws/*:?Worksheet*/, js/*:Array<any>*/, opts)/*:Worksheet*/ {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws/*:Worksheet*/ = _ws || ({}/*:any*/);

76
xlsx.js generated
View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -2860,6 +2860,7 @@ function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -4105,43 +4106,43 @@ function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatO
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -4204,9 +4205,9 @@ var SpecialProperties = {
0x72627262: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE = evert_key(DocSummaryPIDDSI, "n");
@ -4289,7 +4290,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr) { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr) { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -4399,7 +4400,8 @@ var BErr = {
0x2B: "#GETTING_DATA",
0xFF: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -4710,6 +4712,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
});
@ -13441,7 +13445,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb) {
}
function write_ws_xml_cell(cell, ref, ws, opts) {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -13477,7 +13481,7 @@ function write_ws_xml_cell(cell, ref, ws, opts) {
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -15197,7 +15201,17 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -16226,6 +16240,8 @@ Workbook.WBProps.date1904 = true;
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
@ -16245,8 +16261,6 @@ Workbook.WBProps.date1904 = true;
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
case 'activerow' /*case 'ActiveRow'*/: break;
case 'activecol' /*case 'ActiveCol'*/: break;
case 'activepane' /*case 'ActivePane'*/: break;
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
@ -20263,7 +20277,7 @@ var write_content_ods = (function() {
var write_ws = function(ws, wb, i) {
/* Section 9 Tables */
var o = [];
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
var R=0,C=0, range = decode_range(ws['!ref']);
var marr = ws['!merges'] || [], mi = 0;
var dense = Array.isArray(ws);
@ -20335,6 +20349,7 @@ var write_content_ods = (function() {
var write_automatic_styles_ods = function(o) {
o.push(' <office:automatic-styles>\n');
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
o.push(' <number:month number:style="long"/>\n');
o.push(' <number:text>/</number:text>\n');
@ -20343,11 +20358,16 @@ var write_content_ods = (function() {
o.push(' <number:year/>\n');
o.push(' </number:date-style>\n');
/* table */
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
o.push(' </style:style>\n');
/* table cells, text */
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
/* page-layout */
o.push(' </office:automatic-styles>\n');
};
@ -20490,7 +20510,8 @@ function fix_opts_func(defaults) {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -20509,8 +20530,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -21330,7 +21351,6 @@ function sheet_to_formulae(sheet) {
}
function sheet_add_json(_ws, js, opts) {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws = _ws || ({});

View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
@ -2918,6 +2918,7 @@ function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length
function fuzzynum(s/*:string*/)/*:number*/ {
var v/*:number*/ = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -3829,43 +3830,43 @@ function aoa_to_sheet(data/*:AOA*/, opts/*:?any*/)/*:Worksheet*/ { return sheet_
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -3928,9 +3929,9 @@ var SpecialProperties = {
/*::[*/0x72627262/*::]*/: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n");
@ -4013,7 +4014,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -4123,7 +4124,8 @@ var BErr = {
/*::[*/0x2B/*::]*/: "#GETTING_DATA",
/*::[*/0xFF/*::]*/: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -4434,6 +4436,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
}/*:any*/);
@ -7464,7 +7468,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ {
}
function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string*/ {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -7500,7 +7504,7 @@ function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -8329,7 +8333,17 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -8712,7 +8726,8 @@ function fix_opts_func(defaults/*:Array<Array<any> >*/)/*:{(o:any):void}*/ {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -8731,8 +8746,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -9564,7 +9579,6 @@ function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array<string>*/ {
}
function sheet_add_json(_ws/*:?Worksheet*/, js/*:Array<any>*/, opts)/*:Worksheet*/ {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws/*:Worksheet*/ = _ws || ({}/*:any*/);

View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.16.6';
XLSX.version = '0.16.7';
var current_codepage = 1200, current_ansi = 1252;
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
@ -2839,6 +2839,7 @@ function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
if(!/\d/.test(s)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
@ -3739,43 +3740,43 @@ function aoa_to_sheet(data, opts) { return sheet_add_aoa(null, data, opts); }
/* [MS-OLEPS] 2.2 PropertyType */
//var VT_EMPTY = 0x0000;
//var VT_NULL = 0x0001;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
var VT_I2 = 0x0002;
var VT_I4 = 0x0003;
//var VT_R4 = 0x0004;
//var VT_R8 = 0x0005;
//var VT_CY = 0x0006;
//var VT_DATE = 0x0007;
//var VT_BSTR = 0x0008;
//var VT_ERROR = 0x000A;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
var VT_BOOL = 0x000B;
var VT_VARIANT = 0x000C;
//var VT_DECIMAL = 0x000E;
//var VT_I1 = 0x0010;
//var VT_UI1 = 0x0011;
//var VT_UI2 = 0x0012;
var VT_UI4 = 0x0013;
var VT_UI4 = 0x0013;
//var VT_I8 = 0x0014;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
var VT_BLOB = 0x0041;
//var VT_STREAM = 0x0042;
//var VT_STORAGE = 0x0043;
//var VT_STREAMED_Object = 0x0044;
//var VT_STORED_Object = 0x0045;
//var VT_BLOB_Object = 0x0046;
var VT_CF = 0x0047;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
var VT_VECTOR = 0x1000;
//var VT_ARRAY = 0x2000;
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
var VT_CUSTOM = [VT_STRING, VT_USTR];
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
var DocSummaryPIDDSI = {
@ -3838,9 +3839,9 @@ var SpecialProperties = {
0x72627262: {}
};
(function () {
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
(function() {
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
})();
var DocSummaryRE = evert_key(DocSummaryPIDDSI, "n");
@ -3923,7 +3924,7 @@ var XLSFillPattern = [
'gray0625'
];
function rgbify(arr) { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
function rgbify(arr) { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
/* [MS-XLS] 2.5.161 */
/* [MS-XLSB] 2.5.75 Icv */
@ -4033,7 +4034,8 @@ var BErr = {
0x2B: "#GETTING_DATA",
0xFF: "#WTF?"
};
var RBErr = evert_num(BErr);/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
var RBErr = evert_num(BErr);
/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */
/* 12.3 Part Summary <SpreadsheetML> */
/* 14.2 Part Summary <DrawingML> */
/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */
@ -4344,6 +4346,8 @@ var RELS = ({
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
});
@ -7373,7 +7377,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb) {
}
function write_ws_xml_cell(cell, ref, ws, opts) {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -7409,7 +7413,7 @@ function write_ws_xml_cell(cell, ref, ws, opts) {
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}
@ -8236,7 +8240,17 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
var i = 0;
/* bookViews */
/* bookViews only written if first worksheet is hidden */
if(sheets && sheets[0] && !!sheets[0].Hidden) {
o[o.length] = "<bookViews>";
for(i = 0; i != wb.SheetNames.length; ++i) {
if(!sheets[i]) break;
if(!sheets[i].Hidden) break;
}
if(i == wb.SheetNames.length) i = 0;
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
o[o.length] = "</bookViews>";
}
o[o.length] = "<sheets>";
for(i = 0; i != wb.SheetNames.length; ++i) {
@ -8619,7 +8633,8 @@ function fix_opts_func(defaults) {
};
}
var fix_read_opts = fix_opts_func([
var fix_read_opts = function(opts) {
fix_opts_func([
['cellNF', false], /* emit cell number format string as .z */
['cellHTML', true], /* emit html string as .h */
['cellFormula', true], /* emit formulae as .f */
@ -8638,8 +8653,8 @@ var fix_read_opts = fix_opts_func([
['password',''], /* password */
['WTF', false] /* WTF mode (throws errors) */
]);
])(opts);
};
var fix_write_opts = fix_opts_func([
['cellDates', false], /* write date cells with type `d` */
@ -9459,7 +9474,6 @@ function sheet_to_formulae(sheet) {
}
function sheet_add_json(_ws, js, opts) {
if(!js.length) return _ws;
var o = opts || {};
var offset = +!o.skipHeader;
var ws = _ws || ({});