@cj-tech-master/excelts 5.1.15 → 5.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/modules/excel/utils/col-cache.js +9 -0
- package/dist/browser/modules/excel/worksheet.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +11 -5
- package/dist/cjs/modules/excel/utils/col-cache.js +9 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +11 -5
- package/dist/esm/modules/excel/utils/col-cache.js +9 -0
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +11 -5
- package/dist/iife/excelts.iife.js +15 -6
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +3 -3
- package/dist/types/modules/excel/worksheet.d.ts +1 -0
- package/package.json +1 -1
|
@@ -119,6 +119,9 @@ const colCache = {
|
|
|
119
119
|
},
|
|
120
120
|
// convert address string into structure
|
|
121
121
|
decodeAddress(value) {
|
|
122
|
+
if (!value || typeof value !== "string") {
|
|
123
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
124
|
+
}
|
|
122
125
|
const addr = value.length < 5 && this._hash[value];
|
|
123
126
|
if (addr) {
|
|
124
127
|
return addr;
|
|
@@ -187,6 +190,9 @@ const colCache = {
|
|
|
187
190
|
},
|
|
188
191
|
// convert [address], [tl:br] into address structures
|
|
189
192
|
decode(value) {
|
|
193
|
+
if (!value || typeof value !== "string") {
|
|
194
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
195
|
+
}
|
|
190
196
|
const parts = value.split(":");
|
|
191
197
|
if (parts.length === 2) {
|
|
192
198
|
const tl = this.decodeAddress(parts[0]);
|
|
@@ -210,6 +216,9 @@ const colCache = {
|
|
|
210
216
|
},
|
|
211
217
|
// convert [sheetName!][$]col[$]row[[$]col[$]row] into address or range structures
|
|
212
218
|
decodeEx(value) {
|
|
219
|
+
if (!value || typeof value !== "string") {
|
|
220
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
221
|
+
}
|
|
213
222
|
// Use possessive quantifiers to prevent catastrophic backtracking (ReDoS)
|
|
214
223
|
const groups = value.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/);
|
|
215
224
|
const sheetName = groups[1] || groups[2]; // Quoted and unquoted groups
|
|
@@ -43,9 +43,11 @@ class WorkbookXform extends BaseXform {
|
|
|
43
43
|
if (sheet.pageSetup && sheet.pageSetup.printArea) {
|
|
44
44
|
sheet.pageSetup.printArea.split("&&").forEach((printArea) => {
|
|
45
45
|
const printAreaComponents = printArea.split(":");
|
|
46
|
+
const start = printAreaComponents[0];
|
|
47
|
+
const end = printAreaComponents[1] ?? start;
|
|
46
48
|
const definedName = {
|
|
47
49
|
name: "_xlnm.Print_Area",
|
|
48
|
-
ranges: [`'${sheet.name}'!$${
|
|
50
|
+
ranges: [`'${sheet.name}'!$${start}:$${end}`],
|
|
49
51
|
localSheetId: index
|
|
50
52
|
};
|
|
51
53
|
printAreas.push(definedName);
|
|
@@ -56,11 +58,15 @@ class WorkbookXform extends BaseXform {
|
|
|
56
58
|
const ranges = [];
|
|
57
59
|
if (sheet.pageSetup.printTitlesColumn) {
|
|
58
60
|
const titlesColumns = sheet.pageSetup.printTitlesColumn.split(":");
|
|
59
|
-
|
|
61
|
+
const start = titlesColumns[0];
|
|
62
|
+
const end = titlesColumns[1] ?? start;
|
|
63
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
60
64
|
}
|
|
61
65
|
if (sheet.pageSetup.printTitlesRow) {
|
|
62
66
|
const titlesRows = sheet.pageSetup.printTitlesRow.split(":");
|
|
63
|
-
|
|
67
|
+
const start = titlesRows[0];
|
|
68
|
+
const end = titlesRows[1] ?? start;
|
|
69
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
64
70
|
}
|
|
65
71
|
const definedName = {
|
|
66
72
|
name: "_xlnm.Print_Titles",
|
|
@@ -186,7 +192,7 @@ class WorkbookXform extends BaseXform {
|
|
|
186
192
|
model.definedNames.forEach((definedName) => {
|
|
187
193
|
if (definedName.name === "_xlnm.Print_Area") {
|
|
188
194
|
worksheet = worksheets[definedName.localSheetId];
|
|
189
|
-
if (worksheet) {
|
|
195
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
190
196
|
if (!worksheet.pageSetup) {
|
|
191
197
|
worksheet.pageSetup = {};
|
|
192
198
|
}
|
|
@@ -198,7 +204,7 @@ class WorkbookXform extends BaseXform {
|
|
|
198
204
|
}
|
|
199
205
|
else if (definedName.name === "_xlnm.Print_Titles") {
|
|
200
206
|
worksheet = worksheets[definedName.localSheetId];
|
|
201
|
-
if (worksheet) {
|
|
207
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
202
208
|
if (!worksheet.pageSetup) {
|
|
203
209
|
worksheet.pageSetup = {};
|
|
204
210
|
}
|
|
@@ -122,6 +122,9 @@ const colCache = {
|
|
|
122
122
|
},
|
|
123
123
|
// convert address string into structure
|
|
124
124
|
decodeAddress(value) {
|
|
125
|
+
if (!value || typeof value !== "string") {
|
|
126
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
127
|
+
}
|
|
125
128
|
const addr = value.length < 5 && this._hash[value];
|
|
126
129
|
if (addr) {
|
|
127
130
|
return addr;
|
|
@@ -190,6 +193,9 @@ const colCache = {
|
|
|
190
193
|
},
|
|
191
194
|
// convert [address], [tl:br] into address structures
|
|
192
195
|
decode(value) {
|
|
196
|
+
if (!value || typeof value !== "string") {
|
|
197
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
198
|
+
}
|
|
193
199
|
const parts = value.split(":");
|
|
194
200
|
if (parts.length === 2) {
|
|
195
201
|
const tl = this.decodeAddress(parts[0]);
|
|
@@ -213,6 +219,9 @@ const colCache = {
|
|
|
213
219
|
},
|
|
214
220
|
// convert [sheetName!][$]col[$]row[[$]col[$]row] into address or range structures
|
|
215
221
|
decodeEx(value) {
|
|
222
|
+
if (!value || typeof value !== "string") {
|
|
223
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
224
|
+
}
|
|
216
225
|
// Use possessive quantifiers to prevent catastrophic backtracking (ReDoS)
|
|
217
226
|
const groups = value.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/);
|
|
218
227
|
const sheetName = groups[1] || groups[2]; // Quoted and unquoted groups
|
|
@@ -46,9 +46,11 @@ class WorkbookXform extends base_xform_1.BaseXform {
|
|
|
46
46
|
if (sheet.pageSetup && sheet.pageSetup.printArea) {
|
|
47
47
|
sheet.pageSetup.printArea.split("&&").forEach((printArea) => {
|
|
48
48
|
const printAreaComponents = printArea.split(":");
|
|
49
|
+
const start = printAreaComponents[0];
|
|
50
|
+
const end = printAreaComponents[1] ?? start;
|
|
49
51
|
const definedName = {
|
|
50
52
|
name: "_xlnm.Print_Area",
|
|
51
|
-
ranges: [`'${sheet.name}'!$${
|
|
53
|
+
ranges: [`'${sheet.name}'!$${start}:$${end}`],
|
|
52
54
|
localSheetId: index
|
|
53
55
|
};
|
|
54
56
|
printAreas.push(definedName);
|
|
@@ -59,11 +61,15 @@ class WorkbookXform extends base_xform_1.BaseXform {
|
|
|
59
61
|
const ranges = [];
|
|
60
62
|
if (sheet.pageSetup.printTitlesColumn) {
|
|
61
63
|
const titlesColumns = sheet.pageSetup.printTitlesColumn.split(":");
|
|
62
|
-
|
|
64
|
+
const start = titlesColumns[0];
|
|
65
|
+
const end = titlesColumns[1] ?? start;
|
|
66
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
63
67
|
}
|
|
64
68
|
if (sheet.pageSetup.printTitlesRow) {
|
|
65
69
|
const titlesRows = sheet.pageSetup.printTitlesRow.split(":");
|
|
66
|
-
|
|
70
|
+
const start = titlesRows[0];
|
|
71
|
+
const end = titlesRows[1] ?? start;
|
|
72
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
67
73
|
}
|
|
68
74
|
const definedName = {
|
|
69
75
|
name: "_xlnm.Print_Titles",
|
|
@@ -189,7 +195,7 @@ class WorkbookXform extends base_xform_1.BaseXform {
|
|
|
189
195
|
model.definedNames.forEach((definedName) => {
|
|
190
196
|
if (definedName.name === "_xlnm.Print_Area") {
|
|
191
197
|
worksheet = worksheets[definedName.localSheetId];
|
|
192
|
-
if (worksheet) {
|
|
198
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
193
199
|
if (!worksheet.pageSetup) {
|
|
194
200
|
worksheet.pageSetup = {};
|
|
195
201
|
}
|
|
@@ -201,7 +207,7 @@ class WorkbookXform extends base_xform_1.BaseXform {
|
|
|
201
207
|
}
|
|
202
208
|
else if (definedName.name === "_xlnm.Print_Titles") {
|
|
203
209
|
worksheet = worksheets[definedName.localSheetId];
|
|
204
|
-
if (worksheet) {
|
|
210
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
205
211
|
if (!worksheet.pageSetup) {
|
|
206
212
|
worksheet.pageSetup = {};
|
|
207
213
|
}
|
|
@@ -119,6 +119,9 @@ const colCache = {
|
|
|
119
119
|
},
|
|
120
120
|
// convert address string into structure
|
|
121
121
|
decodeAddress(value) {
|
|
122
|
+
if (!value || typeof value !== "string") {
|
|
123
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
124
|
+
}
|
|
122
125
|
const addr = value.length < 5 && this._hash[value];
|
|
123
126
|
if (addr) {
|
|
124
127
|
return addr;
|
|
@@ -187,6 +190,9 @@ const colCache = {
|
|
|
187
190
|
},
|
|
188
191
|
// convert [address], [tl:br] into address structures
|
|
189
192
|
decode(value) {
|
|
193
|
+
if (!value || typeof value !== "string") {
|
|
194
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
195
|
+
}
|
|
190
196
|
const parts = value.split(":");
|
|
191
197
|
if (parts.length === 2) {
|
|
192
198
|
const tl = this.decodeAddress(parts[0]);
|
|
@@ -210,6 +216,9 @@ const colCache = {
|
|
|
210
216
|
},
|
|
211
217
|
// convert [sheetName!][$]col[$]row[[$]col[$]row] into address or range structures
|
|
212
218
|
decodeEx(value) {
|
|
219
|
+
if (!value || typeof value !== "string") {
|
|
220
|
+
throw new Error(`Invalid Address: ${value}`);
|
|
221
|
+
}
|
|
213
222
|
// Use possessive quantifiers to prevent catastrophic backtracking (ReDoS)
|
|
214
223
|
const groups = value.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/);
|
|
215
224
|
const sheetName = groups[1] || groups[2]; // Quoted and unquoted groups
|
|
@@ -43,9 +43,11 @@ class WorkbookXform extends BaseXform {
|
|
|
43
43
|
if (sheet.pageSetup && sheet.pageSetup.printArea) {
|
|
44
44
|
sheet.pageSetup.printArea.split("&&").forEach((printArea) => {
|
|
45
45
|
const printAreaComponents = printArea.split(":");
|
|
46
|
+
const start = printAreaComponents[0];
|
|
47
|
+
const end = printAreaComponents[1] ?? start;
|
|
46
48
|
const definedName = {
|
|
47
49
|
name: "_xlnm.Print_Area",
|
|
48
|
-
ranges: [`'${sheet.name}'!$${
|
|
50
|
+
ranges: [`'${sheet.name}'!$${start}:$${end}`],
|
|
49
51
|
localSheetId: index
|
|
50
52
|
};
|
|
51
53
|
printAreas.push(definedName);
|
|
@@ -56,11 +58,15 @@ class WorkbookXform extends BaseXform {
|
|
|
56
58
|
const ranges = [];
|
|
57
59
|
if (sheet.pageSetup.printTitlesColumn) {
|
|
58
60
|
const titlesColumns = sheet.pageSetup.printTitlesColumn.split(":");
|
|
59
|
-
|
|
61
|
+
const start = titlesColumns[0];
|
|
62
|
+
const end = titlesColumns[1] ?? start;
|
|
63
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
60
64
|
}
|
|
61
65
|
if (sheet.pageSetup.printTitlesRow) {
|
|
62
66
|
const titlesRows = sheet.pageSetup.printTitlesRow.split(":");
|
|
63
|
-
|
|
67
|
+
const start = titlesRows[0];
|
|
68
|
+
const end = titlesRows[1] ?? start;
|
|
69
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
64
70
|
}
|
|
65
71
|
const definedName = {
|
|
66
72
|
name: "_xlnm.Print_Titles",
|
|
@@ -186,7 +192,7 @@ class WorkbookXform extends BaseXform {
|
|
|
186
192
|
model.definedNames.forEach((definedName) => {
|
|
187
193
|
if (definedName.name === "_xlnm.Print_Area") {
|
|
188
194
|
worksheet = worksheets[definedName.localSheetId];
|
|
189
|
-
if (worksheet) {
|
|
195
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
190
196
|
if (!worksheet.pageSetup) {
|
|
191
197
|
worksheet.pageSetup = {};
|
|
192
198
|
}
|
|
@@ -198,7 +204,7 @@ class WorkbookXform extends BaseXform {
|
|
|
198
204
|
}
|
|
199
205
|
else if (definedName.name === "_xlnm.Print_Titles") {
|
|
200
206
|
worksheet = worksheets[definedName.localSheetId];
|
|
201
|
-
if (worksheet) {
|
|
207
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
202
208
|
if (!worksheet.pageSetup) {
|
|
203
209
|
worksheet.pageSetup = {};
|
|
204
210
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v5.1.
|
|
2
|
+
* @cj-tech-master/excelts v5.1.16
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2026 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
@@ -107,6 +107,7 @@ var ExcelTS = (function(exports) {
|
|
|
107
107
|
return true;
|
|
108
108
|
},
|
|
109
109
|
decodeAddress(value) {
|
|
110
|
+
if (!value || typeof value !== "string") throw new Error(`Invalid Address: ${value}`);
|
|
110
111
|
const addr = value.length < 5 && this._hash[value];
|
|
111
112
|
if (addr) return addr;
|
|
112
113
|
let hasCol = false;
|
|
@@ -151,6 +152,7 @@ var ExcelTS = (function(exports) {
|
|
|
151
152
|
return this.decodeAddress(r);
|
|
152
153
|
},
|
|
153
154
|
decode(value) {
|
|
155
|
+
if (!value || typeof value !== "string") throw new Error(`Invalid Address: ${value}`);
|
|
154
156
|
const parts = value.split(":");
|
|
155
157
|
if (parts.length === 2) {
|
|
156
158
|
const tl = this.decodeAddress(parts[0]);
|
|
@@ -172,6 +174,7 @@ var ExcelTS = (function(exports) {
|
|
|
172
174
|
return this.decodeAddress(value);
|
|
173
175
|
},
|
|
174
176
|
decodeEx(value) {
|
|
177
|
+
if (!value || typeof value !== "string") throw new Error(`Invalid Address: ${value}`);
|
|
175
178
|
const groups = value.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/);
|
|
176
179
|
const sheetName = groups[1] || groups[2];
|
|
177
180
|
const reference = groups[3];
|
|
@@ -11351,9 +11354,11 @@ var ExcelTS = (function(exports) {
|
|
|
11351
11354
|
model.sheets.forEach((sheet) => {
|
|
11352
11355
|
if (sheet.pageSetup && sheet.pageSetup.printArea) sheet.pageSetup.printArea.split("&&").forEach((printArea) => {
|
|
11353
11356
|
const printAreaComponents = printArea.split(":");
|
|
11357
|
+
const start = printAreaComponents[0];
|
|
11358
|
+
const end = printAreaComponents[1] ?? start;
|
|
11354
11359
|
const definedName = {
|
|
11355
11360
|
name: "_xlnm.Print_Area",
|
|
11356
|
-
ranges: [`'${sheet.name}'!$${
|
|
11361
|
+
ranges: [`'${sheet.name}'!$${start}:$${end}`],
|
|
11357
11362
|
localSheetId: index
|
|
11358
11363
|
};
|
|
11359
11364
|
printAreas.push(definedName);
|
|
@@ -11362,11 +11367,15 @@ var ExcelTS = (function(exports) {
|
|
|
11362
11367
|
const ranges = [];
|
|
11363
11368
|
if (sheet.pageSetup.printTitlesColumn) {
|
|
11364
11369
|
const titlesColumns = sheet.pageSetup.printTitlesColumn.split(":");
|
|
11365
|
-
|
|
11370
|
+
const start = titlesColumns[0];
|
|
11371
|
+
const end = titlesColumns[1] ?? start;
|
|
11372
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
11366
11373
|
}
|
|
11367
11374
|
if (sheet.pageSetup.printTitlesRow) {
|
|
11368
11375
|
const titlesRows = sheet.pageSetup.printTitlesRow.split(":");
|
|
11369
|
-
|
|
11376
|
+
const start = titlesRows[0];
|
|
11377
|
+
const end = titlesRows[1] ?? start;
|
|
11378
|
+
ranges.push(`'${sheet.name}'!$${start}:$${end}`);
|
|
11370
11379
|
}
|
|
11371
11380
|
const definedName = {
|
|
11372
11381
|
name: "_xlnm.Print_Titles",
|
|
@@ -11459,14 +11468,14 @@ var ExcelTS = (function(exports) {
|
|
|
11459
11468
|
if (model.definedNames) model.definedNames.forEach((definedName) => {
|
|
11460
11469
|
if (definedName.name === "_xlnm.Print_Area") {
|
|
11461
11470
|
worksheet = worksheets[definedName.localSheetId];
|
|
11462
|
-
if (worksheet) {
|
|
11471
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
11463
11472
|
if (!worksheet.pageSetup) worksheet.pageSetup = {};
|
|
11464
11473
|
const range = colCache.decodeEx(definedName.ranges[0]);
|
|
11465
11474
|
worksheet.pageSetup.printArea = worksheet.pageSetup.printArea ? `${worksheet.pageSetup.printArea}&&${range.dimensions}` : range.dimensions;
|
|
11466
11475
|
}
|
|
11467
11476
|
} else if (definedName.name === "_xlnm.Print_Titles") {
|
|
11468
11477
|
worksheet = worksheets[definedName.localSheetId];
|
|
11469
|
-
if (worksheet) {
|
|
11478
|
+
if (worksheet && definedName.ranges?.length > 0) {
|
|
11470
11479
|
if (!worksheet.pageSetup) worksheet.pageSetup = {};
|
|
11471
11480
|
const rangeString = definedName.ranges.join(",");
|
|
11472
11481
|
const dollarRegex = /\$/g;
|