Skip to content

Commit 20212e1

Browse files
committed
version bump 0.16.9: utf-8 codenames
1 parent f7835d6 commit 20212e1

21 files changed

+139
-72
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,13 @@ In addition to the base sheet keys, worksheets also add:
10931093
will write all cells in the merge range if they exist, so be sure that only
10941094
the first cell (upper-left) in the range is set.
10951095

1096-
- `ws['!outline']`: configure how outlines should behave.
1097-
Example: `{above: true}` - equivalent of unchecking the Excel option "Summary rows below detail".
1098-
`{left: true}` - equivalent of unchecking the Excel option "Summary option to the right of detail."
1096+
- `ws['!outline']`: configure how outlines should behave. Options default to
1097+
the default settings in Excel 2019:
1098+
1099+
| key | Excel feature | default |
1100+
|:----------|:----------------------------------------------|:--------|
1101+
| `above` | Uncheck "Summary rows below detail" | `false` |
1102+
| `left` | Uncheck "Summary rows to the right of detail" | `false` |
10991103

11001104
- `ws['!protect']`: object of write sheet protection properties. The `password`
11011105
key specifies the password for formats that support password-protected sheets

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.8';
1+
XLSX.version = '0.16.9';

bits/67_wsxml.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function write_ws_xml_merges(merges/*:Array<Range>*/)/*:string*/ {
102102
function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) {
103103
var data = parsexmltag(sheetPr);
104104
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
105-
if(data.codeName) wb.Sheets[idx].CodeName = data.codeName;
105+
if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
106106
}
107107
function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
108108
var needed = false;
@@ -111,7 +111,7 @@ function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
111111
var cname = wb.SheetNames[idx];
112112
try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {}
113113
needed = true;
114-
props.codeName = escapexml(cname);
114+
props.codeName = utf8write(escapexml(cname));
115115
}
116116

117117
if(ws && ws["!outline"]) {

bits/80_parseods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ var parse_content_xml = (function() {
382382
case 'line-break': break; // 6.1.5 <text:line-break>
383383
case 'span': break; // 6.1.7 <text:span>
384384
case 'p': case '文本串': // 5.1.3 <text:p>
385-
if(['master-styles'].indexOf(state[satte.length-1][0]) > -1) break;
385+
if(['master-styles'].indexOf(state[state.length-1][0]) > -1) break;
386386
if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) {
387387
var ptp = parse_text_p(str.slice(textpidx,Rn.index), textptag);
388388
textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0];

dist/xlsx.core.min.js

Lines changed: 7 additions & 7 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.

dist/xlsx.extendscript.js

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

dist/xlsx.full.min.js

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

dist/xlsx.full.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.

dist/xlsx.js

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

dist/xlsx.min.js

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

dist/xlsx.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.

dist/xlsx.mini.min.js

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

dist/xlsx.mini.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.

docbits/54_shobject.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ In addition to the base sheet keys, worksheets also add:
1616
will write all cells in the merge range if they exist, so be sure that only
1717
the first cell (upper-left) in the range is set.
1818

19+
- `ws['!outline']`: configure how outlines should behave. Options default to
20+
the default settings in Excel 2019:
21+
22+
| key | Excel feature | default |
23+
|:----------|:----------------------------------------------|:--------|
24+
| `above` | Uncheck "Summary rows below detail" | `false` |
25+
| `left` | Uncheck "Summary rows to the right of detail" | `false` |
26+
1927
- `ws['!protect']`: object of write sheet protection properties. The `password`
2028
key specifies the password for formats that support password-protected sheets
2129
(XLSX/XLSB/XLS). The writer uses the XOR obfuscation method. The following

misc/docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,14 @@ In addition to the base sheet keys, worksheets also add:
10001000
will write all cells in the merge range if they exist, so be sure that only
10011001
the first cell (upper-left) in the range is set.
10021002

1003+
- `ws['!outline']`: configure how outlines should behave. Options default to
1004+
the default settings in Excel 2019:
1005+
1006+
| key | Excel feature | default |
1007+
|:----------|:----------------------------------------------|:--------|
1008+
| `above` | Uncheck "Summary rows below detail" | `false` |
1009+
| `left` | Uncheck "Summary rows to the right of detail" | `false` |
1010+
10031011
- `ws['!protect']`: object of write sheet protection properties. The `password`
10041012
key specifies the password for formats that support password-protected sheets
10051013
(XLSX/XLSB/XLS). The writer uses the XOR obfuscation method. The following

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xlsx",
3-
"version": "0.16.8",
3+
"version": "0.16.9",
44
"author": "sheetjs",
55
"description": "SheetJS Spreadsheet data parser and writer",
66
"keywords": [
@@ -38,6 +38,7 @@
3838
"commander": "~2.17.1",
3939
"crc-32": "~1.2.0",
4040
"exit-on-epipe": "~1.0.1",
41+
"fflate": "^0.3.8",
4142
"ssf": "~0.11.2",
4243
"word": "~0.3.0",
4344
"wmf": "~1.0.1"

xlsx.flow.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
55
var XLSX = {};
66
function make_xlsx_lib(XLSX){
7-
XLSX.version = '0.16.8';
7+
XLSX.version = '0.16.9';
88
var current_codepage = 1200, current_ansi = 1252;
99
/*:: declare var cptable:any; */
1010
/*global cptable:true, window */
@@ -13407,7 +13407,7 @@ function write_ws_xml_merges(merges/*:Array<Range>*/)/*:string*/ {
1340713407
function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) {
1340813408
var data = parsexmltag(sheetPr);
1340913409
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
13410-
if(data.codeName) wb.Sheets[idx].CodeName = data.codeName;
13410+
if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
1341113411
}
1341213412
function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
1341313413
var needed = false;
@@ -13416,7 +13416,14 @@ function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
1341613416
var cname = wb.SheetNames[idx];
1341713417
try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {}
1341813418
needed = true;
13419-
props.codeName = escapexml(cname);
13419+
props.codeName = utf8write(escapexml(cname));
13420+
}
13421+
13422+
if(ws && ws["!outline"]) {
13423+
var outlineprops = {summaryBelow:1, summaryRight:1};
13424+
if(ws["!outline"].above) outlineprops.summaryBelow = 0;
13425+
if(ws["!outline"].left) outlineprops.summaryRight = 0;
13426+
payload = (payload||"") + writextag('outlinePr', null, outlineprops);
1342013427
}
1342113428

1342213429
if(!needed && !payload) return;
@@ -13593,7 +13600,7 @@ function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string
1359313600
}
1359413601

1359513602
var parse_ws_xml_data = (function() {
13596-
var cellregex = /<(?:\w+:)?c[ >]/, rowregex = /<\/(?:\w+:)?row>/;
13603+
var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/;
1359713604
var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/;
1359813605
var refregex = /ref=["']([^"']*)["']/;
1359913606
var match_v = matchtag("v"), match_f = matchtag("f");
@@ -20016,6 +20023,7 @@ var parse_content_xml = (function() {
2001620023
case 'scripts': // 3.12 <office:scripts>
2001720024
case 'styles': // TODO <office:styles>
2001820025
case 'font-face-decls': // 3.14 <office:font-face-decls>
20026+
case 'master-styles': //3.15.4 <office:master-styles> -- relevant for FODS
2001920027
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;}
2002020028
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
2002120029
break;
@@ -20082,7 +20090,6 @@ var parse_content_xml = (function() {
2008220090
case 'script': break; // 3.13 <office:script>
2008320091
case 'libraries': break; // TODO: <ooo:libraries>
2008420092
case 'automatic-styles': break; // 3.15.3 <office:automatic-styles>
20085-
case 'master-styles': break; // TODO: <office:master-styles>
2008620093

2008720094
case 'default-style': // TODO: <style:default-style>
2008820095
case 'page-layout': break; // TODO: <style:page-layout>
@@ -20179,6 +20186,7 @@ var parse_content_xml = (function() {
2017920186
case 'line-break': break; // 6.1.5 <text:line-break>
2018020187
case 'span': break; // 6.1.7 <text:span>
2018120188
case 'p': case '文本串': // 5.1.3 <text:p>
20189+
if(['master-styles'].indexOf(state[state.length-1][0]) > -1) break;
2018220190
if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) {
2018320191
var ptp = parse_text_p(str.slice(textpidx,Rn.index), textptag);
2018420192
textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0];

xlsx.js

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

0 commit comments

Comments
 (0)