PhpOffice\PhpPresentation\PhpPresentation::setAllMasterSlides PHP Method

setAllMasterSlides() public method

public setAllMasterSlides ( ArrayObject | SlideMaster[] $slideMasters = [] )
$slideMasters ArrayObject | PhpOffice\PhpPresentation\Slide\SlideMaster[]
    public function setAllMasterSlides($slideMasters = array())
    {
        if ($slideMasters instanceof \ArrayObject || is_array($slideMasters)) {
            $this->slideMasters = $slideMasters;
        }
        return $this;
    }

Usage Example

 /**
  * Load PhpPresentation Serialized file
  *
  * @param  string $pFilename
  * @return \PhpOffice\PhpPresentation\PhpPresentation
  */
 protected function loadFile($pFilename)
 {
     $this->oPhpPresentation = new PhpPresentation();
     $this->oPhpPresentation->removeSlideByIndex();
     $this->oPhpPresentation->setAllMasterSlides(array());
     $this->filename = $pFilename;
     $this->oZip = new ZipArchive();
     $this->oZip->open($this->filename);
     $docPropsCore = $this->oZip->getFromName('docProps/core.xml');
     if ($docPropsCore !== false) {
         $this->loadDocumentProperties($docPropsCore);
     }
     $docPropsCustom = $this->oZip->getFromName('docProps/custom.xml');
     if ($docPropsCustom !== false) {
         $this->loadCustomProperties($docPropsCustom);
     }
     $pptViewProps = $this->oZip->getFromName('ppt/viewProps.xml');
     if ($pptViewProps !== false) {
         $this->loadViewProperties($pptViewProps);
     }
     $pptPresentation = $this->oZip->getFromName('ppt/presentation.xml');
     if ($pptPresentation !== false) {
         $this->loadDocumentLayout($pptPresentation);
         $this->loadSlides($pptPresentation);
     }
     return $this->oPhpPresentation;
 }