I'm using PHPSpreadsheet to generate an XLS file with report data, and in some situations, display an XLS formatted as HTML on screen.
How can I display a formatted time range in an Excel worksheet?
I have a range of 25:30
hours that I would like to show using HH:MM:SS format, but if I use the code below it shows as 01:30:00
.
$seconds = 91800;
$spreadsheet->getActiveSheet()->setCellValueExplicit('L' . $row, (seconds / 86400) , PHPExcel_Cell_DataType::TYPE_NUMERIC);
$spreadsheet->getActiveSheet()->getStyle('L'.$row)->getNumberFormat()->setFormatCode('HH:MM:SS');
If I change the time format to [HH]:MM:SS
, the HTML displays a buggy result:
<span style="color:hh">[01]:30:00</span>