diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php index f28fb74ad..5028f9cca 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php @@ -348,14 +348,13 @@ protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $is // c:strRef / c:numRef $referenceType = ($isReference ? 'Ref' : 'Lit'); - // Get data type from first non-null value - $dataType = array_reduce($values, function ($carry, $item) { - if (!isset($item)) { - return $carry; + // Data type is num unless one of the values is non-numeric + $dataType = 'num'; + foreach ($values as $value){ + if (!is_numeric($value)){ + $dataType = 'str'; } - - return is_numeric($item) ? 'num' : 'str'; - }, 'num'); + } $objWriter->startElement('c:' . $dataType . $referenceType);