Estoy buscando horas en el documento pero no tengo nada para fusionar y centrar horizontalmente.
alguien me puede ayudar como hacer esto?
mi último código:
$spreadsheet = new Spreadsheet(); $excel = $spreadsheet->getActiveSheet(); $spreadsheet->getProperties()->setTitle($name_sheet)->setCreator('Creator'); $excel->mergeCells('A1:W1'); $excel->mergeCells('A2:W2'); $excel->mergeCells('A3:W3'); //how to make cells A1 till W1 to be centered cell?Así es como centré todas las celdas y formateé todos los bordes.
$last_row = count($data) + 6;
$sheet->getStyle('A5:Y' . $last_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
$sheet->getStyle('A5:Y' . $last_row)->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
$borders = [
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '000'],
],
],
];
$sheet->getStyle('A5:Y' . $last_row)->applyFromArray($borders);