version bump 0.7.10: cleanup
- build bower.json (h/t @jjstewart, following the change from js-xls) - README clarification on !ref (fixes #82) - XLSX treat empty <v/> tags as empty cells (h/t @clarlars) - XLSX write !merges array (fixes #92)
This commit is contained in:
parent
c58477279e
commit
19f3a6ae76
5
Makefile
5
Makefile
|
@ -74,8 +74,11 @@ coveralls:
|
|||
coveralls-spin:
|
||||
make coveralls & bash misc/spin.sh $$!
|
||||
|
||||
bower.json: misc/_bower.json package.json
|
||||
cat $< | sed 's/_VERSION_/'`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`'/' > $@
|
||||
|
||||
.PHONY: dist
|
||||
dist: dist-deps $(TARGET)
|
||||
dist: dist-deps $(TARGET) bower.json
|
||||
cp $(TARGET) dist/
|
||||
cp LICENSE dist/
|
||||
uglifyjs $(TARGET) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
|
||||
|
|
|
@ -306,6 +306,12 @@ Special worksheet keys (accessible as `worksheet[key]`, each starting with `!`):
|
|||
writing a worksheet by hand, be sure to update the range. For a longer
|
||||
discussion, see <http://git.io/KIaNKQ>
|
||||
|
||||
Functions that handle worksheets should test for the presence of `!ref` field.
|
||||
If the `!ref` is omitted or is not a valid range, functions are free to treat
|
||||
the sheet as empty or attempt to guess the range. The standard utilities that
|
||||
ship with this library treat sheets as empty (for example, the CSV output is an
|
||||
empty string).
|
||||
|
||||
When reading a worksheet with the `sheetRows` property set, the ref parameter
|
||||
will use the restricted range. The original range is set at `ws['!fullref']`
|
||||
|
||||
|
|
11
bin/xlsx.njs
11
bin/xlsx.njs
|
@ -35,6 +35,17 @@ program.on('--help', function() {
|
|||
|
||||
program.parse(process.argv);
|
||||
|
||||
/* see https://github.com/SheetJS/j/issues/4 */
|
||||
if(process.version === 'v0.10.31') {
|
||||
var msgs = [
|
||||
"node v0.10.31 is known to crash on OSX and Linux, refusing to proceed.",
|
||||
"see https://github.com/SheetJS/j/issues/4 for the relevant discussion.",
|
||||
"see https://github.com/joyent/node/issues/8208 for the relevant node issue"
|
||||
];
|
||||
msgs.forEach(function(m) { console.error(m); });
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var filename, sheetname = '';
|
||||
if(program.args[0]) {
|
||||
filename = program.args[0];
|
||||
|
|
|
@ -1 +1 @@
|
|||
XLSX.version = '0.7.9';
|
||||
XLSX.version = '0.7.10';
|
||||
|
|
|
@ -63,6 +63,12 @@ function parse_ws_xml(data, opts, rels) {
|
|||
return s;
|
||||
}
|
||||
|
||||
function write_ws_xml_merges(merges) {
|
||||
if(merges.length == 0) return "";
|
||||
var o = '<mergeCells count="' + merges.length + '">';
|
||||
for(var i = 0; i != merges.length; ++i) o += '<mergeCell ref="' + encode_range(merges[i]) + '"/>';
|
||||
return o + '</mergeCells>';
|
||||
}
|
||||
|
||||
function parse_ws_xml_hlinks(s, data, rels) {
|
||||
for(var i = 0; i != data.length; ++i) {
|
||||
|
@ -185,7 +191,7 @@ return function parse_ws_xml_data(sdata, s, opts, guess) {
|
|||
d = x.substr(i);
|
||||
p = {t:""};
|
||||
|
||||
if((cref=d.match(match_v))!== null) p.v=unescapexml(cref[1]);
|
||||
if((cref=d.match(match_v))!== null && cref[1] !== '') p.v=unescapexml(cref[1]);
|
||||
if(opts.cellFormula && (cref=d.match(match_f))!== null) p.f=unescapexml(cref[1]);
|
||||
|
||||
/* SCHEMA IS ACTUALLY INCORRECT HERE. IF A CELL HAS NO T, EMIT "" */
|
||||
|
@ -271,6 +277,8 @@ function write_ws_xml(idx, opts, wb) {
|
|||
}
|
||||
if(o.length>sidx+1) { o[o.length] = ('</sheetData>'); o[sidx]=o[sidx].replace("/>",">"); }
|
||||
|
||||
if(ws['!merges'] !== undefined && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges']));
|
||||
|
||||
if(o.length>2) { o[o.length] = ('</worksheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "js-xlsx",
|
||||
"homepage": "https://github.com/SheetJS/js-xlsx",
|
||||
"main": "dist/xlsx.js",
|
||||
"version": "0.7.10",
|
||||
"ignore": [
|
||||
"bin",
|
||||
"bits",
|
||||
"misc",
|
||||
"**/.*"
|
||||
],
|
||||
"keywords": [
|
||||
"excel",
|
||||
"xlsx",
|
||||
"xlsm",
|
||||
"xlsb",
|
||||
"js-xlsx"
|
||||
]
|
||||
}
|
|
@ -498,7 +498,7 @@ Usage:
|
|||
function JSZip(data, options) {
|
||||
// if this constructor is used without `new`, it adds `new` before itself:
|
||||
if(!(this instanceof JSZip)) return new JSZip(data, options);
|
||||
|
||||
|
||||
// object containing the files :
|
||||
// {
|
||||
// "folder/" : {...},
|
||||
|
@ -588,7 +588,7 @@ module.exports = function(data, options) {
|
|||
(function (Buffer){
|
||||
'use strict';
|
||||
module.exports = function(data, encoding){
|
||||
return new Buffer(data, encoding);
|
||||
return new Buffer(data, encoding);
|
||||
};
|
||||
module.exports.test = function(b){
|
||||
return Buffer.isBuffer(b);
|
||||
|
@ -898,7 +898,7 @@ var parentFolder = function (path) {
|
|||
* Add a (sub) folder in the current folder.
|
||||
* @private
|
||||
* @param {string} name the folder's name
|
||||
* @param {boolean=} [createFolders] If true, automatically create sub
|
||||
* @param {boolean=} [createFolders] If true, automatically create sub
|
||||
* folders. Defaults to false.
|
||||
* @return {Object} the new folder.
|
||||
*/
|
||||
|
@ -1357,7 +1357,7 @@ var out = {
|
|||
default : // case "string" :
|
||||
return zip;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5554,7 +5554,7 @@ function GZheader() {
|
|||
// but leave for few code modifications
|
||||
|
||||
//
|
||||
// Setup limits is not necessary because in js we should not preallocate memory
|
||||
// Setup limits is not necessary because in js we should not preallocate memory
|
||||
// for inflate use constant limit in 65536 bytes
|
||||
//
|
||||
|
||||
|
@ -8979,4 +8979,4 @@ function ZStream() {
|
|||
module.exports = ZStream;
|
||||
},{}]},{},[9])
|
||||
(9)
|
||||
});
|
||||
});
|
||||
|
|
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
|
@ -3,7 +3,7 @@
|
|||
/*jshint -W041 */
|
||||
var XLSX = {};
|
||||
(function(XLSX){
|
||||
XLSX.version = '0.7.9';
|
||||
XLSX.version = '0.7.10';
|
||||
var current_codepage = 1252, current_cptable;
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
if(typeof cptable === 'undefined') cptable = require('./dist/cpexcel');
|
||||
|
@ -2849,6 +2849,12 @@ function parse_ws_xml(data, opts, rels) {
|
|||
return s;
|
||||
}
|
||||
|
||||
function write_ws_xml_merges(merges) {
|
||||
if(merges.length == 0) return "";
|
||||
var o = '<mergeCells count="' + merges.length + '">';
|
||||
for(var i = 0; i != merges.length; ++i) o += '<mergeCell ref="' + encode_range(merges[i]) + '"/>';
|
||||
return o + '</mergeCells>';
|
||||
}
|
||||
|
||||
function parse_ws_xml_hlinks(s, data, rels) {
|
||||
for(var i = 0; i != data.length; ++i) {
|
||||
|
@ -2971,7 +2977,7 @@ return function parse_ws_xml_data(sdata, s, opts, guess) {
|
|||
d = x.substr(i);
|
||||
p = {t:""};
|
||||
|
||||
if((cref=d.match(match_v))!== null) p.v=unescapexml(cref[1]);
|
||||
if((cref=d.match(match_v))!== null && cref[1] !== '') p.v=unescapexml(cref[1]);
|
||||
if(opts.cellFormula && (cref=d.match(match_f))!== null) p.f=unescapexml(cref[1]);
|
||||
|
||||
/* SCHEMA IS ACTUALLY INCORRECT HERE. IF A CELL HAS NO T, EMIT "" */
|
||||
|
@ -3057,6 +3063,8 @@ function write_ws_xml(idx, opts, wb) {
|
|||
}
|
||||
if(o.length>sidx+1) { o[o.length] = ('</sheetData>'); o[sidx]=o[sidx].replace("/>",">"); }
|
||||
|
||||
if(ws['!merges'] !== undefined && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges']));
|
||||
|
||||
if(o.length>2) { o[o.length] = ('</worksheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "js-xlsx",
|
||||
"homepage": "https://github.com/SheetJS/js-xlsx",
|
||||
"main": "dist/xlsx.js",
|
||||
"version": "_VERSION_",
|
||||
"ignore": [
|
||||
"bin",
|
||||
"bits",
|
||||
"misc",
|
||||
"**/.*"
|
||||
],
|
||||
"keywords": [
|
||||
"excel",
|
||||
"xlsx",
|
||||
"xlsm",
|
||||
"xlsb",
|
||||
"js-xlsx"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.7.9",
|
||||
"version": "0.7.10",
|
||||
"author": "sheetjs",
|
||||
"description": "Excel 2007+ spreadsheet (XLSB/XLSX/XLSM) parser and writer",
|
||||
"keywords": [ "excel", "xlsx", "xlsb", "xlsm", "office", "spreadsheet" ],
|
||||
|
|
12
test.js
12
test.js
|
@ -653,6 +653,18 @@ describe('roundtrip features', function() {
|
|||
}); });
|
||||
});
|
||||
});
|
||||
|
||||
describe('should preserve features', function() {
|
||||
it('merge cells', function() {
|
||||
var wb1 = X.readFile(paths.mc1);
|
||||
var wb2 = X.read(X.write(wb1, {type:'binary'}), {type:'binary'});
|
||||
var m1 = wb1.Sheets.Merge['!merges'].map(X.utils.encode_range);
|
||||
var m2 = wb2.Sheets.Merge['!merges'].map(X.utils.encode_range);
|
||||
assert.equal(m1.length, m2.length);
|
||||
for(var i = 0; i < m1.length; ++i) assert.equal(m1[i], m2[i]);
|
||||
});
|
||||
});
|
||||
|
||||
/* the XLSJS require should not cause the test suite to fail */
|
||||
var XLSJS;
|
||||
try {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c126cabd50c9056205ce8762f851f5c3dbe33910
|
||||
Subproject commit 5308987eaeb01103964363cdc745b8340795d63c
|
|
@ -13,6 +13,7 @@ hyperlink_stress_test_2011.xlsb
|
|||
merge_cells.xlsb
|
||||
named_ranges_2011.xlsb
|
||||
number_format.xlsb
|
||||
number_format_entities.xlsb
|
||||
number_format_russian.xlsb
|
||||
pivot_table_named_range.xlsb
|
||||
pivot_table_test.xlsb
|
||||
|
@ -80,6 +81,7 @@ apachepoi_51710.xlsx
|
|||
apachepoi_51850.xlsx
|
||||
apachepoi_51963.xlsx
|
||||
apachepoi_52348.xlsx
|
||||
apachepoi_52575_main.xlsx
|
||||
apachepoi_52716.xlsx
|
||||
apachepoi_53101.xlsx
|
||||
apachepoi_53282.xlsx
|
||||
|
@ -97,6 +99,8 @@ apachepoi_54288.xlsx
|
|||
apachepoi_54436.xlsx
|
||||
apachepoi_54524.xlsx
|
||||
apachepoi_54607.xlsx
|
||||
apachepoi_54764-2.xlsx
|
||||
apachepoi_54764.xlsx
|
||||
apachepoi_55640.xlsx
|
||||
apachepoi_55745.xlsx
|
||||
apachepoi_55850.xlsx
|
||||
|
@ -113,6 +117,7 @@ apachepoi_56274.xlsx
|
|||
apachepoi_56278.xlsx
|
||||
apachepoi_56315.xlsx
|
||||
apachepoi_56420.xlsx
|
||||
apachepoi_56502.xlsx
|
||||
apachepoi_56514.xlsx
|
||||
apachepoi_56688_1.xlsx
|
||||
apachepoi_56688_2.xlsx
|
||||
|
@ -232,6 +237,7 @@ libreoffice_calc_xlsx-import_shared-formula_1.xlsx
|
|||
merge_cells.xlsx
|
||||
mixed_sheets.xlsx
|
||||
named_ranges_2011.xlsx
|
||||
number_format_entities.xlsx
|
||||
openpyxl_g_NameWithValueBug.xlsx
|
||||
openpyxl_g_empty-no-string.xlsx
|
||||
openpyxl_g_empty-with-styles.xlsx
|
||||
|
@ -320,5 +326,6 @@ apachepoi_47089.xlsm
|
|||
apachepoi_ExcelWithAttachments.xlsm
|
||||
number_format.xlsm
|
||||
number_format_russian.xlsm
|
||||
numfmt_1_russian.xlsm
|
||||
openpyxl_r_vba-test.xlsm
|
||||
pivot_table_test.xlsm
|
||||
|
|
12
xlsx.js
12
xlsx.js
|
@ -3,7 +3,7 @@
|
|||
/*jshint -W041 */
|
||||
var XLSX = {};
|
||||
(function(XLSX){
|
||||
XLSX.version = '0.7.9';
|
||||
XLSX.version = '0.7.10';
|
||||
var current_codepage = 1252, current_cptable;
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
if(typeof cptable === 'undefined') cptable = require('./dist/cpexcel');
|
||||
|
@ -2849,6 +2849,12 @@ function parse_ws_xml(data, opts, rels) {
|
|||
return s;
|
||||
}
|
||||
|
||||
function write_ws_xml_merges(merges) {
|
||||
if(merges.length == 0) return "";
|
||||
var o = '<mergeCells count="' + merges.length + '">';
|
||||
for(var i = 0; i != merges.length; ++i) o += '<mergeCell ref="' + encode_range(merges[i]) + '"/>';
|
||||
return o + '</mergeCells>';
|
||||
}
|
||||
|
||||
function parse_ws_xml_hlinks(s, data, rels) {
|
||||
for(var i = 0; i != data.length; ++i) {
|
||||
|
@ -2971,7 +2977,7 @@ return function parse_ws_xml_data(sdata, s, opts, guess) {
|
|||
d = x.substr(i);
|
||||
p = {t:""};
|
||||
|
||||
if((cref=d.match(match_v))!== null) p.v=unescapexml(cref[1]);
|
||||
if((cref=d.match(match_v))!== null && cref[1] !== '') p.v=unescapexml(cref[1]);
|
||||
if(opts.cellFormula && (cref=d.match(match_f))!== null) p.f=unescapexml(cref[1]);
|
||||
|
||||
/* SCHEMA IS ACTUALLY INCORRECT HERE. IF A CELL HAS NO T, EMIT "" */
|
||||
|
@ -3057,6 +3063,8 @@ function write_ws_xml(idx, opts, wb) {
|
|||
}
|
||||
if(o.length>sidx+1) { o[o.length] = ('</sheetData>'); o[sidx]=o[sidx].replace("/>",">"); }
|
||||
|
||||
if(ws['!merges'] !== undefined && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges']));
|
||||
|
||||
if(o.length>2) { o[o.length] = ('</worksheet>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue