update column marhun

This commit is contained in:
Nur Izzati
2026-03-11 14:00:55 +08:00
parent a3ad23c48c
commit 4c8427af48
+13 -4
View File
@@ -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,10 +146,15 @@ 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) {
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 [];
}