mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: Add API route to export modified gammes data to an Excel file.
This commit is contained in:
1 parent
7cdbe8ec21
commit
41a8b32aff
1 file changed
+4
-4
@@ -38,7 +38,7 @@ export async function POST(req: NextRequest) {
|
||||
|
||||
sheet.columns = [
|
||||
{ header: "CODE FOURNISSEUR", key: "codeFournisseur", width: 22 },
|
||||
{ header: "GENCOD", key: "gtin", width: 18 },
|
||||
{ header: "CODEIN", key: "codein", width: 18 },
|
||||
{ header: "GAMME", key: "gamme", width: 12 },
|
||||
];
|
||||
|
||||
@@ -49,7 +49,7 @@ export async function POST(req: NextRequest) {
|
||||
for (const row of changes) {
|
||||
sheet.addRow({
|
||||
codeFournisseur: row.codeFournisseur || "—",
|
||||
gtin: row.gtin || "—",
|
||||
codein: row.codein || "—",
|
||||
gamme: row.gamme || "—",
|
||||
});
|
||||
}
|
||||
@@ -58,9 +58,9 @@ export async function POST(req: NextRequest) {
|
||||
const gammeCol = sheet.getColumn("gamme");
|
||||
gammeCol.alignment = { horizontal: "center" };
|
||||
|
||||
// Format codein et gtin en texte pour eviter la notation scientifique excel
|
||||
// Format en texte pour eviter la notation scientifique excel
|
||||
sheet.getColumn("codeFournisseur").numFmt = "@";
|
||||
sheet.getColumn("gtin").numFmt = "@";
|
||||
sheet.getColumn("codein").numFmt = "@";
|
||||
|
||||
// Generate buffer
|
||||
const buffer = await workbook.xlsx.writeBuffer();
|
||||
|
||||
Reference in new issue
Block a user