Skip to content
Discussion options

You must be logged in to vote

the solution is first determine the cell as numeric and that set the formatCode.

$dataType[0] = DataType::TYPE_NUMERIC;
$format[0] = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00;
$sheet->setCellValueExplicit($cell,$innervalue, $dataType[0]);
$sheet->getStyle($cell)->getNumberFormat()->setFormatCode($format[0]);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by saginadav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants