/** * @param SchemeColor $schemeColor * @return $this */ public function addSchemeColor(SchemeColor $schemeColor) { $this->arraySchemeColor[$schemeColor->getValue()] = $schemeColor; return $this; }
/** * @param XMLReader $xmlReader * @param \DOMElement $oElement * @param AbstractSlide $oSlide */ private function loadSlideBackground(XMLReader $xmlReader, \DOMElement $oElement, AbstractSlide $oSlide) { // Background color $oElementColor = $xmlReader->getElement('p:bgPr/a:solidFill/a:srgbClr', $oElement); if ($oElementColor) { // Color $oColor = new Color(); $oColor->setRGB($oElementColor->hasAttribute('val') ? $oElementColor->getAttribute('val') : null); // Background $oBackground = new \PhpOffice\PhpPresentation\Slide\Background\Color(); $oBackground->setColor($oColor); // Slide Background $oSlide->setBackground($oBackground); } // Background scheme color $oElementSchemeColor = $xmlReader->getElement('p:bgRef/a:schemeClr', $oElement); if ($oElementSchemeColor) { // Color $oColor = new SchemeColor(); $oColor->setValue($oElementSchemeColor->hasAttribute('val') ? $oElementSchemeColor->getAttribute('val') : null); // Background $oBackground = new \PhpOffice\PhpPresentation\Slide\Background\SchemeColor(); $oBackground->setSchemeColor($oColor); // Slide Background $oSlide->setBackground($oBackground); } // Background image $oElementImage = $xmlReader->getElement('p:bgPr/a:blipFill/a:blip', $oElement); if ($oElementImage) { $relImg = $this->arrayRels[$oSlide->getRelsIndex()][$oElementImage->getAttribute('r:embed')]; if (is_array($relImg)) { // File $pathImage = 'ppt/slides/' . $relImg['Target']; $pathImage = explode('/', $pathImage); foreach ($pathImage as $key => $partPath) { if ($partPath == '..') { unset($pathImage[$key - 1]); unset($pathImage[$key]); } } $pathImage = implode('/', $pathImage); $contentImg = $this->oZip->getFromName($pathImage); $tmpBkgImg = tempnam(sys_get_temp_dir(), 'PhpPresentationReaderPpt2007Bkg'); file_put_contents($tmpBkgImg, $contentImg); // Background $oBackground = new Image(); $oBackground->setPath($tmpBkgImg); // Slide Background $oSlide->setBackground($oBackground); } } }