phpxlsxwriter insert multiple font style on one cell

1.8k views Asked by At

I need to write row consist of 7 columns to excel and apply two types of font styles, bold and underline on second column only. So, I inserted two styles in array,

array('font-style'=>'bold','font-style'=>'underline')

But, only font-style underline applied in output file.

include_once("vendor/mk-j/php_xlsxwriter/xlsxwriter.class.php");
$writer = new XLSXWriter();
$style_8=array(['halign'=>'right'],array('font-style'=>'bold','font-style'=>'underline'),['halign'=>'right'],['halign'=>'right'],['halign'=>'right'],['halign'=>'right'],['halign'=>'right']);
$writer->writeSheetRow('Sheet1', $rowdata = array('','Amount','','','100.00','','200.00'),$style_8);
1

There are 1 answers

0
Premlatha On BEST ANSWER

Since bold and underline from the same category that is font-style,need to write like this

 ['font-style'=>'bold,underline']

by add to the same key.

 $style_8=array(['halign'=>'right'], ['font-style'=>'bold,underline'],['halign'=>'right'],['halign'=>'right'],['halign'=>'right'],['halign'=>'right'],['halign'=>'right']);