public function removeSlideByIndex($index = 0) { if ($index > count($this->slideCollection) - 1) { throw new \Exception("Slide index is out of bounds."); } else { array_splice($this->slideCollection, $index, 1); } return $this; }
/** * 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; }