updating to 0.11.15

This commit is contained in:
SheetJS 2017-12-24 21:44:14 -05:00
parent 6e99424766
commit 9651250378
5 changed files with 49 additions and 29 deletions

4
.gitignore vendored

@ -13,8 +13,8 @@ tmp
*.[pP][rR][nN]
*.[sS][lL][kK]
*.socialcalc
*.[xX][lL][sSwWcC]
*.[xX][lL][sS][xXmMbB]
*.[xX][lL][sSwWcCaAtT]
*.[xX][lL][sSaAtT][xXmMbB]
*.[oO][dD][sS]
*.[fF][oO][dD][sS]
*.[xX][mM][lL]

@ -1673,6 +1673,15 @@ describe('json output', function() {
assert.equal(json1[2][1], 5);
assert.equal(json1[2][3], 3);
});
it('should preserve values when column header is missing', function() {
/*jshint elision:true */
var _data = [[,"a","b",,"c"], [1,2,3,,5],[,3,4,5,6]];
/*jshint elision:false */
var _ws = X.utils.aoa_to_sheet(_data);
var json1 = X.utils.sheet_to_json(_ws, { raw: true });
assert.equal(json1[0].__EMPTY, 1);
assert.equal(json1[1].__EMPTY_1, 5);
});
});
@ -1891,6 +1900,11 @@ describe('HTML', function() {
it('should interpret values by default', function() { plaintext_test(X.read(html_bstr, {type:"binary"}), false, false); });
it('should generate strings if raw option is passed', function() { plaintext_test(X.read(html_bstr, {type:"binary", raw:true}), true, false); });
it('should handle "string" type', function() { plaintext_test(X.read(html_str, {type:"string"}), false, false); });
it('should handle newlines correctly', function() {
var table = "<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>";
var wb = X.read(table, {type:"string"});
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
});
});
(domtest ? describe : describe.skip)('input DOM', function() {
it('should interpret values by default', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str)), false, true); });

16
xlsx.core.min.js vendored

File diff suppressed because one or more lines are too long

20
xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

24
xlsx.js

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.11.14';
XLSX.version = '0.11.15';
var current_codepage = 1200;
/*global cptable:true */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -3385,6 +3385,7 @@ var CT_LIST = (function(){
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 */
@ -11747,7 +11748,10 @@ function write_ws_xml_autofilter(data) {
/* 18.3.1.88 sheetViews CT_SheetViews */
/* 18.3.1.87 sheetView CT_SheetView */
function write_ws_xml_sheetviews(ws, opts, idx, wb) {
return writextag("sheetViews", writextag("sheetView", null, {workbookViewId:"0"}), {});
var sview = {workbookViewId:"0"};
// $FlowIgnore
if( (((wb||{}).Workbook||{}).Views||[])[0] ) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0";
return writextag("sheetViews", writextag("sheetView", null, sview), {});
}
function write_ws_xml_cell(cell, ref, ws, opts, idx, wb) {
@ -12445,9 +12449,12 @@ function write_BrtMargins(margins, o) {
}
/* [MS-XLSB] 2.4.292 BrtBeginWsView */
function write_BrtBeginWsView(ws, o) {
function write_BrtBeginWsView(ws, Workbook, o) {
if(o == null) o = new_buf(30);
o.write_shift(2, 924); // bit flag
var f = 0x39c;
// $FlowIgnore
if((((Workbook||{}).Views||[])[0]||{}).RTL) f |= 0x20;
o.write_shift(2, f); // bit flag
o.write_shift(4, 0);
o.write_shift(4, 0); // view first row
o.write_shift(4, 0); // view first col
@ -12857,11 +12864,11 @@ function write_AUTOFILTER(ba, ws) {
write_record(ba, "BrtEndAFilter");
}
function write_WSVIEWS2(ba, ws) {
function write_WSVIEWS2(ba, ws, Workbook) {
write_record(ba, "BrtBeginWsViews");
{ /* 1*WSVIEW2 */
/* [ACUID] */
write_record(ba, "BrtBeginWsView", write_BrtBeginWsView(ws));
write_record(ba, "BrtBeginWsView", write_BrtBeginWsView(ws, Workbook));
/* [BrtPane] */
/* *4BrtSel */
/* *4SXSELECT */
@ -12894,7 +12901,7 @@ function write_ws_bin(idx, opts, wb, rels) {
write_record(ba, "BrtBeginSheet");
write_record(ba, "BrtWsProp", write_BrtWsProp(c));
write_record(ba, "BrtWsDim", write_BrtWsDim(r));
write_WSVIEWS2(ba, ws);
write_WSVIEWS2(ba, ws, wb.Workbook);
write_WSFMTINFO(ba, ws);
write_COLINFOS(ba, ws, idx, opts, wb);
write_CELLTABLE(ba, ws, idx, opts, wb);
@ -17335,7 +17342,6 @@ var HTML_ = (function() {
var m = cell, cc = 0;
/* TODO: parse styles etc */
while(m.charAt(0) == "<" && (cc = m.indexOf(">")) > -1) m = m.slice(cc+1);
while(m.indexOf(">") > -1) m = m.slice(0, m.lastIndexOf("<"));
var tag = parsexmltag(cell.slice(0, cell.indexOf(">")));
CS = tag.colspan ? +tag.colspan : 1;
if((RS = +tag.rowspan)>0 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}});
@ -18929,7 +18935,7 @@ function sheet_to_json(sheet, opts) {
case 2: hdr[C] = cols[C]; break;
case 3: hdr[C] = o.header[C - r.s.c]; break;
default:
if(val == null) continue;
if(val == null) val = {w: "__EMPTY", t: "s"};
vv = v = format_cell(val, null, o);
counter = 0;
for(CC = 0; CC < hdr.length; ++CC) if(hdr[CC] == vv) vv = v + "_" + (++counter);