2

I created a chart using PHPExcel library and enabled percentage value :

 $layout1->setShowPercent(TRUE); 

but percentage doesn't show decimal values.

Example: 0.33% is shown as 0% like here :

Percentage error image

How can I fix it?

akmozo
  • 9,829
  • 3
  • 28
  • 44
Rathilesh C
  • 131
  • 2
  • 14

1 Answers1

1
$objPHPExcel->getActiveSheet()->getStyle('A1')
    ->getNumberFormat()->applyFromArray( 
    array( 
        'code' => PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
    )
);

not sure if this will apply

PHPExcel Formats

Community
  • 1
  • 1
Severino Lorilla Jr.
  • 1,637
  • 4
  • 20
  • 33
  • Not working... :(, after appliying this code, the value was changed 2 to 200.00%, i want to change percentage display format only, not value – Rathilesh C May 03 '16 at 09:26
  • @RathileshChundaran - technically, that isn't a value change.... try setting a cell value as `2` and then applying a percentage format in MS Excel itself – Mark Baker May 03 '16 at 14:05