/** * Read View Properties * @param string $sPart */ protected function loadViewProperties($sPart) { $xmlReader = new XMLReader(); if ($xmlReader->getDomFromString($sPart)) { $pathZoom = '/p:viewPr/p:slideViewPr/p:cSldViewPr/p:cViewPr/p:scale/a:sx'; if (is_object($oElement = $xmlReader->getElement($pathZoom))) { if ($oElement->hasAttribute('d') && $oElement->hasAttribute('n')) { $this->oPhpPresentation->setZoom($oElement->getAttribute('n') / $oElement->getAttribute('d')); } } } }
<?php include_once 'Sample_Header.php'; use PhpOffice\PhpPresentation\PhpPresentation; use PhpOffice\PhpPresentation\Style\Alignment; use PhpOffice\PhpPresentation\Style\Color; // Create new PHPPresentation object echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; $objPHPPresentation = new PhpPresentation(); // Set the zoom to 200% $objPHPPresentation->setZoom(3); // Create slide echo date('H:i:s') . ' Create slide' . EOL; $currentSlide = $objPHPPresentation->getActiveSlide(); $currentSlide->addShape(clone $oShapeDrawing); $currentSlide->addShape(clone $oShapeRichText); // Save file echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }
public function testZoom() { $object = new PhpPresentation(); $this->assertEquals(1, $object->getZoom()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setZoom('AAAA')); $this->assertEquals(1, $object->getZoom()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setZoom(2.3)); $this->assertEquals(2.3, $object->getZoom()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setZoom()); $this->assertEquals(1, $object->getZoom()); }