Fix "Xlsx::getArrayItem(): Node no longer exists" issue (#931)

This commit is contained in:
Alex 2019-04-15 22:35:17 +03:00 committed by Mark Baker
parent 25c7187727
commit dfd9c5bb3e
1 changed files with 10 additions and 8 deletions

View File

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