im searching for hours in doc but got nothing to merge and horizontal center..
anyone can help me how to do this?
my last code :
$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?
At the begin of your page : use PhpOffice\PhpSpreadsheet\Style\Alignment;
Definition of the center alignment : $excel->getStyle('A1:W1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With