I've to make an excel export from working hours. So, the hours on a week can be greater than 24 hours.
In order to display this time, I make the calcul via a function:
str_pad(((int)$interval->format("%h") (int)$interval->format("%d") * 24), 2, "0", STR_PAD_LEFT) . ':' . str_pad($interval->format('%i'), 2, "0", STR_PAD_LEFT)
Where $interval is a DateInterval. Then, I simply apply my result inside my cell :
$sheet->setCellValueByColumnAndRow($myColumn, $myLine, $myRes);
The result inside the sheet is cell is correct but if I click on my cell, I can see that a quote is at the beginning of my value (eg: $myValue = 38:40, content of my cell = '38:40) and the cell's content is not align on the right like the other value which are inferior to 24h.
I tried a lot of things :
use the TEXT() function => don't work properly (display 00:00 and when I copy/paste the formula it work)
format the cell's content :
$sheet->getStyleByColumnAndRow($myColumn, $myLine) ->getNumberFormat() ->setFormatCode('[h]:mm');
to add the seconds at the end
Anyone has encouter the same problem ? Any help/advice would be appreciate :)
Red: KO Green: OK the difference between the two is that the green is a =SUM(A1:G1) formula
CodePudding user response: