Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge d077e9a into ab973ca
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronicLogic authored Dec 12, 2020
2 parents ab973ca + d077e9a commit 56402f6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Spout/Writer/XLSX/Manager/WorksheetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ private function getCellXML($rowIndexOneBased, $columnIndexZeroBased, Cell $cell

if ($cell->isString()) {
$cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue());
} elseif ($cell->isDate()) {
$cellXML .= ' t="d"><v>' . ($cell->getValue()->format(\DateTime::ATOM)) . '</v></c>';
} elseif ($cell->isBoolean()) {
$cellXML .= ' t="b"><v>' . (int) ($cell->getValue()) . '</v></c>';
} elseif ($cell->isNumeric()) {
Expand Down

2 comments on commit 56402f6

@ChronicLogic
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have noted, this issue is similar to the one described by [PR #765 Add support for writing date cells Oded Arbel avatar Oded Arbel] on the box/spout master except that PR addressed ODS files and this one addresses XLSX files. I (still) did not look at the code change of PR 765, I made my change independently and only noticed PR 765 after. One should probably look at both of them and integrate both at once.

@guss77
Copy link
Contributor

@guss77 guss77 commented on 56402f6 Jan 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChronicLogic, please note that $cell->getValue() may return an object of type DateInterval - in which case format(DateTime::ATOM) will result in the unhelpful string value "Y-m-d\TH:i:sP". I'm not sure if XSLX has support for time intervals, but otherwise I recommend handling this by throwing an exception so that the caller knows they used an unsupported feature and won't have a nasty surprise later.

Please sign in to comment.