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

@@ -372,16 +372,8 @@ async function createExcelAndDownload({ bizLogic, api, excelName, exportName })
showError(true, '帳票出力エラー\n - ' + e);
return;
}
const buffer = await workbook.xlsx.writeBuffer();
saveFile(buffer, exportName);
}
function saveFile(buffer, fileName) {
const blob = new Blob([buffer], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
});
saveAs(blob, fileName);
const blob = await pvc.lib.exceljsUtil.saveWorkbookToBlob(workbook);
saveAs(blob, exportName);
}
async function getTemplateBuffer(api, excelName) {
@@ -413,7 +405,6 @@ function findCellsInfo(worksheet, ids) {
result[value].push({
row: rowNumber,
col: colNumber,
value
});
}
lastColVal = value;
@@ -436,3 +427,20 @@ function getLabelColsMapping(worksheet, row, fields) {
}
return changedIndices;
}
function createCopyFromTemplate(worksheet, { startPage,
totalPages,
copyPageRowStart,
copyPageRowEnd,
callback }) {
const rowCount = copyPageRowEnd - copyPageRowStart + 1;
let newPageRow = copyPageRowEnd + 1;
for (let p = startPage; p <= totalPages; p++) {
const copyRow = pvc.lib.exceljsUtil.copyRows(worksheet, copyPageRowStart, copyPageRowEnd);
pvc.lib.exceljsUtil.insertRows(worksheet, newPageRow, copyRow);
newPageRow += rowCount;
callback(p, rowCount);
}
}