getZoom() public method

Return the zoom (in percentage)
Deprecation: for getPresentationProperties()->getZoom()
public getZoom ( ) : float
return float
Beispiel #1
0
 /**
  * Write ppt/viewProps.xml to XML format
  *
  * @return     string         XML Output
  * @throws     \Exception
  */
 public function writeViewProps(PhpPresentation $oPhpPresentation)
 {
     // Create XML writer
     $objWriter = $this->getXMLWriter();
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // p:viewPr
     $objWriter->startElement('p:viewPr');
     $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
     $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
     $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
     $objWriter->writeAttribute('showComments', '0');
     // p:viewPr > p:slideViewPr
     $objWriter->startElement('p:slideViewPr');
     // p:viewPr > p:slideViewPr > p:cSldViewPr
     $objWriter->startElement('p:cSldViewPr');
     // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr
     $objWriter->startElement('p:cViewPr');
     // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr > p:scale
     $objWriter->startElement('p:scale');
     $objWriter->startElement('a:sx');
     $objWriter->writeAttribute('d', '100');
     $objWriter->writeAttribute('n', (int) ($oPhpPresentation->getZoom() * 100));
     $objWriter->endElement();
     $objWriter->startElement('a:sy');
     $objWriter->writeAttribute('d', '100');
     $objWriter->writeAttribute('n', (int) ($oPhpPresentation->getZoom() * 100));
     $objWriter->endElement();
     // > // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr > p:scale
     $objWriter->endElement();
     $objWriter->startElement('p:origin');
     $objWriter->writeAttribute('x', '0');
     $objWriter->writeAttribute('y', '0');
     $objWriter->endElement();
     // > // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr
     $objWriter->endElement();
     // > // p:viewPr > p:slideViewPr > p:cSldViewPr
     $objWriter->endElement();
     // > // p:viewPr > p:slideViewPr
     $objWriter->endElement();
     // > // p:viewPr
     $objWriter->endElement();
     return $objWriter->getData();
 }
 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());
 }