This commit is contained in:
2025-02-15 17:59:36 +08:00
parent 82ce762d16
commit 4bcad33a61
2 changed files with 36 additions and 25 deletions

View File

@@ -70,25 +70,28 @@
const pageSize = 10;
const totalPages = Math.ceil(records.length / pageSize);
// make new copy
if (totalPages > 2) {
const lastPage = 2;
const copyPageRowStart = baseCells['月'][lastPage - 1].row - 1;
const copyPageRowEnd = baseCells['児童名'][lastPage - 1].row + pageSize;
const rowCount = copyPageRowEnd - copyPageRowStart + 1;
let newPageRow = copyPageRowEnd + 1;
for (let p = 3; p <= totalPages; p++) {
const copyRow = pvc.lib.exceljsUtil.copyRows(worksheet, copyPageRowStart, copyPageRowEnd);
pvc.lib.exceljsUtil.insertRows(worksheet, newPageRow, copyRow);
newPageRow += rowCount;
['月', '児童名'].forEach((label) => {
const last = baseCells[label][p - 2];
baseCells[label].push({
...last,
row: last.row + rowCount
});
})
}
createCopyFromTemplate(worksheet, {
startPage: lastPage + 1,
totalPages,
copyPageRowStart,
copyPageRowEnd,
callback: (newPage, rowCount) => {
['月', '児童名'].forEach((label) => {
const last = baseCells[label][newPage - lastPage];
baseCells[label].push({
col: last.col,
row: last.row + rowCount
});
})
}
})
}
const cols = getLabelColsMapping(worksheet, baseCells['児童名'][0].row, ['児童名', '子どもの姿', '保育者援助_配慮_環境構成']);