From 4c8427af48ef57186a020a90f6cfd93899a2cd1a Mon Sep 17 00:00:00 2001 From: Nur Izzati Date: Wed, 11 Mar 2026 14:00:55 +0800 Subject: [PATCH] update column marhun --- app/Exports/SAExportAudit.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Exports/SAExportAudit.php b/app/Exports/SAExportAudit.php index b52a876..0ec04fb 100644 --- a/app/Exports/SAExportAudit.php +++ b/app/Exports/SAExportAudit.php @@ -125,15 +125,19 @@ class SAExportAudit implements FromCollection, WithHeadings, WithTitle, WithMapp $sheet->getStyle('A5:K5')->getFont()->setBold(true); - // Border untuk semua data $lastRow = $sheet->getHighestRow(); $lastCol = 'K'; - $sheet->getStyle("A5:{$lastCol}{$lastRow}")->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN); + + // Border untuk semua data + $sheet->getStyle("A5:{$lastCol}{$lastRow}") + ->getBorders() + ->getAllBorders() + ->setBorderStyle(Border::BORDER_THIN); // Bold TOTAL row $sheet->getStyle("A{$lastRow}:{$lastCol}{$lastRow}")->getFont()->setBold(true); - // Align center for some columns + // Align center untuk column tertentu $sheet->getStyle("A5:A{$lastRow}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); $sheet->getStyle("B5:B{$lastRow}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); $sheet->getStyle("C5:C{$lastRow}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); @@ -142,11 +146,16 @@ class SAExportAudit implements FromCollection, WithHeadings, WithTitle, WithMapp // Wrap text untuk semua column $sheet->getStyle("A5:{$lastCol}{$lastRow}")->getAlignment()->setWrapText(true); - // Auto-fit semua column berdasarkan content + // Auto-fit semua column kecuali Marhun foreach (range('A', $lastCol) as $col) { - $sheet->getColumnDimension($col)->setAutoSize(true); + if ($col !== 'D') { // skip Marhun + $sheet->getColumnDimension($col)->setAutoSize(true); + } } + // Untuk column Marhun (D), kita boleh set width minimum supaya tak terlalu besar + $sheet->getColumnDimension('D')->setWidth(18); // boleh adjust ikut perlu + return []; }