Skip to content

Commit 82b7ada

Browse files
committed
version bump 0.16.7
- set active worksheet to first visible (fixes #1433 h/t @ManjunathSVBB)
1 parent 0cc6cc9 commit 82b7ada

25 files changed

+420
-246
lines changed

bits/01_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
XLSX.version = '0.16.6';
1+
XLSX.version = '0.16.7';

bits/20_jsutils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length
122122
function fuzzynum(s/*:string*/)/*:number*/ {
123123
var v/*:number*/ = Number(s);
124124
if(!isNaN(v)) return v;
125+
if(!/\d/.test(s)) return v;
125126
var wt = 1;
126127
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
127128
if(!isNaN(v = Number(ss))) return v / wt;

bits/29_xlsenum.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
/* [MS-OLEPS] 2.2 PropertyType */
22
//var VT_EMPTY = 0x0000;
33
//var VT_NULL = 0x0001;
4-
var VT_I2 = 0x0002;
5-
var VT_I4 = 0x0003;
4+
var VT_I2 = 0x0002;
5+
var VT_I4 = 0x0003;
66
//var VT_R4 = 0x0004;
77
//var VT_R8 = 0x0005;
88
//var VT_CY = 0x0006;
99
//var VT_DATE = 0x0007;
1010
//var VT_BSTR = 0x0008;
1111
//var VT_ERROR = 0x000A;
12-
var VT_BOOL = 0x000B;
13-
var VT_VARIANT = 0x000C;
12+
var VT_BOOL = 0x000B;
13+
var VT_VARIANT = 0x000C;
1414
//var VT_DECIMAL = 0x000E;
1515
//var VT_I1 = 0x0010;
1616
//var VT_UI1 = 0x0011;
1717
//var VT_UI2 = 0x0012;
18-
var VT_UI4 = 0x0013;
18+
var VT_UI4 = 0x0013;
1919
//var VT_I8 = 0x0014;
2020
//var VT_UI8 = 0x0015;
2121
//var VT_INT = 0x0016;
2222
//var VT_UINT = 0x0017;
23-
var VT_LPSTR = 0x001E;
23+
var VT_LPSTR = 0x001E;
2424
//var VT_LPWSTR = 0x001F;
2525
var VT_FILETIME = 0x0040;
26-
var VT_BLOB = 0x0041;
26+
var VT_BLOB = 0x0041;
2727
//var VT_STREAM = 0x0042;
2828
//var VT_STORAGE = 0x0043;
2929
//var VT_STREAMED_Object = 0x0044;
3030
//var VT_STORED_Object = 0x0045;
3131
//var VT_BLOB_Object = 0x0046;
32-
var VT_CF = 0x0047;
32+
var VT_CF = 0x0047;
3333
//var VT_CLSID = 0x0048;
3434
//var VT_VERSIONED_STREAM = 0x0049;
35-
var VT_VECTOR = 0x1000;
35+
var VT_VECTOR = 0x1000;
3636
//var VT_ARRAY = 0x2000;
3737

38-
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
39-
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
40-
var VT_CUSTOM = [VT_STRING, VT_USTR];
38+
var VT_STRING = 0x0050; // 2.3.3.1.11 VtString
39+
var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString
40+
var VT_CUSTOM = [VT_STRING, VT_USTR];
4141

4242
/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */
4343
var DocSummaryPIDDSI = {
@@ -100,9 +100,9 @@ var SpecialProperties = {
100100
/*::[*/0x72627262/*::]*/: {}
101101
};
102102

103-
(function () {
104-
for (var y in SpecialProperties) if (Object.prototype.hasOwnProperty.call(SpecialProperties, y))
105-
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
103+
(function() {
104+
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
105+
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
106106
})();
107107

108108
var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n");
@@ -185,7 +185,7 @@ var XLSFillPattern = [
185185
'gray0625'
186186
];
187187

188-
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); }
188+
function rgbify(arr/*:Array<number>*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); }
189189

190190
/* [MS-XLS] 2.5.161 */
191191
/* [MS-XLSB] 2.5.75 Icv */
@@ -295,4 +295,4 @@ var BErr = {
295295
/*::[*/0x2B/*::]*/: "#GETTING_DATA",
296296
/*::[*/0xFF/*::]*/: "#WTF?"
297297
};
298-
var RBErr = evert_num(BErr);
298+
var RBErr = evert_num(BErr);

bits/31_rels.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var RELS = ({
77
XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
88
XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
99
XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
10+
CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
11+
CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
1012
VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
1113
}/*:any*/);
1214

bits/72_wbxml.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,17 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
192192
var sheets = wb.Workbook && wb.Workbook.Sheets || [];
193193
var i = 0;
194194

195-
/* bookViews */
195+
/* bookViews only written if first worksheet is hidden */
196+
if(sheets && sheets[0] && !!sheets[0].Hidden) {
197+
o[o.length] = "<bookViews>";
198+
for(i = 0; i != wb.SheetNames.length; ++i) {
199+
if(!sheets[i]) break;
200+
if(!sheets[i].Hidden) break;
201+
}
202+
if(i == wb.SheetNames.length) i = 0;
203+
o[o.length] = '<workbookView firstSheet="' + i + '" activeTab="' + i + '"/>';
204+
o[o.length] = "</bookViews>";
205+
}
196206

197207
o[o.length] = "<sheets>";
198208
for(i = 0; i != wb.SheetNames.length; ++i) {

bits/75_xlml.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
611611
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
612612
break;
613613

614+
case 'activerow' /*case 'ActiveRow'*/: break;
615+
case 'activecol' /*case 'ActiveCol'*/: break;
614616
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
615617
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
616618

@@ -630,8 +632,6 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
630632
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
631633
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
632634
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
633-
case 'activerow' /*case 'ActiveRow'*/: break;
634-
case 'activecol' /*case 'ActiveCol'*/: break;
635635
case 'activepane' /*case 'ActivePane'*/: break;
636636
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
637637
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;

bits/81_writeods.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
3333
var write_ws = function(ws, wb/*:Workbook*/, i/*:number*//*::, opts*/)/*:string*/ {
3434
/* Section 9 Tables */
3535
var o/*:Array<string>*/ = [];
36-
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '">\n');
36+
o.push(' <table:table table:name="' + escapexml(wb.SheetNames[i]) + '" table:style-name="ta1">\n');
3737
var R=0,C=0, range = decode_range(ws['!ref']);
3838
var marr/*:Array<Range>*/ = ws['!merges'] || [], mi = 0;
3939
var dense = Array.isArray(ws);
@@ -105,6 +105,7 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
105105

106106
var write_automatic_styles_ods = function(o/*:Array<string>*/) {
107107
o.push(' <office:automatic-styles>\n');
108+
108109
o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');
109110
o.push(' <number:month number:style="long"/>\n');
110111
o.push(' <number:text>/</number:text>\n');
@@ -113,11 +114,16 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
113114
o.push(' <number:year/>\n');
114115
o.push(' </number:date-style>\n');
115116

117+
/* table */
116118
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
117119
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
118120
o.push(' </style:style>\n');
119121

122+
/* table cells, text */
120123
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
124+
125+
/* page-layout */
126+
121127
o.push(' </office:automatic-styles>\n');
122128
};
123129

bits/84_defaults.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ function fix_opts_func(defaults/*:Array<Array<any> >*/)/*:{(o:any):void}*/ {
88
};
99
}
1010

11-
var fix_read_opts = fix_opts_func([
11+
var fix_read_opts = function(opts) {
12+
fix_opts_func([
1213
['cellNF', false], /* emit cell number format string as .z */
1314
['cellHTML', true], /* emit html string as .h */
1415
['cellFormula', true], /* emit formulae as .f */
@@ -27,8 +28,8 @@ var fix_read_opts = fix_opts_func([
2728

2829
['password',''], /* password */
2930
['WTF', false] /* WTF mode (throws errors) */
30-
]);
31-
31+
])(opts);
32+
};
3233

3334
var fix_write_opts = fix_opts_func([
3435
['cellDates', false], /* write date cells with type `d` */

dist/xlsx.core.min.js

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/xlsx.core.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)