diff --git a/src/Spout/Writer/ODS/Manager/WorksheetManager.php b/src/Spout/Writer/ODS/Manager/WorksheetManager.php index e5d51c1..345d1fb 100644 --- a/src/Spout/Writer/ODS/Manager/WorksheetManager.php +++ b/src/Spout/Writer/ODS/Manager/WorksheetManager.php @@ -243,7 +243,14 @@ class WorksheetManager implements WorksheetManagerInterface } elseif ($cell->isEmpty()) { $data .= '/>'; } else { - throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue())); + $value = $cell->getValueEvenIfError(); + + $errorMessage = 'Trying to add a value with an unsupported type: ' . \gettype($value); + if (\is_object($value)) { + $errorMessage .= ' (' . \get_class($value) . ' given)'; + } + + throw new InvalidArgumentException($errorMessage); } return $data; diff --git a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php index 6025442..18464b7 100644 --- a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php +++ b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php @@ -246,7 +246,14 @@ EOD; $cellXML = ''; } } else { - throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue())); + $value = $cell->getValueEvenIfError(); + + $errorMessage = 'Trying to add a value with an unsupported type: ' . \gettype($value); + if (\is_object($value)) { + $errorMessage .= ' (' . \get_class($value) . ' given)'; + } + + throw new InvalidArgumentException($errorMessage); } return $cellXML;