PhpSpreadsheet set background color of cell to white

Premlatha

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,

BEFORE

AFTER

Thanks in advance.

Premlatha

The symbol '#' not need to be included when specify the ARGB in phpspreadsheet. This one able to set cell background white.

cell by cell

$spreadsheet->getActiveSheet()->getStyle($cells)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ffffff');

range of cells

$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.

edited at
0

Comments

0 comments
Login to comment

Related

Is it possible to set ARGB background color to IText PDF cell?

How to set background color of an Activity to white programmatically?

How to set a background color of a Table Cell using iText?

APACHE POI 4.1 : Set cell background color from hex code

how to set background color of a cell using apache pio 4.1.0

JavaFx Set Tableview Cell Background Color Dynamically

Android background color set to gray instead of @android:color/white

set background color for specific cell in markdown table

How to Set the Background Color of a Cell in a MigraDoc Table

Set an automatic color background depending on the HEX value in the cell?

Excel: Set background color of cell and text color with rgb

How to change cell color in PHPSpreadsheet

PHPSpreadsheet - Unable to get Cell Fill Color

Google sheets countif cell not empty AND background color not white

How to set cell background color in grid/table in view in Vaadin?

Cannot set cell value in Phpspreadsheet

Swift 4, Background color goes white when deleting cell

Set background color in table cell

Set cell background color to its containing RGB values. How?

Set background color for a cell specified in JTable

Set background cell color on CListCtrl

JavaFX Set Cell Background Color of TableColumn

Background-color white gets transparent with opacity set to 1

How to set background color of a cell using apache poi 4.1.0

How to set a white background color for a lightbox in Angular?

How to set background color based on cell position?

How set white color background when concatenating images via python?

jetpack compose can't set search bar background color to white

Google Spreadsheets: Group rows by equal cell and set background color for these rows