Using phpspreadsheet, I want to set white background to the excel cell.
$cells='A1';
$spreadsheet->getActiveSheet()->getStyle($cells)->getFill()-
>setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)-
>getStartColor(' #FFFFFF')->setARGB('#FFFFFF');
This code make cell background black even I set white color rgb value, #FFFFFF.
The result I want,
Thanks in advance.
The symbol '#' not need to be included when specify the ARGB in phpspreadsheet. This one able to set cell background white.
$spreadsheet->getActiveSheet()->getStyle($cells)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ffffff');
$spreadsheet->getActiveSheet()->getStyle('A1:A5')->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ffffff');
Collected from the Internet
Please contact javaer1[email protected] to delete if infringement.
Comments