Remove slide by index
public removeSlideByIndex ( integer $index ) : |
||
$index | integer | Slide index |
Résultat |
/** * 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; }
/** * Load PhpPresentation Serialized file * * @param string $pFilename * @return \PhpOffice\PhpPresentation\PhpPresentation */ protected function loadFile($pFilename) { $this->oPhpPresentation = new PhpPresentation(); $this->oPhpPresentation->removeSlideByIndex(); $this->oZip = new ZipArchive(); $this->oZip->open($pFilename); $docPropsCore = $this->oZip->getFromName('docProps/core.xml'); if ($docPropsCore !== false) { $this->loadDocumentProperties($docPropsCore); } $pptPresentation = $this->oZip->getFromName('ppt/presentation.xml'); if ($pptPresentation !== false) { $this->loadSlides($pptPresentation); } return $this->oPhpPresentation; }
/** * Load PhpPresentation Serialized file * * @param string $pFilename * @return \PhpOffice\PhpPresentation\PhpPresentation */ protected function loadFile($pFilename) { $this->oPhpPresentation = new PhpPresentation(); $this->oPhpPresentation->removeSlideByIndex(); $this->oZip = new ZipArchive(); $this->oZip->open($pFilename); $this->oXMLReader = new XMLReader(); if ($this->oXMLReader->getDomFromZip($pFilename, 'meta.xml') !== false) { $this->loadDocumentProperties(); } $this->oXMLReader = new XMLReader(); if ($this->oXMLReader->getDomFromZip($pFilename, 'content.xml') !== false) { $this->loadSlides(); } return $this->oPhpPresentation; }
/** * Load PhpPresentation Serialized file * * @param string $pFilename * @return \PhpOffice\PhpPresentation\PhpPresentation */ private function loadFile($pFilename) { $this->oPhpPresentation = new PhpPresentation(); $this->oPhpPresentation->removeSlideByIndex(); // Read OLE Blocks $this->loadOLE($pFilename); // Read pictures in the Pictures Stream $this->loadPicturesStream(); // Read information in the Current User Stream $this->loadCurrentUserStream(); // Read information in the PowerPoint Document Stream $this->loadPowerpointDocumentStream(); return $this->oPhpPresentation; }
echo date('H:i:s') . ' Create a shape (rich text) with list with red bullet' . EOL; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(100); $shape->setWidth(400); $shape->setOffsetX(100); $shape->setOffsetY(100); $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET)->setBulletColor(new Color(Color::COLOR_RED)); $shape->createTextRun('Alpha'); $shape->createParagraph()->createTextRun('Beta'); $shape->createParagraph()->createTextRun('Delta'); $shape->createParagraph()->createTextRun('Epsilon'); } // Create new PHPPresentation object echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; $objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties' . EOL; $oProperties = $objPHPPresentation->getDocumentProperties(); $oProperties->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 11 Title')->setSubject('Sample 11 Subject')->setDescription('Sample 11 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category'); // Remove first slide echo date('H:i:s') . ' Remove first slide' . EOL; $objPHPPresentation->removeSlideByIndex(0); fnSlideRichText($objPHPPresentation); fnSlideRichTextLineSpacing($objPHPPresentation); fnSlideRichTextShadow($objPHPPresentation); fnSlideRichTextList($objPHPPresentation); // Save file echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }
/** * Re-bind parent * * @param \PhpOffice\PhpPresentation\PhpPresentation $parent * @return \PhpOffice\PhpPresentation\Slide */ public function rebindParent(PhpPresentation $parent) { $this->parent->removeSlideByIndex($this->parent->getIndex($this)); $this->parent = $parent; return $this; }
/** * Test remove slide by index exception * * @expectedException Exception * @expectedExceptionMessage Slide index is out of bounds. */ public function testRemoveSlideByIndexException() { $object = new PhpPresentation(); $object->removeSlideByIndex(1); }