@@ -745,7 +745,7 @@ public function calculateColumnWidths(): static
745
745
// Calculated value
746
746
// To formatted string
747
747
$ cellValue = NumberFormat::toFormattedString (
748
- $ cell ->getCalculatedValue (),
748
+ $ cell ->getCalculatedValueString (),
749
749
(string ) $ this ->getParentOrThrow ()->getCellXfByIndex ($ cell ->getXfIndex ())
750
750
->getNumberFormat ()->getFormatCode (true )
751
751
);
@@ -2795,6 +2795,8 @@ public function fromArray(array $source, mixed $nullValue = null, string $startC
2795
2795
}
2796
2796
2797
2797
/**
2798
+ * @param null|bool|float|int|RichText|string $nullValue value to use when null
2799
+ *
2798
2800
* @throws Exception
2799
2801
* @throws \PhpOffice\PhpSpreadsheet\Calculation\Exception
2800
2802
*/
@@ -2811,8 +2813,10 @@ protected function cellToArray(Cell $cell, bool $calculateFormulas, bool $format
2811
2813
2812
2814
if ($ formatData ) {
2813
2815
$ style = $ this ->getParentOrThrow ()->getCellXfByIndex ($ cell ->getXfIndex ());
2816
+ /** @var null|bool|float|int|RichText|string */
2817
+ $ returnValuex = $ returnValue ;
2814
2818
$ returnValue = NumberFormat::toFormattedString (
2815
- $ returnValue ,
2819
+ $ returnValuex ,
2816
2820
$ style ->getNumberFormat ()->getFormatCode () ?? NumberFormat::FORMAT_GENERAL
2817
2821
);
2818
2822
}
@@ -2824,7 +2828,7 @@ protected function cellToArray(Cell $cell, bool $calculateFormulas, bool $format
2824
2828
/**
2825
2829
* Create array from a range of cells.
2826
2830
*
2827
- * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
2831
+ * @param null|bool|float|int|RichText|string $nullValue Value returned in the array entry if a cell doesn't exist
2828
2832
* @param bool $calculateFormulas Should formulas be calculated?
2829
2833
* @param bool $formatData Should formatting be applied to cell values?
2830
2834
* @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
@@ -2854,7 +2858,7 @@ public function rangeToArray(
2854
2858
/**
2855
2859
* Create array from a range of cells, yielding each row in turn.
2856
2860
*
2857
- * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
2861
+ * @param null|bool|float|int|RichText|string $nullValue Value returned in the array entry if a cell doesn't exist
2858
2862
* @param bool $calculateFormulas Should formulas be calculated?
2859
2863
* @param bool $formatData Should formatting be applied to cell values?
2860
2864
* @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
@@ -3002,7 +3006,7 @@ private function validateNamedRange(string $definedName, bool $returnNullIfInval
3002
3006
* Create array from a range of cells.
3003
3007
*
3004
3008
* @param string $definedName The Named Range that should be returned
3005
- * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
3009
+ * @param null|bool|float|int|RichText|string $nullValue Value returned in the array entry if a cell doesn't exist
3006
3010
* @param bool $calculateFormulas Should formulas be calculated?
3007
3011
* @param bool $formatData Should formatting be applied to cell values?
3008
3012
* @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
@@ -3035,7 +3039,7 @@ public function namedRangeToArray(
3035
3039
/**
3036
3040
* Create array from worksheet.
3037
3041
*
3038
- * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
3042
+ * @param null|bool|float|int|RichText|string $nullValue Value returned in the array entry if a cell doesn't exist
3039
3043
* @param bool $calculateFormulas Should formulas be calculated?
3040
3044
* @param bool $formatData Should formatting be applied to cell values?
3041
3045
* @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
@@ -3649,14 +3653,14 @@ public function setBackgroundImage(string $backgroundImage): self
3649
3653
public function copyCells (string $ fromCell , string $ toCells , bool $ copyStyle = true ): void
3650
3654
{
3651
3655
$ toArray = Coordinate::extractAllCellReferencesInRange ($ toCells );
3652
- $ value = $ this ->getCell ($ fromCell )->getValue ();
3656
+ $ valueString = $ this ->getCell ($ fromCell )->getValueString ();
3653
3657
$ style = $ this ->getStyle ($ fromCell )->exportArray ();
3654
3658
$ fromIndexes = Coordinate::indexesFromString ($ fromCell );
3655
3659
$ referenceHelper = ReferenceHelper::getInstance ();
3656
3660
foreach ($ toArray as $ destination ) {
3657
3661
if ($ destination !== $ fromCell ) {
3658
3662
$ toIndexes = Coordinate::indexesFromString ($ destination );
3659
- $ this ->getCell ($ destination )->setValue ($ referenceHelper ->updateFormulaReferences ($ value , 'A1 ' , $ toIndexes [0 ] - $ fromIndexes [0 ], $ toIndexes [1 ] - $ fromIndexes [1 ]));
3663
+ $ this ->getCell ($ destination )->setValue ($ referenceHelper ->updateFormulaReferences ($ valueString , 'A1 ' , $ toIndexes [0 ] - $ fromIndexes [0 ], $ toIndexes [1 ] - $ fromIndexes [1 ]));
3660
3664
if ($ copyStyle ) {
3661
3665
$ this ->getCell ($ destination )->getStyle ()->applyFromArray ($ style );
3662
3666
}
0 commit comments