Update index.html
Browse files- index.html +11 -2
index.html
CHANGED
|
@@ -541,16 +541,25 @@ function downloadExcelBuffer(buffer, filename) {
|
|
| 541 |
|
| 542 |
const getCellVal = (r, c) => {
|
| 543 |
let cell = null;
|
| 544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
cell = denseData[r][c];
|
| 546 |
-
}
|
|
|
|
|
|
|
| 547 |
cell = rawSheet[XLSX.utils.encode_cell({ r, c })];
|
| 548 |
}
|
|
|
|
| 549 |
if (!cell) return '';
|
| 550 |
const val = cell.v !== undefined && cell.v !== null ? cell.v : cell.w;
|
| 551 |
return val !== undefined && val !== null ? val.toString().trim() : '';
|
| 552 |
};
|
| 553 |
|
|
|
|
| 554 |
for (let i = 2; i < totalRaw; i++) {
|
| 555 |
processRowValues(
|
| 556 |
getCellVal(i, 0),
|
|
|
|
| 541 |
|
| 542 |
const getCellVal = (r, c) => {
|
| 543 |
let cell = null;
|
| 544 |
+
// 1. SheetJS v0.18.5 dense:true stores rows directly as rawSheet[r][c]
|
| 545 |
+
if (Array.isArray(rawSheet[r]) && rawSheet[r][c]) {
|
| 546 |
+
cell = rawSheet[r][c];
|
| 547 |
+
}
|
| 548 |
+
// 2. Newer SheetJS dense:true stores rows in rawSheet['!data'][r][c]
|
| 549 |
+
else if (denseData && denseData[r] && denseData[r][c]) {
|
| 550 |
cell = denseData[r][c];
|
| 551 |
+
}
|
| 552 |
+
// 3. Standard non-dense SheetJS stores cells as rawSheet['A3']
|
| 553 |
+
else {
|
| 554 |
cell = rawSheet[XLSX.utils.encode_cell({ r, c })];
|
| 555 |
}
|
| 556 |
+
|
| 557 |
if (!cell) return '';
|
| 558 |
const val = cell.v !== undefined && cell.v !== null ? cell.v : cell.w;
|
| 559 |
return val !== undefined && val !== null ? val.toString().trim() : '';
|
| 560 |
};
|
| 561 |
|
| 562 |
+
|
| 563 |
for (let i = 2; i < totalRaw; i++) {
|
| 564 |
processRowValues(
|
| 565 |
getCellVal(i, 0),
|