php - Change text background color for hyper link in PHPExcel

430

In myPHPExcel 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

72

Answer

Solution:

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);

People are also looking for solutions to the problem: javascript - Redirect only after script Completes it's execution in codeigniter

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.