Update index.html
Browse files- index.html +11 -14
index.html
CHANGED
|
@@ -682,8 +682,7 @@
|
|
| 682 |
progressFill.style.width = '70%';
|
| 683 |
showStatus('weeklyStatusMessage', `Pasting ${cleanDataRows.length.toLocaleString()} clean rows into template preserving exact logo...`, 'info');
|
| 684 |
await sleep(50);
|
| 685 |
-
|
| 686 |
-
// Step 3: Extract template styles and borders from Row 11 (Columns A to E)
|
| 687 |
const templateRow = worksheet.getRow(11);
|
| 688 |
const templateStyles = [];
|
| 689 |
for (let c = 1; c <= 5; c++) {
|
|
@@ -691,20 +690,18 @@
|
|
| 691 |
templateStyles[c] = {
|
| 692 |
font: sampleCell.font ? JSON.parse(JSON.stringify(sampleCell.font)) : undefined,
|
| 693 |
alignment: sampleCell.alignment ? JSON.parse(JSON.stringify(sampleCell.alignment)) : undefined,
|
| 694 |
-
border: sampleCell.border ? JSON.parse(JSON.stringify(sampleCell.border)) : {
|
| 695 |
-
top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' }
|
| 696 |
-
},
|
| 697 |
numFmt: sampleCell.numFmt || undefined
|
| 698 |
};
|
| 699 |
}
|
| 700 |
-
|
| 701 |
-
|
|
|
|
| 702 |
left: { style: 'thin', color: { argb: 'FF000000' } },
|
| 703 |
-
|
| 704 |
-
|
| 705 |
};
|
| 706 |
|
| 707 |
-
// Step 4: Write rows starting at Row 11, applying font, alignment,
|
| 708 |
let startRow = 11;
|
| 709 |
for (let r = 0; r < cleanDataRows.length; r++) {
|
| 710 |
const rowData = cleanDataRows[r];
|
|
@@ -714,16 +711,16 @@
|
|
| 714 |
const cell = row.getCell(c);
|
| 715 |
cell.value = rowData[c - 1];
|
| 716 |
|
| 717 |
-
// Apply font, alignment,
|
| 718 |
const style = templateStyles[c];
|
| 719 |
if (style) {
|
| 720 |
if (style.font) cell.font = style.font;
|
| 721 |
if (style.alignment) cell.alignment = style.alignment;
|
| 722 |
-
cell.border = style.border || defaultBorder;
|
| 723 |
if (style.numFmt) cell.numFmt = style.numFmt;
|
| 724 |
-
} else {
|
| 725 |
-
cell.border = defaultBorder;
|
| 726 |
}
|
|
|
|
|
|
|
|
|
|
| 727 |
}
|
| 728 |
|
| 729 |
row.commit();
|
|
|
|
| 682 |
progressFill.style.width = '70%';
|
| 683 |
showStatus('weeklyStatusMessage', `Pasting ${cleanDataRows.length.toLocaleString()} clean rows into template preserving exact logo...`, 'info');
|
| 684 |
await sleep(50);
|
| 685 |
+
// Step 3: Extract font, alignment, and number format from Row 11
|
|
|
|
| 686 |
const templateRow = worksheet.getRow(11);
|
| 687 |
const templateStyles = [];
|
| 688 |
for (let c = 1; c <= 5; c++) {
|
|
|
|
| 690 |
templateStyles[c] = {
|
| 691 |
font: sampleCell.font ? JSON.parse(JSON.stringify(sampleCell.font)) : undefined,
|
| 692 |
alignment: sampleCell.alignment ? JSON.parse(JSON.stringify(sampleCell.alignment)) : undefined,
|
|
|
|
|
|
|
|
|
|
| 693 |
numFmt: sampleCell.numFmt || undefined
|
| 694 |
};
|
| 695 |
}
|
| 696 |
+
|
| 697 |
+
// Border para sa Row 11 PABABA LANG (Side at Bottom lang para LIGTAS ang Row 1-10)
|
| 698 |
+
const dataRowBorder = {
|
| 699 |
left: { style: 'thin', color: { argb: 'FF000000' } },
|
| 700 |
+
right: { style: 'thin', color: { argb: 'FF000000' } },
|
| 701 |
+
bottom: { style: 'thin', color: { argb: 'FF000000' } }
|
| 702 |
};
|
| 703 |
|
| 704 |
+
// Step 4: Write rows starting at Row 11, applying font, alignment, at borders simula Row 11 pababa (Row 11, 12, 13...)
|
| 705 |
let startRow = 11;
|
| 706 |
for (let r = 0; r < cleanDataRows.length; r++) {
|
| 707 |
const rowData = cleanDataRows[r];
|
|
|
|
| 711 |
const cell = row.getCell(c);
|
| 712 |
cell.value = rowData[c - 1];
|
| 713 |
|
| 714 |
+
// Apply font, alignment, number format, at borders mula Row 11 pababa
|
| 715 |
const style = templateStyles[c];
|
| 716 |
if (style) {
|
| 717 |
if (style.font) cell.font = style.font;
|
| 718 |
if (style.alignment) cell.alignment = style.alignment;
|
|
|
|
| 719 |
if (style.numFmt) cell.numFmt = style.numFmt;
|
|
|
|
|
|
|
| 720 |
}
|
| 721 |
+
|
| 722 |
+
// Nilalagyan ng thin borders ang Row 11, Row 12, Row 13... nang hindi naggagalaw ng Row 1-10 header
|
| 723 |
+
cell.border = dataRowBorder;
|
| 724 |
}
|
| 725 |
|
| 726 |
row.commit();
|