version bump 0.18.8: dateless meridien time values
This commit is contained in:
parent
b7d3eae3b7
commit
2022f7f4b0
|
@ -8,6 +8,7 @@ index.html
|
|||
misc/
|
||||
node_modules
|
||||
*.tgz
|
||||
*.jsx
|
||||
_book
|
||||
book.json
|
||||
tmp
|
||||
|
|
|
@ -4,6 +4,11 @@ This log is intended to keep track of backwards-incompatible changes, including
|
|||
but not limited to API changes and file location changes. Minor behavioral
|
||||
changes may not be included if they are not expected to break existing code.
|
||||
|
||||
## v0.18.8
|
||||
|
||||
* Plaintext parsing of dateless meridien time values (`1:23:45 PM`)
|
||||
* Legacy format (SYLK / WK# / Multiplan) minutiae
|
||||
|
||||
## v0.18.7
|
||||
|
||||
* Normalized handling of `\r` and `\n` newline characters
|
||||
|
|
7
Makefile
7
Makefile
|
@ -9,7 +9,7 @@ HTMLLINT=index.html
|
|||
|
||||
MINITGT=xlsx.mini.js
|
||||
MINIFLOW=xlsx.mini.flow.js
|
||||
MINIDEPS=$(shell cat mini.lst)
|
||||
MINIDEPS=$(shell cat misc/mini.lst)
|
||||
|
||||
ESMJSTGT=xlsx.mjs
|
||||
ESMJSDEPS=$(shell cat misc/mjs.lst)
|
||||
|
@ -70,7 +70,6 @@ init: ## Initial setup for development
|
|||
git submodule init
|
||||
git submodule update
|
||||
#git submodule foreach git pull origin master
|
||||
#git submodule foreach make
|
||||
git submodule foreach make all
|
||||
mkdir -p tmp
|
||||
|
||||
|
@ -116,6 +115,10 @@ bytes: ## Display minified and gzipped file sizes
|
|||
@for i in $(BYTEFILER); do npx printj "%-30s %7d" $$i $$(wc -c < $$i); done
|
||||
|
||||
|
||||
.PHONY: git
|
||||
git: ## show version string
|
||||
@echo "$$(node -pe 'require("./package.json").version')"
|
||||
|
||||
.PHONY: nexe
|
||||
nexe: xlsx.exe ## Build nexe standalone executable
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
|
|
|
@ -1 +1 @@
|
|||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
|
|
|
@ -2,10 +2,6 @@ var current_codepage = 1200, current_ansi = 1252;
|
|||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
if(typeof cptable !== 'undefined') $cptable = cptable;
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
$cptable = require('./dist/cpexcel.js');
|
||||
}
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -61,7 +57,9 @@ var debom = function(data/*:string*/)/*:string*/ {
|
|||
|
||||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
if(typeof $cptable !== 'undefined') {
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data/*:string*/) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
|
@ -74,4 +72,5 @@ if(typeof $cptable !== 'undefined') {
|
|||
_getansi = function _ga2(x/*:number*/)/*:string*/ {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ function parse_extra_field(blob/*:CFBlob*/)/*:any*/ {
|
|||
return o;
|
||||
}
|
||||
var fs/*:: = require('fs'); */;
|
||||
function get_fs() { return fs || (fs = require('fs')); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
|
|
@ -156,16 +156,34 @@ function fuzzynum(s/*:string*/)/*:number*/ {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) /*:Date*/ {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s/*:string*/)/*:Date*/ {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
if(typeof cptable !== 'undefined') set_cptable(cptable);
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
set_cptable(require('./dist/cpexcel.js'));
|
||||
}
|
|
@ -258,8 +258,8 @@ var _XLSIcv = /*#__PURE__*/ rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
|
134
bits/30_ctype.js
134
bits/30_ctype.js
|
@ -177,45 +177,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
}/*:any*/);
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct()/*:any*/ {
|
||||
|
@ -236,7 +236,7 @@ function parse_ct(data/*:?string*/) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -251,35 +251,37 @@ function parse_ct(data/*:?string*/) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts)/*:string*/ {
|
||||
function write_ct(ct, opts, raw)/*:string*/ {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o/*:Array<string>*/ = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -324,6 +326,6 @@ function write_ct(ct, opts)/*:string*/ {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ function parse_PropertySet(blob, PIDSI) {
|
|||
blob.l = start_addr + size; /* step ahead to skip padding */
|
||||
return PropH;
|
||||
}
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; //.concat(PseudoPropsPairs);
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ];
|
||||
function guess_property_type(val/*:any*/)/*:number*/ {
|
||||
switch(typeof val) {
|
||||
case "boolean": return 0x0B;
|
||||
|
|
|
@ -428,9 +428,9 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
|
@ -509,7 +509,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
|
@ -529,6 +529,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
|
|
@ -1,20 +1,27 @@
|
|||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId/*:number*/, comments) {
|
||||
function write_vml(rId/*:number*/, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid)/*:string*/ {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/;
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -22,9 +29,8 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"}/*:any*/);
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -47,7 +53,5 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ {
|
|||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
|
@ -223,7 +223,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
|||
if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
||||
else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/;
|
||||
/*:: val = (val:any); */
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
||||
switch(RecordType) {
|
||||
case 0x0022 /* Date1904 */:
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
|
|
|
@ -238,7 +238,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
|||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
if(b8) ws['!links'] = [];
|
||||
|
@ -323,11 +323,11 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
|
|||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
|
@ -387,7 +387,7 @@ function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
|
|||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -134,7 +133,6 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -227,7 +225,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
|
|
@ -365,7 +365,7 @@ function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dy
|
|||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(ws["!ref"]);
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,5 +124,5 @@ var __stream = {
|
|||
to_json: write_json_stream,
|
||||
to_html: write_html_stream,
|
||||
to_csv: write_csv_stream,
|
||||
set_readable: set_readable
|
||||
set_readable: set_readable
|
||||
};
|
||||
|
|
|
@ -16,4 +16,5 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = require('stream');
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = require('fs'); } catch(e) {}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -157,17 +157,13 @@ var DO_NOT_EXPORT_CODEPAGE = true;
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
if(typeof cptable !== 'undefined') $cptable = cptable;
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
$cptable = undefined;
|
||||
}
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -223,7 +219,9 @@ var debom = function(data) {
|
|||
|
||||
var _getchar = function _gc1(x) { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x) { return String.fromCharCode(x); };
|
||||
if(typeof $cptable !== 'undefined') {
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
|
@ -236,6 +234,7 @@ if(typeof $cptable !== 'undefined') {
|
|||
_getansi = function _ga2(x) {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
|
@ -1645,7 +1644,7 @@ function parse_extra_field(blob) {
|
|||
return o;
|
||||
}
|
||||
var fs;
|
||||
function get_fs() { return fs || (fs = undefined); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file, options) {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -3271,7 +3270,7 @@ return exports;
|
|||
})();
|
||||
|
||||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = undefined; } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3494,16 +3493,34 @@ function fuzzynum(s) {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s) {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4268,6 +4285,10 @@ function encode_range_xls(r, opts) {
|
|||
}
|
||||
return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff);
|
||||
}
|
||||
if(typeof cptable !== 'undefined') set_cptable(cptable);
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
set_cptable(undefined);
|
||||
}
|
||||
function decode_row(rowstr) { return parseInt(unfix_row(rowstr),10) - 1; }
|
||||
function encode_row(row) { return "" + (row + 1); }
|
||||
function fix_row(cstr) { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); }
|
||||
|
@ -5003,8 +5024,8 @@ var _XLSIcv = rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -5228,45 +5249,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
});
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct() {
|
||||
|
@ -5287,7 +5308,7 @@ function parse_ct(data) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -5302,35 +5323,37 @@ function parse_ct(data) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts) {
|
||||
function write_ct(ct, opts, raw) {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -5375,7 +5398,7 @@ function write_ct(ct, opts) {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -5410,10 +5433,10 @@ var RELS = ({
|
|||
XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
||||
TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",
|
||||
PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person",
|
||||
CONN: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections",
|
||||
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
|
||||
});
|
||||
|
||||
|
||||
/* 9.3.3 Representing Relationships */
|
||||
function get_rels_path(file) {
|
||||
var n = file.lastIndexOf("/");
|
||||
|
@ -6130,7 +6153,7 @@ function parse_PropertySet(blob, PIDSI) {
|
|||
blob.l = start_addr + size; /* step ahead to skip padding */
|
||||
return PropH;
|
||||
}
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; //.concat(PseudoPropsPairs);
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ];
|
||||
function guess_property_type(val) {
|
||||
switch(typeof val) {
|
||||
case "boolean": return 0x0B;
|
||||
|
@ -8008,7 +8031,7 @@ var SYLK = (function() {
|
|||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d, opts) {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
|
@ -8024,6 +8047,7 @@ var SYLK = (function() {
|
|||
var next_cell_format = null;
|
||||
var sht = {}, rowinfo = [], colinfo = [], cw = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
|
@ -8034,19 +8058,34 @@ var SYLK = (function() {
|
|||
case 'ID': break; /* header */
|
||||
case 'E': break; /* EOF */
|
||||
case 'B': break; /* dimensions */
|
||||
case 'O': break; /* options? */
|
||||
case 'W': break; /* window? */
|
||||
case 'O': /* workbook options */
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'V': {
|
||||
var d1904 = parseInt(record[rj].slice(1), 10);
|
||||
// NOTE: it is technically an error if d1904 >= 5 or < 0
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; C_seen_X = true; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; C_seen_X = true; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; if(!C_seen_X) C = 0;
|
||||
R = parseInt(record[rj].slice(1), 10)-1; if(!C_seen_X) C = 0;
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'K':
|
||||
|
@ -8056,7 +8095,7 @@ var SYLK = (function() {
|
|||
else if(val === 'FALSE') val = false;
|
||||
else if(!isNaN(fuzzynum(val))) {
|
||||
val = fuzzynum(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(wb.Workbook.WBProps.date1904 ? val + 1462 : val);
|
||||
} else if(!isNaN(fuzzydate(val).getDate())) {
|
||||
val = parseDate(val);
|
||||
}
|
||||
|
@ -8073,8 +8112,8 @@ var SYLK = (function() {
|
|||
arr[R][C] = [arr[R][C], "S5S"];
|
||||
break;
|
||||
case 'G': break; // unknown
|
||||
case 'R': _R = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'R': _R = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
|
||||
}
|
||||
if(C_seen_K) {
|
||||
|
@ -8089,19 +8128,19 @@ var SYLK = (function() {
|
|||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; ++F_seen; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; /*C = 0;*/
|
||||
R = parseInt(record[rj].slice(1), 10)-1; /*C = 0;*/
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1)) / 20; break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1), 10) / 20; break;
|
||||
case 'F': break; /* ??? */
|
||||
case 'G': break; /* hide grid */
|
||||
case 'P':
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1))];
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1), 10)];
|
||||
break;
|
||||
case 'S': break; /* cell style */
|
||||
case 'D': break; /* column */
|
||||
|
@ -8110,14 +8149,14 @@ var SYLK = (function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1))-1;
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!colinfo[C]) colinfo[C] = {};
|
||||
break;
|
||||
case 'R': /* row properties */
|
||||
R = parseInt(record[rj].slice(1))-1;
|
||||
R = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!rowinfo[R]) rowinfo[R] = {};
|
||||
if(Mval > 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); }
|
||||
else if(Mval === 0) rowinfo[R].hidden = true;
|
||||
|
@ -8130,20 +8169,21 @@ var SYLK = (function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht];
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
||||
function sylk_to_sheet(d, opts) {
|
||||
function sylk_to_workbook(d, opts) {
|
||||
var aoasht = sylk_to_aoa(d, opts);
|
||||
var aoa = aoasht[0], ws = aoasht[1];
|
||||
var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2];
|
||||
var o = aoa_to_sheet(aoa, opts);
|
||||
keys(ws).forEach(function(k) { o[k] = ws[k]; });
|
||||
return o;
|
||||
var outwb = sheet_to_workbook(o, opts);
|
||||
keys(wb).forEach(function(k) { outwb[k] = wb[k]; });
|
||||
return outwb;
|
||||
}
|
||||
|
||||
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) {
|
||||
var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K";
|
||||
switch(cell.t) {
|
||||
|
@ -8182,7 +8222,7 @@ var SYLK = (function() {
|
|||
}
|
||||
|
||||
function sheet_to_sylk(ws, opts) {
|
||||
var preamble = ["ID;PWXL;N;E"], o = [];
|
||||
var preamble = ["ID;PSheetJS;N;E"], o = [];
|
||||
var r = safe_decode_range(ws['!ref']), cell;
|
||||
var dense = Array.isArray(ws);
|
||||
var RS = "\r\n";
|
||||
|
@ -8206,7 +8246,6 @@ var SYLK = (function() {
|
|||
|
||||
return {
|
||||
to_workbook: sylk_to_workbook,
|
||||
to_sheet: sylk_to_sheet,
|
||||
from_sheet: sheet_to_sylk
|
||||
};
|
||||
})();
|
||||
|
@ -9048,16 +9087,88 @@ var WK_ = (function() {
|
|||
]; */
|
||||
/* TODO: flesh out */
|
||||
var FuncTab = {
|
||||
0x1F: ["NA", 0],
|
||||
// 0x20: ["ERR", 0],
|
||||
0x21: ["ABS", 1],
|
||||
0x22: ["TRUNC", 1],
|
||||
0x23: ["SQRT", 1],
|
||||
0x24: ["LOG", 1],
|
||||
0x25: ["LN", 1],
|
||||
0x26: ["PI", 0],
|
||||
0x27: ["SIN", 1],
|
||||
0x28: ["COS", 1],
|
||||
0x29: ["TAN", 1],
|
||||
0x2A: ["ATAN2", 2],
|
||||
0x2B: ["ATAN", 1],
|
||||
0x2C: ["ASIN", 1],
|
||||
0x2D: ["ACOS", 1],
|
||||
0x2E: ["EXP", 1],
|
||||
0x2F: ["MOD", 2],
|
||||
// 0x30
|
||||
0x31: ["ISNA", 1],
|
||||
0x32: ["ISERR", 1],
|
||||
0x33: ["FALSE", 0],
|
||||
0x34: ["TRUE", 0],
|
||||
0x35: ["RAND", 0],
|
||||
// 0x36 DATE
|
||||
// 0x37 NOW
|
||||
// 0x38 PMT
|
||||
// 0x39 PV
|
||||
// 0x3A FV
|
||||
// 0x3B IF
|
||||
// 0x3C DAY
|
||||
// 0x3D MONTH
|
||||
// 0x3E YEAR
|
||||
0x3F: ["ROUND", 2],
|
||||
// 0x40 TIME
|
||||
// 0x41 HOUR
|
||||
// 0x42 MINUTE
|
||||
// 0x43 SECOND
|
||||
0x44: ["ISNUMBER", 1],
|
||||
0x45: ["ISTEXT", 1],
|
||||
0x46: ["LEN", 1],
|
||||
0x47: ["VALUE", 1],
|
||||
// 0x48: ["FIXED", ?? 1],
|
||||
0x49: ["MID", 3],
|
||||
0x4A: ["CHAR", 1],
|
||||
// 0x4B
|
||||
// 0x4C FIND
|
||||
// 0x4D DATEVALUE
|
||||
// 0x4E TIMEVALUE
|
||||
// 0x4F CELL
|
||||
0x50: ["SUM", 69],
|
||||
0x51: ["AVERAGEA", 69],
|
||||
0x52: ["COUNTA", 69],
|
||||
0x53: ["MINA", 69],
|
||||
0x54: ["MAXA", 69],
|
||||
// 0x55 VLOOKUP
|
||||
// 0x56 NPV
|
||||
// 0x57 VAR
|
||||
// 0x58 STD
|
||||
// 0x59 IRR
|
||||
// 0x5A HLOOKUP
|
||||
// 0x5B DSUM
|
||||
// 0x5C DAVERAGE
|
||||
// 0x5D DCOUNTA
|
||||
// 0x5E DMIN
|
||||
// 0x5F DMAX
|
||||
// 0x60 DVARP
|
||||
// 0x61 DSTDEVP
|
||||
// 0x62 INDEX
|
||||
// 0x63 COLS
|
||||
// 0x64 ROWS
|
||||
// 0x65 REPEAT
|
||||
0x66: ["UPPER", 1],
|
||||
0x67: ["LOWER", 1],
|
||||
// 0x68 LEFT
|
||||
// 0x69 RIGHT
|
||||
// 0x6A REPLACE
|
||||
0x6B: ["PROPER", 1],
|
||||
// 0x6C CELL
|
||||
0x6D: ["TRIM", 1],
|
||||
// 0x6E CLEAN
|
||||
0x6F: ["T", 1]
|
||||
// 0x70 V
|
||||
};
|
||||
var BinOpTab = [
|
||||
"", "", "", "", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs
|
||||
|
@ -9507,7 +9618,7 @@ var WK_ = (function() {
|
|||
break;
|
||||
case 0x02: /* EOF */ break outer;
|
||||
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TSTable */
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */
|
||||
case 0x0401: /* BON */ break;
|
||||
case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break;
|
||||
|
||||
|
@ -9540,7 +9651,7 @@ var WK_ = (function() {
|
|||
type = p.read_shift(1);
|
||||
sname = cnt == 0 ? "" : p.read_shift(cnt, 'cstr');
|
||||
}
|
||||
if(!sname) sname = XLSX.utils.encode_col(sidx);
|
||||
if(!sname) sname = encode_col(sidx);
|
||||
/* TODO: backfill empty sheets */
|
||||
} break;
|
||||
case 0x0602: { /* EOS */
|
||||
|
@ -11943,22 +12054,29 @@ function parse_drawing(data, rels) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId, comments) {
|
||||
function write_vml(rId, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid) {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = {'color2':"#BEFF82", 'type':"gradient"};
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -11966,9 +12084,8 @@ function write_comments_vml(rId, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"});
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -11991,9 +12108,7 @@ function write_comments_vml(rId, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments, threaded, people) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -18702,7 +18817,7 @@ function slurp(RecordType, R, blob, length, opts) {
|
|||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
|
@ -18884,7 +18999,7 @@ function parse_workbook(blob, options) {
|
|||
var val = ({});
|
||||
if(RecordType === 0x000a /* EOF */) val = R.f(blob, length, opts);
|
||||
else val = slurp(RecordType, R, blob, length, opts);
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
||||
switch(RecordType) {
|
||||
case 0x0022 /* Date1904 */:
|
||||
wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
|
@ -20704,6 +20819,16 @@ var XLSRecordEnum = {
|
|||
0x08cb: { /* n:"CrtCoopt", */ },
|
||||
0x08d6: { /* n:"FRTArchId$", */ r:12 },
|
||||
|
||||
/* --- multiplan 4 records --- */
|
||||
0x0065: { /* n:"", */ }, // one per window
|
||||
0x0066: { /* n:"", */ }, // calc settings
|
||||
0x0069: { /* n:"", */ }, // print header
|
||||
0x006a: { /* n:"", */ }, // print footer
|
||||
0x006b: { /* n:"", */ }, // print settings
|
||||
0x006d: { /* n:"", */ }, // one per window
|
||||
0x0070: { /* n:"", */ }, // includes default col width
|
||||
0x0072: { /* n:"", */ }, // includes selected cell
|
||||
|
||||
0x7262: {}
|
||||
};
|
||||
|
||||
|
@ -20946,7 +21071,7 @@ function write_ws_biff8(idx, opts, wb) {
|
|||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
if(b8) ws['!links'] = [];
|
||||
|
@ -21031,11 +21156,11 @@ function write_biff8_global(wb, bufs, opts) {
|
|||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
|
@ -21095,7 +21220,7 @@ function write_biff_buf(wb, opts) {
|
|||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21295,7 +21420,7 @@ function sheet_add_dom(ws, table, _opts) {
|
|||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
|
@ -21335,8 +21460,7 @@ function get_get_computed_style_function(element) {
|
|||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text) {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
|
@ -23722,7 +23846,6 @@ if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std7
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23800,7 +23923,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -23856,7 +23979,6 @@ f = "docProps/app.xml";
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23948,7 +24070,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -24119,6 +24241,11 @@ function readSync(data, opts) {
|
|||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
@ -24686,6 +24813,12 @@ function sheet_set_array_formula(ws, range, formula, dynamic) {
|
|||
if(dynamic) cell.D = true;
|
||||
}
|
||||
}
|
||||
var wsr = decode_range(ws["!ref"]);
|
||||
if(wsr.s.r > rng.s.r) wsr.s.r = rng.s.r;
|
||||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -24855,7 +24988,7 @@ var __stream = {
|
|||
to_json: write_json_stream,
|
||||
to_html: write_html_stream,
|
||||
to_csv: write_csv_stream,
|
||||
set_readable: set_readable
|
||||
set_readable: set_readable
|
||||
};
|
||||
if(typeof parse_xlscfb !== "undefined") XLSX.parse_xlscfb = parse_xlscfb;
|
||||
XLSX.parse_zip = parse_zip;
|
||||
|
@ -24875,6 +25008,7 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = undefined;
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = undefined; } catch(e) {}
|
||||
}
|
||||
}
|
||||
/*global define */
|
||||
|
|
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
|
@ -1,75 +0,0 @@
|
|||
var current_codepage = 1200, current_ansi = 1252;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
var CS2CP = ({
|
||||
/*::[*/0/*::]*/: 1252, /* ANSI */
|
||||
/*::[*/1/*::]*/: 65001, /* DEFAULT */
|
||||
/*::[*/2/*::]*/: 65001, /* SYMBOL */
|
||||
/*::[*/77/*::]*/: 10000, /* MAC */
|
||||
/*::[*/128/*::]*/: 932, /* SHIFTJIS */
|
||||
/*::[*/129/*::]*/: 949, /* HANGUL */
|
||||
/*::[*/130/*::]*/: 1361, /* JOHAB */
|
||||
/*::[*/134/*::]*/: 936, /* GB2312 */
|
||||
/*::[*/136/*::]*/: 950, /* CHINESEBIG5 */
|
||||
/*::[*/161/*::]*/: 1253, /* GREEK */
|
||||
/*::[*/162/*::]*/: 1254, /* TURKISH */
|
||||
/*::[*/163/*::]*/: 1258, /* VIETNAMESE */
|
||||
/*::[*/177/*::]*/: 1255, /* HEBREW */
|
||||
/*::[*/178/*::]*/: 1256, /* ARABIC */
|
||||
/*::[*/186/*::]*/: 1257, /* BALTIC */
|
||||
/*::[*/204/*::]*/: 1251, /* RUSSIAN */
|
||||
/*::[*/222/*::]*/: 874, /* THAI */
|
||||
/*::[*/238/*::]*/: 1250, /* EASTEUROPE */
|
||||
/*::[*/255/*::]*/: 1252, /* OEM */
|
||||
/*::[*/69/*::]*/: 6969 /* MISC */
|
||||
}/*:any*/);
|
||||
|
||||
var set_ansi = function(cp/*:number*/) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS2CP[0] = cp; };
|
||||
function reset_ansi() { set_ansi(1252); }
|
||||
|
||||
var set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
function reset_cp() { set_cp(1200); reset_ansi(); }
|
||||
|
||||
function char_codes(data/*:string*/)/*:Array<number>*/ { var o/*:Array<number>*/ = []; for(var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i); return o; }
|
||||
|
||||
function utf16leread(data/*:string*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8));
|
||||
return o.join("");
|
||||
}
|
||||
function utf16beread(data/*:string*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8));
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
var debom = function(data/*:string*/)/*:string*/ {
|
||||
var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1);
|
||||
if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2));
|
||||
if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2));
|
||||
if(c1 == 0xFEFF) return data.slice(1);
|
||||
return data;
|
||||
};
|
||||
|
||||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
|
||||
var $cptable;
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data/*:string*/) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
return data;
|
||||
};
|
||||
_getchar = function _gc2(x/*:number*/)/*:string*/ {
|
||||
if(current_codepage === 1200) return String.fromCharCode(x);
|
||||
return $cptable.utils.decode(current_codepage, [x&255,x>>8])[0];
|
||||
};
|
||||
_getansi = function _ga2(x/*:number*/)/*:string*/ {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
export { set_cptable };
|
|
@ -1,56 +0,0 @@
|
|||
var current_codepage = 1200, current_ansi = 1252;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
var CS2CP = ({
|
||||
/*::[*/0/*::]*/: 1252, /* ANSI */
|
||||
/*::[*/1/*::]*/: 65001, /* DEFAULT */
|
||||
/*::[*/2/*::]*/: 65001, /* SYMBOL */
|
||||
/*::[*/77/*::]*/: 10000, /* MAC */
|
||||
/*::[*/128/*::]*/: 932, /* SHIFTJIS */
|
||||
/*::[*/129/*::]*/: 949, /* HANGUL */
|
||||
/*::[*/130/*::]*/: 1361, /* JOHAB */
|
||||
/*::[*/134/*::]*/: 936, /* GB2312 */
|
||||
/*::[*/136/*::]*/: 950, /* CHINESEBIG5 */
|
||||
/*::[*/161/*::]*/: 1253, /* GREEK */
|
||||
/*::[*/162/*::]*/: 1254, /* TURKISH */
|
||||
/*::[*/163/*::]*/: 1258, /* VIETNAMESE */
|
||||
/*::[*/177/*::]*/: 1255, /* HEBREW */
|
||||
/*::[*/178/*::]*/: 1256, /* ARABIC */
|
||||
/*::[*/186/*::]*/: 1257, /* BALTIC */
|
||||
/*::[*/204/*::]*/: 1251, /* RUSSIAN */
|
||||
/*::[*/222/*::]*/: 874, /* THAI */
|
||||
/*::[*/238/*::]*/: 1250, /* EASTEUROPE */
|
||||
/*::[*/255/*::]*/: 1252, /* OEM */
|
||||
/*::[*/69/*::]*/: 6969 /* MISC */
|
||||
}/*:any*/);
|
||||
|
||||
var set_ansi = function(cp/*:number*/) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS2CP[0] = cp; };
|
||||
function reset_ansi() { set_ansi(1252); }
|
||||
|
||||
var set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
function reset_cp() { set_cp(1200); reset_ansi(); }
|
||||
|
||||
function char_codes(data/*:string*/)/*:Array<number>*/ { var o/*:Array<number>*/ = []; for(var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i); return o; }
|
||||
|
||||
function utf16leread(data/*:string*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8));
|
||||
return o.join("");
|
||||
}
|
||||
function utf16beread(data/*:string*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8));
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
var debom = function(data/*:string*/)/*:string*/ {
|
||||
var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1);
|
||||
if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2));
|
||||
if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2));
|
||||
if(c1 == 0xFEFF) return data.slice(1);
|
||||
return data;
|
||||
};
|
||||
|
||||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
1843
misc/18_esmcfb.js
1843
misc/18_esmcfb.js
File diff suppressed because it is too large
Load Diff
|
@ -1,73 +0,0 @@
|
|||
let _fs = void 0;
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
export { set_fs };
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
if(typeof data === "string") return s2ab(data);
|
||||
if(Array.isArray(data)) return a2u(data);
|
||||
return data;
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
if(typeof Deno !== 'undefined') {
|
||||
/* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */
|
||||
if(enc && typeof payload == "string") switch(enc) {
|
||||
case "utf8": payload = new TextEncoder(enc).encode(payload); break;
|
||||
case "binary": payload = s2ab(payload); break;
|
||||
/* TODO: binary equivalent */
|
||||
default: throw new Error("Unsupported encoding " + enc);
|
||||
}
|
||||
return Deno.writeFileSync(fname, payload);
|
||||
}
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
/*:: declare var IE_SaveFile: any; */
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
if(typeof Blob !== 'undefined') {
|
||||
var blob = new Blob([blobify(data)], {type:"application/octet-stream"});
|
||||
/*:: declare var navigator: any; */
|
||||
if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname);
|
||||
/*:: declare var saveAs: any; */
|
||||
if(typeof saveAs !== 'undefined') return saveAs(blob, fname);
|
||||
if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
/*:: declare var chrome: any; */
|
||||
if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") {
|
||||
if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000);
|
||||
return chrome.downloads.download({ url: url, filename: fname, saveAs: true});
|
||||
}
|
||||
var a = document.createElement("a");
|
||||
if(a.download != null) {
|
||||
/*:: if(document.body == null) throw new Error("unreachable"); */
|
||||
a.download = fname; a.href = url; document.body.appendChild(a); a.click();
|
||||
/*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a);
|
||||
if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
// $FlowIgnore
|
||||
if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript
|
||||
// $FlowIgnore
|
||||
var out = File(fname); out.open("w"); out.encoding = "binary";
|
||||
if(Array.isArray(payload)) payload = a2s(payload);
|
||||
out.write(payload); out.close(); return payload;
|
||||
} catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; }
|
||||
throw new Error("cannot save file " + fname);
|
||||
}
|
||||
|
||||
/* read binary data from file */
|
||||
function read_binary(path/*:string*/) {
|
||||
if(typeof _fs !== 'undefined') return _fs.readFileSync(path);
|
||||
if(typeof Deno !== 'undefined') return Deno.readFileSync(path);
|
||||
// $FlowIgnore
|
||||
if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript
|
||||
// $FlowIgnore
|
||||
var infile = File(path); infile.open("r"); infile.encoding = "binary";
|
||||
var data = infile.read(); infile.close();
|
||||
return data;
|
||||
} catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; }
|
||||
throw new Error("Cannot access file " + path);
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
function parse_xlmeta_xml(data, name, opts) {
|
||||
var out = { Types: [], Cell: [], Value: [] };
|
||||
if (!data)
|
||||
return out;
|
||||
var pass = false;
|
||||
var metatype = 2;
|
||||
var lastmeta;
|
||||
data.replace(tagregex, function(x) {
|
||||
var y = parsexmltag(x);
|
||||
switch (strip_ns(y[0])) {
|
||||
case "<?xml":
|
||||
break;
|
||||
case "<metadata":
|
||||
case "</metadata>":
|
||||
break;
|
||||
case "<metadataTypes":
|
||||
case "</metadataTypes>":
|
||||
break;
|
||||
case "<metadataType":
|
||||
out.Types.push({ name: y.name });
|
||||
break;
|
||||
case "</metadataType>":
|
||||
break;
|
||||
case "<futureMetadata":
|
||||
for (var j = 0; j < out.Types.length; ++j)
|
||||
if (out.Types[j].name == y.name)
|
||||
lastmeta = out.Types[j];
|
||||
break;
|
||||
case "</futureMetadata>":
|
||||
break;
|
||||
case "<bk>":
|
||||
break;
|
||||
case "</bk>":
|
||||
break;
|
||||
case "<rc":
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
break;
|
||||
case "</rc>":
|
||||
break;
|
||||
case "<cellMetadata":
|
||||
metatype = 1;
|
||||
break;
|
||||
case "</cellMetadata>":
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<valueMetadata":
|
||||
metatype = 0;
|
||||
break;
|
||||
case "</valueMetadata>":
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<extLst":
|
||||
case "<extLst>":
|
||||
case "</extLst>":
|
||||
case "<extLst/>":
|
||||
break;
|
||||
case "<ext":
|
||||
pass = true;
|
||||
break;
|
||||
case "</ext>":
|
||||
pass = false;
|
||||
break;
|
||||
case "<rvb":
|
||||
if (!lastmeta)
|
||||
break;
|
||||
if (!lastmeta.offsets)
|
||||
lastmeta.offsets = [];
|
||||
lastmeta.offsets.push(+y.i);
|
||||
break;
|
||||
default:
|
||||
if (!pass && opts.WTF)
|
||||
throw new Error("unrecognized " + y[0] + " in metadata");
|
||||
}
|
||||
return x;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_xlmeta_xml() {
|
||||
var o = [XML_HEADER];
|
||||
o.push('<metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" xmlns:xda="http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray">\n <metadataTypes count="1">\n <metadataType name="XLDAPR" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1" cellMeta="1"/>\n </metadataTypes>\n <futureMetadata name="XLDAPR" count="1">\n <bk>\n <extLst>\n <ext uri="{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}">\n <xda:dynamicArrayProperties fDynamic="1" fCollapsed="0"/>\n </ext>\n </extLst>\n </bk>\n </futureMetadata>\n <cellMetadata count="1">\n <bk>\n <rc t="1" v="0"/>\n </bk>\n </cellMetadata>\n</metadata>');
|
||||
return o.join("");
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
|
||||
|
||||
/* 18.3 Worksheets also covers Chartsheets */
|
||||
function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ {
|
||||
if(!data) return data;
|
||||
|
@ -18,13 +16,13 @@ function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, them
|
|||
if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
|
||||
return s;
|
||||
}
|
||||
function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
//function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
// var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
// 'xmlns': XMLNS_main[0],
|
||||
// 'xmlns:r': XMLNS.r
|
||||
// })];
|
||||
// o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
// if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
// return o.join("");
|
||||
//}
|
||||
|
|
|
@ -12,6 +12,8 @@ export {
|
|||
writeSyncXLSX as writeXLSX,
|
||||
writeFileSyncXLSX as writeFileXLSX,
|
||||
utils,
|
||||
set_fs,
|
||||
set_cptable,
|
||||
__stream as stream,
|
||||
SSF,
|
||||
CFB
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
bits/00_header.js
|
||||
bits/01_version.js
|
||||
misc/02_cpmini.js
|
||||
bits/02_codepage.js
|
||||
bits/03_consts.js
|
||||
bits/04_base64.js
|
||||
bits/05_buf.js
|
||||
|
@ -28,7 +28,7 @@ bits/42_sstxml.js
|
|||
bits/46_stycommon.js
|
||||
bits/47_styxml.js
|
||||
bits/49_theme.js
|
||||
misc/51_xlsxmeta.js
|
||||
bits/51_xlsxmeta.js
|
||||
bits/53_externlink.js
|
||||
bits/54_drawing.js
|
||||
bits/55_vml.js
|
|
@ -1,14 +1,14 @@
|
|||
misc/00_esmheader.js
|
||||
bits/01_version.js
|
||||
misc/02_codepage.js
|
||||
bits/02_codepage.js
|
||||
bits/03_consts.js
|
||||
bits/04_base64.js
|
||||
bits/05_buf.js
|
||||
bits/09_types.js
|
||||
bits/10_ssf.js
|
||||
bits/11_ssfutils.js
|
||||
misc/18_esmcfb.js
|
||||
misc/19_mjsfs.js
|
||||
bits/18_cfb.js
|
||||
bits/19_fsutils.js
|
||||
bits/20_jsutils.js
|
||||
bits/21_ziputils.js
|
||||
bits/22_xmlutils.js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.18.7",
|
||||
"version": "0.18.8",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
|
|
8
test.js
8
test.js
|
@ -202,10 +202,11 @@ var paths = {
|
|||
rhslk: dir + 'row_height.slk',
|
||||
|
||||
svxls: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility5.xls',
|
||||
svxml: dir + 'sheet_visibility.xml',
|
||||
svxlsx: dir + 'sheet_visibility.xlsx',
|
||||
svxlsb: dir + 'sheet_visibility.xlsb',
|
||||
svods: dir + 'sheet_visibility.ods',
|
||||
|
||||
swcxls: dir + 'apachepoi_SimpleWithComments.xls',
|
||||
swcxml: dir + '2011/apachepoi_SimpleWithComments.xls.xml',
|
||||
|
@ -1655,7 +1656,10 @@ describe('roundtrip features', function() {
|
|||
describe('should preserve sheet visibility', function() { [
|
||||
['xlml', paths.svxml],
|
||||
['xlsx', paths.svxlsx],
|
||||
['xlsb', paths.svxlsb]
|
||||
['xlsb', paths.svxlsb],
|
||||
['xls', paths.svxls],
|
||||
['biff5', paths.svxls5]
|
||||
// ['ods', paths.svods]
|
||||
].forEach(function(w) {
|
||||
it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {type:TYPE});
|
||||
|
|
|
@ -204,10 +204,11 @@ var paths = {
|
|||
rhslk: dir + 'row_height.slk',
|
||||
|
||||
svxls: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility5.xls',
|
||||
svxml: dir + 'sheet_visibility.xml',
|
||||
svxlsx: dir + 'sheet_visibility.xlsx',
|
||||
svxlsb: dir + 'sheet_visibility.xlsb',
|
||||
svods: dir + 'sheet_visibility.ods',
|
||||
|
||||
swcxls: dir + 'apachepoi_SimpleWithComments.xls',
|
||||
swcxml: dir + '2011/apachepoi_SimpleWithComments.xls.xml',
|
||||
|
@ -1642,7 +1643,10 @@ describe('roundtrip features', function() {
|
|||
describe('should preserve sheet visibility', function() { [
|
||||
['xlml', paths.svxml],
|
||||
['xlsx', paths.svxlsx],
|
||||
['xlsb', paths.svxlsb]
|
||||
['xlsb', paths.svxlsb],
|
||||
['xls', paths.svxls],
|
||||
['biff5', paths.svxls5]
|
||||
// ['ods', paths.svods]
|
||||
].forEach(function(w) {
|
||||
it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {type:TYPE});
|
||||
|
|
8
test.ts
8
test.ts
|
@ -224,10 +224,11 @@ var paths: any = {
|
|||
rhslk: dir + 'row_height.slk',
|
||||
|
||||
svxls: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility5.xls',
|
||||
svxml: dir + 'sheet_visibility.xml',
|
||||
svxlsx: dir + 'sheet_visibility.xlsx',
|
||||
svxlsb: dir + 'sheet_visibility.xlsb',
|
||||
svods: dir + 'sheet_visibility.ods',
|
||||
|
||||
swcxls: dir + 'apachepoi_SimpleWithComments.xls',
|
||||
swcxml: dir + '2011/apachepoi_SimpleWithComments.xls.xml',
|
||||
|
@ -1602,7 +1603,10 @@ Deno.test('roundtrip features', async function(t) {
|
|||
await t.step('should preserve sheet visibility', async function(t) { var sv = [
|
||||
['xlml', paths.svxml],
|
||||
['xlsx', paths.svxlsx],
|
||||
['xlsb', paths.svxlsb]
|
||||
['xlsb', paths.svxlsb],
|
||||
['xls', paths.svxls],
|
||||
['biff5', paths.svxls5]
|
||||
// ['ods', paths.svods]
|
||||
] as Array<[X.BookType, string]>; for(var s1 = 0; s1 < sv.length; ++s1) { var w = sv[s1];
|
||||
await t.step(w[0], async function(t) {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {type:TYPE});
|
||||
|
|
|
@ -202,10 +202,11 @@ var paths = {
|
|||
rhslk: dir + 'row_height.slk',
|
||||
|
||||
svxls: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility.xls',
|
||||
svxls5: dir + 'sheet_visibility5.xls',
|
||||
svxml: dir + 'sheet_visibility.xml',
|
||||
svxlsx: dir + 'sheet_visibility.xlsx',
|
||||
svxlsb: dir + 'sheet_visibility.xlsb',
|
||||
svods: dir + 'sheet_visibility.ods',
|
||||
|
||||
swcxls: dir + 'apachepoi_SimpleWithComments.xls',
|
||||
swcxml: dir + '2011/apachepoi_SimpleWithComments.xls.xml',
|
||||
|
@ -1655,7 +1656,10 @@ describe('roundtrip features', function() {
|
|||
describe('should preserve sheet visibility', function() { [
|
||||
['xlml', paths.svxml],
|
||||
['xlsx', paths.svxlsx],
|
||||
['xlsb', paths.svxlsb]
|
||||
['xlsb', paths.svxlsb],
|
||||
['xls', paths.svxls],
|
||||
['biff5', paths.svxls5]
|
||||
// ['ods', paths.svods]
|
||||
].forEach(function(w) {
|
||||
it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {type:TYPE});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -151,10 +151,11 @@
|
|||
./test_files/smart_tags_2007.xlsx
|
||||
./test_files/smart_tags_2007.xml
|
||||
./test_files/sheet_visibility.xls
|
||||
./test_files/sheet_visibility.xls
|
||||
./test_files/sheet_visibility5.xls
|
||||
./test_files/sheet_visibility.xml
|
||||
./test_files/sheet_visibility.xlsx
|
||||
./test_files/sheet_visibility.xlsb
|
||||
./test_files/sheet_visibility.ods
|
||||
./test_files/sushi.xls
|
||||
./test_files/sushi.xlsb
|
||||
./test_files/sushi.xlsx
|
||||
|
|
|
@ -205,7 +205,7 @@ filenames.forEach(function(r) {
|
|||
var ext = r[1] && r[1].bookType || r[0].split(".")[1];
|
||||
ext = {"htm":"html"}[ext] || ext;
|
||||
OUT.forEach(function(type) {
|
||||
if(type == "string" && ["xlsx", "xlsm", "xlsb", "xlam", "biff8", "biff5", "biff2", "xla", "ods", "dbf"].indexOf(ext) > -1) return;
|
||||
if(type == "string" && ["xlsx", "xlsm", "xlsb", "xlam", "xls", "biff8", "biff5", "biff2", "xla", "ods", "dbf"].indexOf(ext) > -1) return;
|
||||
if(type == "array" && ["xlsx", "xlsm", "xlsb", "xlam", "ods"].indexOf(ext) > -1 && typeof Uint8Array === 'undefined') return;
|
||||
var datout = XLSX.write(wb, {type: type, bookType: ext, sheet:r[1] && r[1].sheet || null});
|
||||
XLSX.read(datout, {type:type});
|
||||
|
|
|
@ -841,8 +841,8 @@ export interface XLSX$Utils {
|
|||
/** Creates a new workbook */
|
||||
book_new(): WorkBook;
|
||||
|
||||
/** Append a worksheet to a workbook */
|
||||
book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): void;
|
||||
/** Append a worksheet to a workbook, returns new worksheet name */
|
||||
book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): string;
|
||||
|
||||
/** Set sheet visibility (visible/hidden/very hidden) */
|
||||
book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
|
||||
|
|
247
xlsx.flow.js
247
xlsx.flow.js
|
@ -1,18 +1,14 @@
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
if(typeof cptable !== 'undefined') $cptable = cptable;
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
$cptable = require('./dist/cpexcel.js');
|
||||
}
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -68,7 +64,9 @@ var debom = function(data/*:string*/)/*:string*/ {
|
|||
|
||||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
if(typeof $cptable !== 'undefined') {
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data/*:string*/) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
|
@ -81,6 +79,7 @@ if(typeof $cptable !== 'undefined') {
|
|||
_getansi = function _ga2(x/*:number*/)/*:string*/ {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
|
@ -1551,7 +1550,7 @@ function parse_extra_field(blob/*:CFBlob*/)/*:any*/ {
|
|||
return o;
|
||||
}
|
||||
var fs/*:: = require('fs'); */;
|
||||
function get_fs() { return fs || (fs = require('fs')); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -3183,7 +3182,7 @@ return exports;
|
|||
})();
|
||||
|
||||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3412,16 +3411,34 @@ function fuzzynum(s/*:string*/)/*:number*/ {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) /*:Date*/ {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s/*:string*/)/*:Date*/ {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4192,6 +4209,10 @@ function encode_range_xls(r, opts)/*:string*/ {
|
|||
}
|
||||
return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff);
|
||||
}
|
||||
if(typeof cptable !== 'undefined') set_cptable(cptable);
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
set_cptable(require('./dist/cpexcel.js'));
|
||||
}
|
||||
function decode_row(rowstr/*:string*/)/*:number*/ { return parseInt(unfix_row(rowstr),10) - 1; }
|
||||
function encode_row(row/*:number*/)/*:string*/ { return "" + (row + 1); }
|
||||
function fix_row(cstr/*:string*/)/*:string*/ { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); }
|
||||
|
@ -4932,8 +4953,8 @@ var _XLSIcv = /*#__PURE__*/ rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -5157,45 +5178,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
}/*:any*/);
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct()/*:any*/ {
|
||||
|
@ -5216,7 +5237,7 @@ function parse_ct(data/*:?string*/) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -5231,35 +5252,37 @@ function parse_ct(data/*:?string*/) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts)/*:string*/ {
|
||||
function write_ct(ct, opts, raw)/*:string*/ {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o/*:Array<string>*/ = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -5304,7 +5327,7 @@ function write_ct(ct, opts)/*:string*/ {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -6062,7 +6085,7 @@ function parse_PropertySet(blob, PIDSI) {
|
|||
blob.l = start_addr + size; /* step ahead to skip padding */
|
||||
return PropH;
|
||||
}
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; //.concat(PseudoPropsPairs);
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ];
|
||||
function guess_property_type(val/*:any*/)/*:number*/ {
|
||||
switch(typeof val) {
|
||||
case "boolean": return 0x0B;
|
||||
|
@ -7979,9 +8002,9 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
|
@ -8060,7 +8083,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
|
@ -8080,6 +8103,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
@ -11967,22 +11991,29 @@ function parse_drawing(data, rels/*:any*/) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId/*:number*/, comments) {
|
||||
function write_vml(rId/*:number*/, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid)/*:string*/ {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/;
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -11990,9 +12021,8 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"}/*:any*/);
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -12015,9 +12045,7 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments/*:Array<RawComment>*/, threaded/*:boolean*/, people/*:?Array<any>*/) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -18739,7 +18767,7 @@ function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ {
|
|||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
|
@ -18922,7 +18950,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
|||
if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
||||
else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/;
|
||||
/*:: val = (val:any); */
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
||||
switch(RecordType) {
|
||||
case 0x0022 /* Date1904 */:
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
|
@ -20997,7 +21025,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
|||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
if(b8) ws['!links'] = [];
|
||||
|
@ -21082,11 +21110,11 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
|
|||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
|
@ -21146,7 +21174,7 @@ function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
|
|||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23774,7 +23802,6 @@ function parse_xlsxcfb(cfb, _opts/*:?ParseOpts*/)/*:Workbook*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23853,7 +23880,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -23909,7 +23936,6 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -24002,7 +24028,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -24757,7 +24783,7 @@ function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dy
|
|||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(ws["!ref"]);
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -24927,7 +24953,7 @@ var __stream = {
|
|||
to_json: write_json_stream,
|
||||
to_html: write_html_stream,
|
||||
to_csv: write_csv_stream,
|
||||
set_readable: set_readable
|
||||
set_readable: set_readable
|
||||
};
|
||||
if(typeof parse_xlscfb !== "undefined") XLSX.parse_xlscfb = parse_xlscfb;
|
||||
XLSX.parse_zip = parse_zip;
|
||||
|
@ -24947,6 +24973,7 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = require('stream');
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = require('fs'); } catch(e) {}
|
||||
}
|
||||
}
|
||||
/*global define */
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
if(typeof cptable !== 'undefined') $cptable = cptable;
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
$cptable = require('./dist/cpexcel.js');
|
||||
}
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -67,7 +63,9 @@ var debom = function(data) {
|
|||
|
||||
var _getchar = function _gc1(x) { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x) { return String.fromCharCode(x); };
|
||||
if(typeof $cptable !== 'undefined') {
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
|
@ -80,6 +78,7 @@ if(typeof $cptable !== 'undefined') {
|
|||
_getansi = function _ga2(x) {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
|
@ -1489,7 +1488,7 @@ function parse_extra_field(blob) {
|
|||
return o;
|
||||
}
|
||||
var fs;
|
||||
function get_fs() { return fs || (fs = require('fs')); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file, options) {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -3115,7 +3114,7 @@ return exports;
|
|||
})();
|
||||
|
||||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3338,16 +3337,34 @@ function fuzzynum(s) {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s) {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4112,6 +4129,10 @@ function encode_range_xls(r, opts) {
|
|||
}
|
||||
return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff);
|
||||
}
|
||||
if(typeof cptable !== 'undefined') set_cptable(cptable);
|
||||
else if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
set_cptable(require('./dist/cpexcel.js'));
|
||||
}
|
||||
function decode_row(rowstr) { return parseInt(unfix_row(rowstr),10) - 1; }
|
||||
function encode_row(row) { return "" + (row + 1); }
|
||||
function fix_row(cstr) { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); }
|
||||
|
@ -4847,8 +4868,8 @@ var _XLSIcv = rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -5072,45 +5093,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
});
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct() {
|
||||
|
@ -5131,7 +5152,7 @@ function parse_ct(data) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -5146,35 +5167,37 @@ function parse_ct(data) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts) {
|
||||
function write_ct(ct, opts, raw) {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -5219,7 +5242,7 @@ function write_ct(ct, opts) {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -5974,7 +5997,7 @@ function parse_PropertySet(blob, PIDSI) {
|
|||
blob.l = start_addr + size; /* step ahead to skip padding */
|
||||
return PropH;
|
||||
}
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; //.concat(PseudoPropsPairs);
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ];
|
||||
function guess_property_type(val) {
|
||||
switch(typeof val) {
|
||||
case "boolean": return 0x0B;
|
||||
|
@ -7889,9 +7912,9 @@ var SYLK = (function() {
|
|||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
|
@ -7970,7 +7993,7 @@ var SYLK = (function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
|
@ -7990,6 +8013,7 @@ var SYLK = (function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
@ -11874,22 +11898,29 @@ function parse_drawing(data, rels) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId, comments) {
|
||||
function write_vml(rId, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid) {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = {'color2':"#BEFF82", 'type':"gradient"};
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -11897,9 +11928,8 @@ function write_comments_vml(rId, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"});
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -11922,9 +11952,7 @@ function write_comments_vml(rId, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments, threaded, people) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -18633,7 +18661,7 @@ function slurp(RecordType, R, blob, length, opts) {
|
|||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
|
@ -18815,7 +18843,7 @@ function parse_workbook(blob, options) {
|
|||
var val = ({});
|
||||
if(RecordType === 0x000a /* EOF */) val = R.f(blob, length, opts);
|
||||
else val = slurp(RecordType, R, blob, length, opts);
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
||||
switch(RecordType) {
|
||||
case 0x0022 /* Date1904 */:
|
||||
wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
|
@ -20887,7 +20915,7 @@ function write_ws_biff8(idx, opts, wb) {
|
|||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
if(b8) ws['!links'] = [];
|
||||
|
@ -20972,11 +21000,11 @@ function write_biff8_global(wb, bufs, opts) {
|
|||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
|
@ -21036,7 +21064,7 @@ function write_biff_buf(wb, opts) {
|
|||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23662,7 +23690,6 @@ if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std7
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23740,7 +23767,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -23796,7 +23823,6 @@ f = "docProps/app.xml";
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23888,7 +23914,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -24636,7 +24662,7 @@ function sheet_set_array_formula(ws, range, formula, dynamic) {
|
|||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(ws["!ref"]);
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -24806,7 +24832,7 @@ var __stream = {
|
|||
to_json: write_json_stream,
|
||||
to_html: write_html_stream,
|
||||
to_csv: write_csv_stream,
|
||||
set_readable: set_readable
|
||||
set_readable: set_readable
|
||||
};
|
||||
if(typeof parse_xlscfb !== "undefined") XLSX.parse_xlscfb = parse_xlscfb;
|
||||
XLSX.parse_zip = parse_zip;
|
||||
|
@ -24826,6 +24852,7 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = require('stream');
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = require('fs'); } catch(e) {}
|
||||
}
|
||||
}
|
||||
/*global define */
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -61,6 +64,23 @@ var debom = function(data/*:string*/)/*:string*/ {
|
|||
|
||||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data/*:string*/) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
return data;
|
||||
};
|
||||
_getchar = function _gc2(x/*:number*/)/*:string*/ {
|
||||
if(current_codepage === 1200) return String.fromCharCode(x);
|
||||
return $cptable.utils.decode(current_codepage, [x&255,x>>8])[0];
|
||||
};
|
||||
_getansi = function _ga2(x/*:number*/)/*:string*/ {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
@ -1530,7 +1550,7 @@ function parse_extra_field(blob/*:CFBlob*/)/*:any*/ {
|
|||
return o;
|
||||
}
|
||||
var fs/*:: = require('fs'); */;
|
||||
function get_fs() { return fs || (fs = require('fs')); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -3162,7 +3182,7 @@ return exports;
|
|||
})();
|
||||
|
||||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3391,16 +3411,34 @@ function fuzzynum(s/*:string*/)/*:number*/ {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) /*:Date*/ {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s/*:string*/)/*:Date*/ {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4600,8 +4638,8 @@ var _XLSIcv = /*#__PURE__*/ rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -4825,45 +4863,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
}/*:any*/);
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct()/*:any*/ {
|
||||
|
@ -4884,7 +4922,7 @@ function parse_ct(data/*:?string*/) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -4899,35 +4937,37 @@ function parse_ct(data/*:?string*/) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts)/*:string*/ {
|
||||
function write_ct(ct, opts, raw)/*:string*/ {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o/*:Array<string>*/ = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -4972,7 +5012,7 @@ function write_ct(ct, opts)/*:string*/ {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -5007,10 +5047,10 @@ var RELS = ({
|
|||
XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
||||
TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",
|
||||
PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person",
|
||||
CONN: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections",
|
||||
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
|
||||
}/*:any*/);
|
||||
|
||||
|
||||
/* 9.3.3 Representing Relationships */
|
||||
function get_rels_path(file/*:string*/)/*:string*/ {
|
||||
var n = file.lastIndexOf("/");
|
||||
|
@ -5780,7 +5820,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
|
@ -5796,6 +5836,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
var next_cell_format/*:string|null*/ = null;
|
||||
var sht = {}, rowinfo/*:Array<RowInfo>*/ = [], colinfo/*:Array<ColInfo>*/ = [], cw/*:Array<string>*/ = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
|
@ -5806,19 +5847,34 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
case 'ID': break; /* header */
|
||||
case 'E': break; /* EOF */
|
||||
case 'B': break; /* dimensions */
|
||||
case 'O': break; /* options? */
|
||||
case 'W': break; /* window? */
|
||||
case 'O': /* workbook options */
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'V': {
|
||||
var d1904 = parseInt(record[rj].slice(1), 10);
|
||||
// NOTE: it is technically an error if d1904 >= 5 or < 0
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; C_seen_X = true; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; C_seen_X = true; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; if(!C_seen_X) C = 0;
|
||||
R = parseInt(record[rj].slice(1), 10)-1; if(!C_seen_X) C = 0;
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'K':
|
||||
|
@ -5828,7 +5884,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
else if(val === 'FALSE') val = false;
|
||||
else if(!isNaN(fuzzynum(val))) {
|
||||
val = fuzzynum(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(wb.Workbook.WBProps.date1904 ? val + 1462 : val);
|
||||
} else if(!isNaN(fuzzydate(val).getDate())) {
|
||||
val = parseDate(val);
|
||||
}
|
||||
|
@ -5845,8 +5901,8 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
arr[R][C] = [arr[R][C], "S5S"];
|
||||
break;
|
||||
case 'G': break; // unknown
|
||||
case 'R': _R = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'R': _R = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
|
||||
}
|
||||
if(C_seen_K) {
|
||||
|
@ -5861,19 +5917,19 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; ++F_seen; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; /*C = 0;*/
|
||||
R = parseInt(record[rj].slice(1), 10)-1; /*C = 0;*/
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1)) / 20; break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1), 10) / 20; break;
|
||||
case 'F': break; /* ??? */
|
||||
case 'G': break; /* hide grid */
|
||||
case 'P':
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1))];
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1), 10)];
|
||||
break;
|
||||
case 'S': break; /* cell style */
|
||||
case 'D': break; /* column */
|
||||
|
@ -5882,14 +5938,14 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1))-1;
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!colinfo[C]) colinfo[C] = {};
|
||||
break;
|
||||
case 'R': /* row properties */
|
||||
R = parseInt(record[rj].slice(1))-1;
|
||||
R = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!rowinfo[R]) rowinfo[R] = {};
|
||||
if(Mval > 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); }
|
||||
else if(Mval === 0) rowinfo[R].hidden = true;
|
||||
|
@ -5902,20 +5958,21 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht];
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
||||
function sylk_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ {
|
||||
function sylk_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ {
|
||||
var aoasht = sylk_to_aoa(d, opts);
|
||||
var aoa = aoasht[0], ws = aoasht[1];
|
||||
var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2];
|
||||
var o = aoa_to_sheet(aoa, opts);
|
||||
keys(ws).forEach(function(k) { o[k] = ws[k]; });
|
||||
return o;
|
||||
var outwb = sheet_to_workbook(o, opts);
|
||||
keys(wb).forEach(function(k) { outwb[k] = wb[k]; });
|
||||
return outwb;
|
||||
}
|
||||
|
||||
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";
|
||||
switch(cell.t) {
|
||||
|
@ -5954,7 +6011,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
}
|
||||
|
||||
function sheet_to_sylk(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ {
|
||||
var preamble/*:Array<string>*/ = ["ID;PWXL;N;E"], o/*:Array<string>*/ = [];
|
||||
var preamble/*:Array<string>*/ = ["ID;PSheetJS;N;E"], o/*:Array<string>*/ = [];
|
||||
var r = safe_decode_range(ws['!ref']), cell/*:Cell*/;
|
||||
var dense = Array.isArray(ws);
|
||||
var RS = "\r\n";
|
||||
|
@ -5978,7 +6035,6 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
|
||||
return {
|
||||
to_workbook: sylk_to_workbook,
|
||||
to_sheet: sylk_to_sheet,
|
||||
from_sheet: sheet_to_sylk
|
||||
};
|
||||
})();
|
||||
|
@ -7638,22 +7694,29 @@ function parse_drawing(data, rels/*:any*/) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId/*:number*/, comments) {
|
||||
function write_vml(rId/*:number*/, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid)/*:string*/ {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/;
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -7661,9 +7724,8 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"}/*:any*/);
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -7686,9 +7748,7 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments/*:Array<RawComment>*/, threaded/*:boolean*/, people/*:?Array<any>*/) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -8853,8 +8913,6 @@ function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet)
|
|||
if(C > 0) cs["!ref"] = encode_range(refguess);
|
||||
return cs;
|
||||
}
|
||||
RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
|
||||
|
||||
/* 18.3 Worksheets also covers Chartsheets */
|
||||
function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ {
|
||||
if(!data) return data;
|
||||
|
@ -8873,16 +8931,16 @@ function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, them
|
|||
if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
|
||||
return s;
|
||||
}
|
||||
function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
//function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
// var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
// 'xmlns': XMLNS_main[0],
|
||||
// 'xmlns:r': XMLNS.r
|
||||
// })];
|
||||
// o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
// if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
// return o.join("");
|
||||
//}
|
||||
/* 18.2.28 (CT_WorkbookProtection) Defaults */
|
||||
var WBPropsDef = [
|
||||
['allowRefreshQuery', false, "bool"],
|
||||
|
@ -9517,7 +9575,7 @@ function sheet_add_dom(ws/*:Worksheet*/, table/*:HTMLElement*/, _opts/*:?any*/)/
|
|||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
|
@ -9557,8 +9615,7 @@ function get_get_computed_style_function(element/*:HTMLElement*/)/*:?function*/
|
|||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text/*:string*//*::, tag*/)/*:Array<any>*/ {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
|
@ -10760,7 +10817,6 @@ function parse_xlsxcfb(cfb, _opts/*:?ParseOpts*/)/*:Workbook*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -10839,7 +10895,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -10895,7 +10951,6 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -10988,7 +11043,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -11159,6 +11214,11 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
|||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
@ -11733,6 +11793,12 @@ function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dy
|
|||
if(dynamic) cell.D = true;
|
||||
}
|
||||
}
|
||||
var wsr = decode_range(ws["!ref"]);
|
||||
if(wsr.s.r > rng.s.r) wsr.s.r = rng.s.r;
|
||||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -11794,6 +11860,7 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = require('stream');
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = require('fs'); } catch(e) {}
|
||||
}
|
||||
}
|
||||
/*global define */
|
||||
|
|
338
xlsx.mini.js
338
xlsx.mini.js
|
@ -1,11 +1,13 @@
|
|||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -61,6 +63,23 @@ var debom = function(data) {
|
|||
|
||||
var _getchar = function _gc1(x) { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x) { return String.fromCharCode(x); };
|
||||
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp) { current_codepage = cp; set_ansi(cp); };
|
||||
debom = function(data) {
|
||||
if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); }
|
||||
return data;
|
||||
};
|
||||
_getchar = function _gc2(x) {
|
||||
if(current_codepage === 1200) return String.fromCharCode(x);
|
||||
return $cptable.utils.decode(current_codepage, [x&255,x>>8])[0];
|
||||
};
|
||||
_getansi = function _ga2(x) {
|
||||
return $cptable.utils.decode(current_ansi, [x])[0];
|
||||
};
|
||||
cpdoit();
|
||||
}
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
@ -1469,7 +1488,7 @@ function parse_extra_field(blob) {
|
|||
return o;
|
||||
}
|
||||
var fs;
|
||||
function get_fs() { return fs || (fs = require('fs')); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file, options) {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -3095,7 +3114,7 @@ return exports;
|
|||
})();
|
||||
|
||||
var _fs;
|
||||
if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {}
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3318,16 +3337,34 @@ function fuzzynum(s) {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s) {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4516,8 +4553,8 @@ var _XLSIcv = rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -4741,45 +4778,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
});
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct() {
|
||||
|
@ -4800,7 +4837,7 @@ function parse_ct(data) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -4815,35 +4852,37 @@ function parse_ct(data) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts) {
|
||||
function write_ct(ct, opts, raw) {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -4888,7 +4927,7 @@ function write_ct(ct, opts) {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -4923,10 +4962,10 @@ var RELS = ({
|
|||
XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
||||
TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",
|
||||
PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person",
|
||||
CONN: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections",
|
||||
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
|
||||
});
|
||||
|
||||
|
||||
/* 9.3.3 Representing Relationships */
|
||||
function get_rels_path(file) {
|
||||
var n = file.lastIndexOf("/");
|
||||
|
@ -5695,7 +5734,7 @@ var SYLK = (function() {
|
|||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d, opts) {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
|
@ -5711,6 +5750,7 @@ var SYLK = (function() {
|
|||
var next_cell_format = null;
|
||||
var sht = {}, rowinfo = [], colinfo = [], cw = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
|
@ -5721,19 +5761,34 @@ var SYLK = (function() {
|
|||
case 'ID': break; /* header */
|
||||
case 'E': break; /* EOF */
|
||||
case 'B': break; /* dimensions */
|
||||
case 'O': break; /* options? */
|
||||
case 'W': break; /* window? */
|
||||
case 'O': /* workbook options */
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'V': {
|
||||
var d1904 = parseInt(record[rj].slice(1), 10);
|
||||
// NOTE: it is technically an error if d1904 >= 5 or < 0
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; C_seen_X = true; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; C_seen_X = true; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; if(!C_seen_X) C = 0;
|
||||
R = parseInt(record[rj].slice(1), 10)-1; if(!C_seen_X) C = 0;
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'K':
|
||||
|
@ -5743,7 +5798,7 @@ var SYLK = (function() {
|
|||
else if(val === 'FALSE') val = false;
|
||||
else if(!isNaN(fuzzynum(val))) {
|
||||
val = fuzzynum(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(val);
|
||||
if(next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(wb.Workbook.WBProps.date1904 ? val + 1462 : val);
|
||||
} else if(!isNaN(fuzzydate(val).getDate())) {
|
||||
val = parseDate(val);
|
||||
}
|
||||
|
@ -5760,8 +5815,8 @@ var SYLK = (function() {
|
|||
arr[R][C] = [arr[R][C], "S5S"];
|
||||
break;
|
||||
case 'G': break; // unknown
|
||||
case 'R': _R = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1))-1; break;
|
||||
case 'R': _R = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
case 'C': _C = parseInt(record[rj].slice(1), 10)-1; break;
|
||||
default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
|
||||
}
|
||||
if(C_seen_K) {
|
||||
|
@ -5776,19 +5831,19 @@ var SYLK = (function() {
|
|||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1))-1; ++F_seen; break;
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
case 'Y':
|
||||
R = parseInt(record[rj].slice(1))-1; /*C = 0;*/
|
||||
R = parseInt(record[rj].slice(1), 10)-1; /*C = 0;*/
|
||||
for(j = arr.length; j <= R; ++j) arr[j] = [];
|
||||
break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1)) / 20; break;
|
||||
case 'M': Mval = parseInt(record[rj].slice(1), 10) / 20; break;
|
||||
case 'F': break; /* ??? */
|
||||
case 'G': break; /* hide grid */
|
||||
case 'P':
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1))];
|
||||
next_cell_format = formats[parseInt(record[rj].slice(1), 10)];
|
||||
break;
|
||||
case 'S': break; /* cell style */
|
||||
case 'D': break; /* column */
|
||||
|
@ -5797,14 +5852,14 @@ var SYLK = (function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1))-1;
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!colinfo[C]) colinfo[C] = {};
|
||||
break;
|
||||
case 'R': /* row properties */
|
||||
R = parseInt(record[rj].slice(1))-1;
|
||||
R = parseInt(record[rj].slice(1), 10)-1;
|
||||
if(!rowinfo[R]) rowinfo[R] = {};
|
||||
if(Mval > 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); }
|
||||
else if(Mval === 0) rowinfo[R].hidden = true;
|
||||
|
@ -5817,20 +5872,21 @@ var SYLK = (function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht];
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
||||
function sylk_to_sheet(d, opts) {
|
||||
function sylk_to_workbook(d, opts) {
|
||||
var aoasht = sylk_to_aoa(d, opts);
|
||||
var aoa = aoasht[0], ws = aoasht[1];
|
||||
var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2];
|
||||
var o = aoa_to_sheet(aoa, opts);
|
||||
keys(ws).forEach(function(k) { o[k] = ws[k]; });
|
||||
return o;
|
||||
var outwb = sheet_to_workbook(o, opts);
|
||||
keys(wb).forEach(function(k) { outwb[k] = wb[k]; });
|
||||
return outwb;
|
||||
}
|
||||
|
||||
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) {
|
||||
var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K";
|
||||
switch(cell.t) {
|
||||
|
@ -5869,7 +5925,7 @@ var SYLK = (function() {
|
|||
}
|
||||
|
||||
function sheet_to_sylk(ws, opts) {
|
||||
var preamble = ["ID;PWXL;N;E"], o = [];
|
||||
var preamble = ["ID;PSheetJS;N;E"], o = [];
|
||||
var r = safe_decode_range(ws['!ref']), cell;
|
||||
var dense = Array.isArray(ws);
|
||||
var RS = "\r\n";
|
||||
|
@ -5893,7 +5949,6 @@ var SYLK = (function() {
|
|||
|
||||
return {
|
||||
to_workbook: sylk_to_workbook,
|
||||
to_sheet: sylk_to_sheet,
|
||||
from_sheet: sheet_to_sylk
|
||||
};
|
||||
})();
|
||||
|
@ -7553,22 +7608,29 @@ function parse_drawing(data, rels) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId, comments) {
|
||||
function write_vml(rId, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid) {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = {'color2':"#BEFF82", 'type':"gradient"};
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -7576,9 +7638,8 @@ function write_comments_vml(rId, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"});
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -7601,9 +7662,7 @@ function write_comments_vml(rId, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments, threaded, people) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -8768,8 +8827,6 @@ function parse_chart(data, name, opts, rels, wb, csheet) {
|
|||
if(C > 0) cs["!ref"] = encode_range(refguess);
|
||||
return cs;
|
||||
}
|
||||
RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
|
||||
|
||||
/* 18.3 Worksheets also covers Chartsheets */
|
||||
function parse_cs_xml(data, opts, idx, rels, wb) {
|
||||
if(!data) return data;
|
||||
|
@ -8788,16 +8845,16 @@ function parse_cs_xml(data, opts, idx, rels, wb) {
|
|||
if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
|
||||
return s;
|
||||
}
|
||||
function write_cs_xml(idx, opts, wb, rels) {
|
||||
var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
'xmlns': XMLNS_main[0],
|
||||
'xmlns:r': XMLNS.r
|
||||
})];
|
||||
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
//function write_cs_xml(idx, opts, wb, rels) {
|
||||
// var o = [XML_HEADER, writextag('chartsheet', null, {
|
||||
// 'xmlns': XMLNS_main[0],
|
||||
// 'xmlns:r': XMLNS.r
|
||||
// })];
|
||||
// o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
|
||||
// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
|
||||
// if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
// return o.join("");
|
||||
//}
|
||||
/* 18.2.28 (CT_WorkbookProtection) Defaults */
|
||||
var WBPropsDef = [
|
||||
['allowRefreshQuery', false, "bool"],
|
||||
|
@ -9430,7 +9487,7 @@ function sheet_add_dom(ws, table, _opts) {
|
|||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
|
@ -9470,8 +9527,7 @@ function get_get_computed_style_function(element) {
|
|||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text) {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
|
@ -10671,7 +10727,6 @@ if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std7
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -10749,7 +10804,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -10805,7 +10860,6 @@ f = "docProps/app.xml";
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb, opts) {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -10897,7 +10951,7 @@ f = "docProps/app.xml";
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -11068,6 +11122,11 @@ function readSync(data, opts) {
|
|||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
@ -11635,6 +11694,12 @@ function sheet_set_array_formula(ws, range, formula, dynamic) {
|
|||
if(dynamic) cell.D = true;
|
||||
}
|
||||
}
|
||||
var wsr = decode_range(ws["!ref"]);
|
||||
if(wsr.s.r > rng.s.r) wsr.s.r = rng.s.r;
|
||||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -11696,6 +11761,7 @@ if(typeof CFB !== "undefined") XLSX.CFB = CFB;
|
|||
if(typeof require !== "undefined") {
|
||||
var strmod = require('stream');
|
||||
if((strmod||{}).Readable) set_readable(strmod.Readable);
|
||||
try { _fs = require('fs'); } catch(e) {}
|
||||
}
|
||||
}
|
||||
/*global define */
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
/*exported XLSX */
|
||||
/*global process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
XLSX.version = '0.18.7';
|
||||
XLSX.version = '0.18.8';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
var $cptable;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ];
|
||||
/* ECMA-376 Part I 18.4.1 charset to codepage mapping */
|
||||
|
@ -61,7 +64,6 @@ var debom = function(data/*:string*/)/*:string*/ {
|
|||
var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); };
|
||||
|
||||
var $cptable;
|
||||
function set_cptable(cptable) {
|
||||
$cptable = cptable;
|
||||
set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); };
|
||||
|
@ -78,7 +80,6 @@ function set_cptable(cptable) {
|
|||
};
|
||||
cpdoit();
|
||||
}
|
||||
export { set_cptable };
|
||||
var DENSE = null;
|
||||
var DIF_XL = true;
|
||||
var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
@ -1460,8 +1461,8 @@ return CRC32;
|
|||
})();
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = /*#__PURE__*/(function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.2.1';
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.2.2';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
|
@ -1548,7 +1549,7 @@ function parse_extra_field(blob/*:CFBlob*/)/*:any*/ {
|
|||
return o;
|
||||
}
|
||||
var fs/*:: = require('fs'); */;
|
||||
function get_fs() { return fs || (fs = {}); }
|
||||
function get_fs() { return fs || (fs = _fs); }
|
||||
function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ {
|
||||
if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
|
||||
if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
|
||||
|
@ -1761,7 +1762,7 @@ function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/,
|
|||
if((q = __readInt32LE(sector,i*4)) === ENDOFCHAIN) break;
|
||||
fat_addrs.push(q);
|
||||
}
|
||||
sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs);
|
||||
if(cnt >= 1) sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1937,7 +1938,9 @@ function rebuild_cfb(cfb/*:CFBContainer*/, f/*:?boolean*/)/*:void*/ {
|
|||
for(i = 0; i < data.length; ++i) {
|
||||
var dad = dirname(data[i][0]);
|
||||
s = fullPaths[dad];
|
||||
if(!s) {
|
||||
while(!s) {
|
||||
while(dirname(dad) && !fullPaths[dirname(dad)]) dad = dirname(dad);
|
||||
|
||||
data.push([dad, ({
|
||||
name: filename(dad).replace("/",""),
|
||||
type: 1,
|
||||
|
@ -1945,8 +1948,12 @@ function rebuild_cfb(cfb/*:CFBContainer*/, f/*:?boolean*/)/*:void*/ {
|
|||
ct: now, mt: now,
|
||||
content: null
|
||||
}/*:any*/)]);
|
||||
|
||||
// Add name to set
|
||||
fullPaths[dad] = true;
|
||||
|
||||
dad = dirname(data[i][0]);
|
||||
s = fullPaths[dad];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1994,7 +2001,6 @@ function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes|strin
|
|||
for(var i = 0; i < cfb.FileIndex.length; ++i) {
|
||||
var file = cfb.FileIndex[i];
|
||||
if(!file.content) continue;
|
||||
/*:: if(file.content == null) throw new Error("unreachable"); */
|
||||
var flen = file.content.length;
|
||||
if(flen > 0){
|
||||
if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6;
|
||||
|
@ -2085,6 +2091,10 @@ function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes|strin
|
|||
file = cfb.FileIndex[i];
|
||||
if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN;
|
||||
var _nm/*:string*/ = (i === 0 && _opts.root) || file.name;
|
||||
if(_nm.length > 32) {
|
||||
console.error("Name " + _nm + " will be truncated to " + _nm.slice(0,32));
|
||||
_nm = _nm.slice(0, 32);
|
||||
}
|
||||
flen = 2*(_nm.length+1);
|
||||
o.write_shift(64, _nm, "utf16le");
|
||||
o.write_shift(2, flen);
|
||||
|
@ -2723,6 +2733,7 @@ function parse_zip(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/
|
|||
parse_local_file(blob, csz, usz, o, EF);
|
||||
blob.l = L;
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -3169,9 +3180,8 @@ exports.utils = {
|
|||
return exports;
|
||||
})();
|
||||
|
||||
let _fs = void 0;
|
||||
var _fs;
|
||||
function set_fs(fs) { _fs = fs; }
|
||||
export { set_fs };
|
||||
|
||||
/* normalize data for blob ctor */
|
||||
function blobify(data) {
|
||||
|
@ -3400,16 +3410,34 @@ function fuzzynum(s/*:string*/)/*:number*/ {
|
|||
if(!isNaN(v = Number(ss))) return v / wt;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* NOTE: Chrome rejects bare times like 1:23 PM */
|
||||
var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;
|
||||
|
||||
function fuzzytime1(M) /*:Date*/ {
|
||||
/* TODO: 1904 adjustment */
|
||||
if(!M[2]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
|
||||
if(M[3]) {
|
||||
if(M[4]) return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000);
|
||||
else return new Date(1900,0,0,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000);
|
||||
}
|
||||
else if(M[5]) return new Date(1900, 0, 0, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0);
|
||||
else return new Date(1900,0,0,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0);
|
||||
}
|
||||
var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
function fuzzydate(s/*:string*/)/*:Date*/ {
|
||||
var lower = s.toLowerCase();
|
||||
var lnos = lower.replace(/\s+/g, "");
|
||||
var M = lnos.match(FDRE1);
|
||||
if(M) return fuzzytime1(M);
|
||||
|
||||
var o = new Date(s), n = new Date(NaN);
|
||||
var y = o.getYear(), m = o.getMonth(), d = o.getDate();
|
||||
if(isNaN(d)) return n;
|
||||
var lower = s.toLowerCase();
|
||||
if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
|
||||
lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");
|
||||
if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
|
||||
} else if(lower.match(/[a-z]/)) return n;
|
||||
} else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
|
||||
if(y < 0 || y > 8099) return n;
|
||||
if((m > 0 || d > 1) && y != 101) return o;
|
||||
if(s.match(/[^-0-9:,\/\\]/)) return n;
|
||||
|
@ -4920,8 +4948,8 @@ var _XLSIcv = /*#__PURE__*/ rgbify([
|
|||
0x333333,
|
||||
|
||||
/* Other entries to appease BIFF8/12 */
|
||||
0xFFFFFF, /* 0x40 icvForeground ?? */
|
||||
0x000000, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x40 icvForeground ?? */
|
||||
0xFFFFFF, /* 0x41 icvBackground ?? */
|
||||
0x000000, /* 0x42 icvFrame ?? */
|
||||
0x000000, /* 0x43 icv3D ?? */
|
||||
0x000000, /* 0x44 icv3DText ?? */
|
||||
|
@ -5145,45 +5173,45 @@ var ct2type/*{[string]:string}*/ = ({
|
|||
}/*:any*/);
|
||||
|
||||
var CT_LIST = {
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
workbooks: {
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
||||
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main",
|
||||
xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
||||
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
||||
},
|
||||
strs: { /* Shared Strings */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
||||
xlsb: "application/vnd.ms-excel.sharedStrings"
|
||||
},
|
||||
comments: { /* Comments */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
xlsb: "application/vnd.ms-excel.comments"
|
||||
},
|
||||
sheets: { /* Worksheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.worksheet"
|
||||
},
|
||||
charts: { /* Chartsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.chartsheet"
|
||||
},
|
||||
dialogs: { /* Dialogsheet */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.dialogsheet"
|
||||
},
|
||||
macros: { /* Macrosheet (Excel 4.0 Macros) */
|
||||
xlsx: "application/vnd.ms-excel.macrosheet+xml",
|
||||
xlsb: "application/vnd.ms-excel.macrosheet"
|
||||
},
|
||||
metadata: { /* Metadata (Stock/Geography and Dynamic Array) */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
||||
xlsb: "application/vnd.ms-excel.sheetMetadata"
|
||||
},
|
||||
styles: { /* Styles */
|
||||
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
||||
xlsb: "application/vnd.ms-excel.styles"
|
||||
}
|
||||
};
|
||||
|
||||
function new_ct()/*:any*/ {
|
||||
|
@ -5204,7 +5232,7 @@ function parse_ct(data/*:?string*/) {
|
|||
switch(y[0].replace(nsregex,"<")) {
|
||||
case '<?xml': break;
|
||||
case '<Types': ct.xmlns = y['xmlns' + (y[0].match(/<(\w+):/)||["",""])[1] ]; break;
|
||||
case '<Default': ctext[y.Extension] = y.ContentType; break;
|
||||
case '<Default': ctext[y.Extension.toLowerCase()] = y.ContentType; break;
|
||||
case '<Override':
|
||||
if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
|
||||
break;
|
||||
|
@ -5219,35 +5247,37 @@ function parse_ct(data/*:?string*/) {
|
|||
return ct;
|
||||
}
|
||||
|
||||
function write_ct(ct, opts)/*:string*/ {
|
||||
function write_ct(ct, opts, raw)/*:string*/ {
|
||||
var type2ct/*{[string]:Array<string>}*/ = evert_arr(ct2type);
|
||||
|
||||
var o/*:Array<string>*/ = [], v;
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
if(!raw) {
|
||||
o[o.length] = (XML_HEADER);
|
||||
o[o.length] = writextag('Types', null, {
|
||||
'xmlns': XMLNS.CT,
|
||||
'xmlns:xsd': XMLNS.xsd,
|
||||
'xmlns:xsi': XMLNS.xsi
|
||||
});
|
||||
o = o.concat([
|
||||
['xml', 'application/xml'],
|
||||
['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'],
|
||||
['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'],
|
||||
['data', 'application/vnd.openxmlformats-officedocument.model+data'],
|
||||
/* from test files */
|
||||
['bmp', 'image/bmp'],
|
||||
['png', 'image/png'],
|
||||
['gif', 'image/gif'],
|
||||
['emf', 'image/x-emf'],
|
||||
['wmf', 'image/x-wmf'],
|
||||
['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'],
|
||||
['tif', 'image/tiff'], ['tiff', 'image/tiff'],
|
||||
['pdf', 'application/pdf'],
|
||||
['rels', 'application/vnd.openxmlformats-package.relationships+xml']
|
||||
].map(function(x) {
|
||||
return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]});
|
||||
}));
|
||||
}
|
||||
|
||||
/* only write first instance */
|
||||
var f1 = function(w) {
|
||||
|
@ -5292,7 +5322,7 @@ function write_ct(ct, opts)/*:string*/ {
|
|||
f3('drawings');
|
||||
f2('metadata');
|
||||
f3('people');
|
||||
if(o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
/* 9.3 Relationships */
|
||||
|
@ -6050,7 +6080,7 @@ function parse_PropertySet(blob, PIDSI) {
|
|||
blob.l = start_addr + size; /* step ahead to skip padding */
|
||||
return PropH;
|
||||
}
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; //.concat(PseudoPropsPairs);
|
||||
var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ];
|
||||
function guess_property_type(val/*:any*/)/*:number*/ {
|
||||
switch(typeof val) {
|
||||
case "boolean": return 0x0B;
|
||||
|
@ -7967,9 +7997,9 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
} break;
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
switch(record[1].charAt(0)){
|
||||
case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break;
|
||||
} break;
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
|
@ -8048,7 +8078,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
cw = record[rj].slice(1).split(" ");
|
||||
for(j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
|
||||
Mval = parseInt(cw[2], 10);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval}; process_col(colinfo[j-1]);
|
||||
colinfo[j-1] = Mval === 0 ? {hidden:true}: {wch:Mval};
|
||||
} break;
|
||||
case 'C': /* default column format */
|
||||
C = parseInt(record[rj].slice(1), 10)-1;
|
||||
|
@ -8068,6 +8098,7 @@ var SYLK = /*#__PURE__*/(function() {
|
|||
}
|
||||
if(rowinfo.length > 0) sht['!rows'] = rowinfo;
|
||||
if(colinfo.length > 0) sht['!cols'] = colinfo;
|
||||
colinfo.forEach(function(col) { process_col(col); });
|
||||
if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
|
||||
return [arr, sht, wb];
|
||||
}
|
||||
|
@ -11955,22 +11986,29 @@ function parse_drawing(data, rels/*:any*/) {
|
|||
}
|
||||
|
||||
/* L.5.5.2 SpreadsheetML Comments + VML Schema */
|
||||
var _shapeid = 1024;
|
||||
function write_comments_vml(rId/*:number*/, comments) {
|
||||
function write_vml(rId/*:number*/, comments) {
|
||||
var csize = [21600, 21600];
|
||||
/* L.5.2.1.2 Path Attribute */
|
||||
var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");
|
||||
var o = [
|
||||
writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"),
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}),
|
||||
writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox})
|
||||
writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"})
|
||||
];
|
||||
while(_shapeid < rId * 1000) _shapeid += 1000;
|
||||
|
||||
comments.forEach(function(x) {
|
||||
var _shapeid = 65536 * rId;
|
||||
|
||||
var _comments = comments || [];
|
||||
if(_comments.length > 0) o.push(writextag("v:shapetype", [
|
||||
writextag("v:stroke", null, {joinstyle:"miter"}),
|
||||
writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"})
|
||||
].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox}));
|
||||
|
||||
_comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
}
|
||||
|
||||
function write_vml_comment(x, _shapeid)/*:string*/ {
|
||||
var c = decode_cell(x[0]);
|
||||
var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/;
|
||||
if(fillopts.type == "gradient") fillopts.angle = "-180";
|
||||
|
@ -11978,9 +12016,8 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
var fillxml = writextag('v:fill', fillparm, fillopts);
|
||||
|
||||
var shadata = ({on:"t", 'obscured':"t"}/*:any*/);
|
||||
++_shapeid;
|
||||
|
||||
o = o.concat([
|
||||
return [
|
||||
'<v:shape' + wxt_helper({
|
||||
id:'_x0000_s' + _shapeid,
|
||||
type:"#_x0000_t202",
|
||||
|
@ -12003,9 +12040,7 @@ function write_comments_vml(rId/*:number*/, comments) {
|
|||
x[1].hidden ? '' : '<x:Visible/>',
|
||||
'</x:ClientData>',
|
||||
'</v:shape>'
|
||||
]); });
|
||||
o.push('</xml>');
|
||||
return o.join("");
|
||||
].join("");
|
||||
}
|
||||
function sheet_insert_comments(sheet, comments/*:Array<RawComment>*/, threaded/*:boolean*/, people/*:?Array<any>*/) {
|
||||
var dense = Array.isArray(sheet);
|
||||
|
@ -18727,7 +18762,7 @@ function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ {
|
|||
var bufs = [];
|
||||
var d = blob.slice(blob.l,blob.l+l);
|
||||
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002f /* FilePass */: case 0x0195 /* FileLock */: case 0x00e1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
||||
break;
|
||||
case 0x0085 /* BoundSheet8 */:
|
||||
break;
|
||||
|
@ -18910,7 +18945,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
|||
if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
||||
else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/;
|
||||
/*:: val = (val:any); */
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
||||
switch(RecordType) {
|
||||
case 0x0022 /* Date1904 */:
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
|
@ -20985,7 +21020,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
|||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
if(b8) ws['!links'] = [];
|
||||
|
@ -21070,11 +21105,11 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
|
|||
|
||||
var C = buf_array();
|
||||
/* METADATA [MTRSettings] [ForceFullCalculation] */
|
||||
if(b8) write_biff_rec(C, 0x008C, write_Country());
|
||||
if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
|
||||
/* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */
|
||||
|
||||
/* BIFF8: [SST *Continue] ExtSST */
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC, write_SST(opts.Strings, opts));
|
||||
if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
|
||||
|
||||
/* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */
|
||||
write_biff_rec(C, 0x000A /* EOF */);
|
||||
|
@ -21134,7 +21169,7 @@ function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
|
|||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23762,7 +23797,6 @@ function parse_xlsxcfb(cfb, _opts/*:?ParseOpts*/)/*:Workbook*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23841,7 +23875,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -23897,7 +23931,6 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
}
|
||||
|
||||
function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
_shapeid = 1024;
|
||||
if(wb && !wb.SSF) {
|
||||
wb.SSF = dup(table_fmt);
|
||||
}
|
||||
|
@ -23990,7 +24023,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
|||
need_vml = true;
|
||||
}
|
||||
if(ws['!legacy']) {
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments']));
|
||||
if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments']));
|
||||
}
|
||||
delete ws['!comments'];
|
||||
delete ws['!legacy'];
|
||||
|
@ -24745,7 +24778,7 @@ function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dy
|
|||
if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
|
||||
if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
|
||||
if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
|
||||
ws["!ref"] = encode_range(ws["!ref"]);
|
||||
ws["!ref"] = encode_range(wsr);
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
@ -24915,7 +24948,7 @@ var __stream = {
|
|||
to_json: write_json_stream,
|
||||
to_html: write_html_stream,
|
||||
to_csv: write_csv_stream,
|
||||
set_readable: set_readable
|
||||
set_readable: set_readable
|
||||
};
|
||||
export const version = XLSX.version;
|
||||
export {
|
||||
|
@ -24931,6 +24964,8 @@ export {
|
|||
writeSyncXLSX as writeXLSX,
|
||||
writeFileSyncXLSX as writeFileXLSX,
|
||||
utils,
|
||||
set_fs,
|
||||
set_cptable,
|
||||
__stream as stream,
|
||||
SSF,
|
||||
CFB
|
||||
|
|
Loading…
Reference in New Issue