updating to 0.11.16

This commit is contained in:
SheetJS 2017-12-30 00:41:41 -05:00
parent 9651250378
commit 547a81e3bb
5 changed files with 429 additions and 282 deletions

View File

@ -71,6 +71,9 @@ var process_wb = (function() {
var range = XLSX.utils.decode_range(ws['!ref']);
for(var i = range.s.c; i <= range.e.c; ++i) cDg.schema[i - range.s.c].title = XLSX.utils.encode_col(i);
HTMLOUT.style.height = (window.innerHeight - 400) + "px";
HTMLOUT.style.width = (window.innerWidth - 50) + "px";
if(typeof console !== 'undefined') console.log("output", new Date());
};
})();
@ -136,12 +139,6 @@ var export_xlsx = (function() {
return out;
}
function s2ab(s) {
var b = new ArrayBuffer(s.length), v = new Uint8Array(b);
for (var i=0; i != s.length; ++i) v[i] = s.charCodeAt(i) & 0xFF;
return b;
}
return function export_xlsx() {
if(!cDg) return;
/* convert canvas-datagrid data to worksheet */
@ -152,10 +149,10 @@ var export_xlsx = (function() {
XLSX.utils.book_append_sheet(new_wb, new_ws, 'SheetJS');
/* write file and trigger a download */
var wbout = XLSX.write(new_wb, {bookType:'xlsx', bookSST:true, type:'binary'});
var wbout = XLSX.write(new_wb, {bookType:'xlsx', bookSST:true, type:'array'});
var fname = 'sheetjs.xlsx';
try {
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), fname);
saveAs(new Blob([wbout],{type:"application/octet-stream"}), fname);
} catch(e) { if(typeof console != 'undefined') console.log(e, wbout); }
};
})();

View File

@ -655,6 +655,7 @@ describe('output formats', function() {
it('should write binary strings', function() { RT('binary'); });
it('should write base64 strings', function() { RT('base64'); });
it('should write JS strings', function() { RT('string'); });
if(typeof ArrayBuffer !== 'undefined' && (typeof process == 'undefined' || !process.version.match(/v0.12/))) it('should write array buffers', function() { RT('array'); });
if(!browser) it('should write buffers', function() { RT('buffer'); });
it('should throw if format is unknown', function() { assert.throws(function() { RT('dafuq'); }); });
});
@ -819,10 +820,10 @@ describe('parse features', function() {
var wbs=[];
var bef = (function() {
wbs = [
X.read(fs.readFileSync(paths.cpxlsx), {type:TYPE}),
X.read(fs.readFileSync(paths.cpxlsb), {type:TYPE}),
X.read(fs.readFileSync(paths.cpxls), {type:TYPE}),
X.read(fs.readFileSync(paths.cpxml), {type:TYPE})
X.read(fs.readFileSync(paths.cpxlsx), {type:TYPE, WTF:1}),
X.read(fs.readFileSync(paths.cpxlsb), {type:TYPE, WTF:1}),
X.read(fs.readFileSync(paths.cpxls), {type:TYPE, WTF:1}),
X.read(fs.readFileSync(paths.cpxml), {type:TYPE, WTF:1})
];
});
if(typeof before != 'undefined') before(bef);
@ -1319,7 +1320,7 @@ describe('roundtrip features', function() {
}); });
describe('should preserve merge cells', function() {
["xlsx", "xlsb", "xlml", "ods"].forEach(function(f) { it(f, function() {
["xlsx", "xlsb", "xlml", "ods", "biff8"].forEach(function(f) { it(f, function() {
var wb1 = X.read(fs.readFileSync(paths.mcxlsx), {type:TYPE});
var wb2 = X.read(X.write(wb1,{bookType:f,type:'binary'}),{type:'binary'});
var m1 = wb1.Sheets.Merge['!merges'].map(X.utils.encode_range);
@ -1911,8 +1912,15 @@ describe('HTML', function() {
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
it('should handle newlines correctly', function() {
var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>");
var wb = X.utils.table_to_book(table);
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
var ws = X.utils.table_to_sheet(table);
assert.equal(get_cell(ws, "A1").v, "foo\nbar");
});
it('should trim whitespace', function() {
if(get_dom_element("foo <br> bar").innerHTML != "foo <br> bar") return;
var table = get_dom_element("<table><tr><td> foo <br/> bar </td><td> baz qux </td></tr></table>");
var ws = X.utils.table_to_sheet(table);
assert.equal(get_cell(ws, "A1").v.replace(/\n/g, "|"), "foo | bar");
assert.equal(get_cell(ws, "B1").v, "baz qux");
});
});
if(domtest) it('should handle entities', function() {

30
xlsx.core.min.js vendored

File diff suppressed because one or more lines are too long

32
xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

614
xlsx.js

File diff suppressed because it is too large Load Diff