Skip to content

Commit

Permalink
Fix "Xlsx::getArrayItem(): Node no longer exists" issue (PHPOffice#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
azurre authored and guillaume-ro-fr committed Jun 12, 2019
1 parent e44995c commit 2a2c8e0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/PhpSpreadsheet/Reader/Xlsx.php
Original file line number Diff line number Diff line change
Expand Up @@ -1667,12 +1667,13 @@ public function load($pFilename)
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), 'blurRad')));
$shadow->setDistance(Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), 'dist')));
$shadow->setBlurRadius(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'blurRad')));
$shadow->setDistance(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'dist')));
$shadow->setDirection(Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), 'dir')));
$shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), 'algn'));
$shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), 'val'));
$shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), 'val') / 1000);
$clr = isset($outerShdw->srgbClr) ? $outerShdw->srgbClr : $outerShdw->prstClr;
$shadow->getColor()->setRGB(self::getArrayItem($clr->attributes(), 'val'));
$shadow->setAlpha(self::getArrayItem($clr->alpha->attributes(), 'val') / 1000);
}

$this->readHyperLinkDrawing($objDrawing, $oneCellAnchor, $hyperlinks);
Expand Down Expand Up @@ -1719,12 +1720,13 @@ public function load($pFilename)
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), 'blurRad')));
$shadow->setDistance(Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), 'dist')));
$shadow->setBlurRadius(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'blurRad')));
$shadow->setDistance(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'dist')));
$shadow->setDirection(Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), 'dir')));
$shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), 'algn'));
$shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), 'val'));
$shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), 'val') / 1000);
$clr = isset($outerShdw->srgbClr) ? $outerShdw->srgbClr : $outerShdw->prstClr;
$shadow->getColor()->setRGB(self::getArrayItem($clr->attributes(), 'val'));
$shadow->setAlpha(self::getArrayItem($clr->alpha->attributes(), 'val') / 1000);
}

$this->readHyperLinkDrawing($objDrawing, $twoCellAnchor, $hyperlinks);
Expand Down

0 comments on commit 2a2c8e0

Please sign in to comment.