php - Change text background color for hyper link in PHPExcel


Keywords:php 


Question: 

In my PHPExcel library, I changed the color of hyper link using the below code

$link_style_array = array(
  'font'  => array(
    'color' => array('rgb' => '0000FF'),
    'underline' => 'single'
  )
);
$sheet->getStyle("A1")->applyFromArray($link_style_array);

And it works perfect. But the text have a background color like the below image

enter image description here

I would like to remove the background color or make it white.

Is there any way to do the same? Any help could be appreciated


1 Answer: 

here is the code for change cell color of phpExcel

$phpExcel = new PHPExcel();

$styleArray = array(
'font'  => array(
    'bold'  => false,
    'background-color' => array('rgb' => 'dadada'),
    'size'  => 12,
    'name'  => 'Arial'
));

$phpExcel->getActiveSheet()->getCell('B1')->setValue('Here your text');
$phpExcel->getActiveSheet()->getStyle('B1')->applyFromArray($styleArray);