当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpPresentation::getPresentationProperties方法代码示例

本文整理汇总了PHP中PhpOffice\PhpPresentation\PhpPresentation::getPresentationProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpPresentation::getPresentationProperties方法的具体用法?PHP PhpPresentation::getPresentationProperties怎么用?PHP PhpPresentation::getPresentationProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpOffice\PhpPresentation\PhpPresentation的用法示例。


在下文中一共展示了PhpPresentation::getPresentationProperties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testPresentationProperties

 public function testPresentationProperties()
 {
     $object = new PhpPresentation();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setPresentationProperties(new PresentationProperties()));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties());
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:7,代码来源:PhpPresentationTest.php

示例2: testFeatureThumbnail

 public function testFeatureThumbnail()
 {
     $imagePath = PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'PhpPresentationLogo.png';
     $oPhpPresentation = new PhpPresentation();
     $oPhpPresentation->getPresentationProperties()->setThumbnailPath($imagePath);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $this->assertTrue($oXMLDoc->fileExists('docProps/thumbnail.jpeg'));
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:8,代码来源:DocPropsThumbnailTest.php

示例3: testLastView

 public function testLastView()
 {
     $expectedElement = '/p:viewPr';
     $expectedLastView = PresentationProperties::VIEW_OUTLINE;
     $oPhpPresentation = new PhpPresentation();
     $oPhpPresentation->getPresentationProperties()->setLastView($expectedLastView);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $this->assertTrue($oXMLDoc->fileExists('ppt/viewProps.xml'));
     $this->assertTrue($oXMLDoc->elementExists($expectedElement, 'ppt/viewProps.xml'));
     $this->assertEquals($expectedLastView, $oXMLDoc->getElementAttribute($expectedElement, 'lastView', 'ppt/viewProps.xml'));
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:11,代码来源:PptViewPropsTest.php

示例4: loadViewProperties

 /**
  * 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->getPresentationProperties()->setZoom($oElement->getAttribute('n') / $oElement->getAttribute('d'));
             }
         }
     }
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:16,代码来源:PowerPoint2007.php

示例5: writePresProps

 /**
  * Write ppt/presProps.xml to XML format
  *
  * @return     string         XML Output
  * @throws     \Exception
  */
 public function writePresProps(PhpPresentation $pPhpPresentation)
 {
     $presentationPpts = $pPhpPresentation->getPresentationProperties();
     // Create XML writer
     $objWriter = $this->getXMLWriter();
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // p:presentationPr
     $objWriter->startElement('p:presentationPr');
     $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');
     // p:presentationPr > p:showPr
     if ($presentationPpts->isLoopContinuouslyUntilEsc()) {
         $objWriter->startElement('p:showPr');
         $objWriter->writeAttribute('loop', '1');
         $objWriter->endElement();
     }
     // p:extLst
     $objWriter->startElement('p:extLst');
     // p:ext
     $objWriter->startElement('p:ext');
     $objWriter->writeAttribute('uri', '{E76CE94A-603C-4142-B9EB-6D1370010A27}');
     // p14:discardImageEditData
     $objWriter->startElement('p14:discardImageEditData');
     $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
     $objWriter->writeAttribute('val', '0');
     $objWriter->endElement();
     // > p:ext
     $objWriter->endElement();
     // p:ext
     $objWriter->startElement('p:ext');
     $objWriter->writeAttribute('uri', '{D31A062A-798A-4329-ABDD-BBA856620510}');
     // p14:defaultImageDpi
     $objWriter->startElement('p14:defaultImageDpi');
     $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
     $objWriter->writeAttribute('val', '220');
     $objWriter->endElement();
     // > p:ext
     $objWriter->endElement();
     // > p:extLst
     $objWriter->endElement();
     // > p:presentationPr
     $objWriter->endElement();
     return $objWriter->getData();
 }
开发者ID:Progi1984,项目名称:PHPPresentation,代码行数:52,代码来源:PptProps.php

示例6: date

<?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->getPresentationProperties()->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';
}
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:21,代码来源:Sample_14_Zoom.php

示例7: writePart


//.........这里部分代码省略.........
                 case Alignment::HORIZONTAL_CENTER:
                     $objWriter->writeAttribute('fo:text-align', 'center');
                     break;
                 case Alignment::HORIZONTAL_JUSTIFY:
                     $objWriter->writeAttribute('fo:text-align', 'justify');
                     break;
                 case Alignment::HORIZONTAL_DISTRIBUTED:
                     $objWriter->writeAttribute('fo:text-align', 'justify');
                     break;
                 default:
                     $objWriter->writeAttribute('fo:text-align', 'left');
                     break;
             }
             $objWriter->endElement();
             $objWriter->endElement();
         }
     }
     // Style : Text : Font
     if (!empty($this->arrStyleTextFont)) {
         foreach ($this->arrStyleTextFont as $key => $item) {
             // style:style
             $objWriter->startElement('style:style');
             $objWriter->writeAttribute('style:name', 'T_' . $key);
             $objWriter->writeAttribute('style:family', 'text');
             // style:text-properties
             $objWriter->startElement('style:text-properties');
             $objWriter->writeAttribute('fo:color', '#' . $item->getColor()->getRGB());
             $objWriter->writeAttribute('fo:font-family', $item->getName());
             $objWriter->writeAttribute('fo:font-size', $item->getSize() . 'pt');
             // @todo : fo:font-style
             if ($item->isBold()) {
                 $objWriter->writeAttribute('fo:font-weight', 'bold');
             }
             // @todo : style:text-underline-style
             $objWriter->endElement();
             $objWriter->endElement();
         }
     }
     $objWriter->endElement();
     //===============================================
     // Body
     //===============================================
     // office:body
     $objWriter->startElement('office:body');
     // office:presentation
     $objWriter->startElement('office:presentation');
     // Write slides
     $slideCount = $pPhpPresentation->getSlideCount();
     $this->shapeId = 0;
     for ($i = 0; $i < $slideCount; ++$i) {
         $pSlide = $pPhpPresentation->getSlide($i);
         $objWriter->startElement('draw:page');
         $name = $pSlide->getName();
         if (!is_null($name)) {
             $objWriter->writeAttribute('draw:name', $name);
         }
         $objWriter->writeAttribute('draw:master-page-name', 'Standard');
         $objWriter->writeAttribute('draw:style-name', 'stylePage' . $i);
         // Images
         $shapes = $pSlide->getShapeCollection();
         foreach ($shapes as $shape) {
             // Increment $this->shapeId
             ++$this->shapeId;
             // Check type
             if ($shape instanceof RichText) {
                 $this->writeShapeTxt($objWriter, $shape);
             } elseif ($shape instanceof Table) {
                 $this->writeShapeTable($objWriter, $shape);
             } elseif ($shape instanceof Line) {
                 $this->writeShapeLine($objWriter, $shape);
             } elseif ($shape instanceof Chart) {
                 $this->writeShapeChart($objWriter, $shape);
             } elseif ($shape instanceof AbstractDrawing) {
                 $this->writeShapePic($objWriter, $shape);
             } elseif ($shape instanceof Group) {
                 $this->writeShapeGroup($objWriter, $shape);
             }
         }
         // Slide Note
         if ($pSlide->getNote() instanceof Note) {
             $this->writeSlideNote($objWriter, $pSlide->getNote());
         }
         $objWriter->endElement();
     }
     if ($pPhpPresentation->getPresentationProperties()->isLoopContinuouslyUntilEsc()) {
         $objWriter->startElement('presentation:settings');
         $objWriter->writeAttribute('presentation:endless', 'true');
         $objWriter->writeAttribute('presentation:pause', 'P0s');
         $objWriter->writeAttribute('presentation:mouse-visible', 'false');
         $objWriter->endElement();
     }
     // > office:presentation
     $objWriter->endElement();
     // > office:body
     $objWriter->endElement();
     // > office:document-content
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
开发者ID:Progi1984,项目名称:PHPPresentation,代码行数:101,代码来源:Content.php

示例8: save

 /**
  * Save PhpPresentation to file
  *
  * @param  string    $pFilename
  * @throws \Exception
  */
 public function save($pFilename)
 {
     if (empty($pFilename)) {
         throw new \Exception("Filename is empty");
     }
     if (!is_null($this->presentation)) {
         // If $pFilename is php://output or php://stdout, make it a temporary file...
         $originalFilename = $pFilename;
         if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
             $pFilename = @tempnam('./', 'phppttmp');
             if ($pFilename == '') {
                 $pFilename = $originalFilename;
             }
         }
         $writerPartChart = $this->getWriterPart('charts');
         if (!$writerPartChart instanceof ObjectsChart) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\ObjectsChart');
         }
         $writerPartContent = $this->getWriterPart('content');
         if (!$writerPartContent instanceof Content) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Content');
         }
         $writerPartDrawing = $this->getWriterPart('Drawing');
         if (!$writerPartDrawing instanceof Drawing) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Drawing');
         }
         $writerPartManifest = $this->getWriterPart('manifest');
         if (!$writerPartManifest instanceof Manifest) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Manifest');
         }
         $writerPartMeta = $this->getWriterPart('meta');
         if (!$writerPartMeta instanceof Meta) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Meta');
         }
         $writerPartMimetype = $this->getWriterPart('mimetype');
         if (!$writerPartMimetype instanceof Mimetype) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Mimetype');
         }
         $writerPartStyles = $this->getWriterPart('styles');
         if (!$writerPartStyles instanceof Styles) {
             throw new \Exception('The $parentWriter is not an instance of \\PhpOffice\\PhpPresentation\\Writer\\ODPresentation\\Styles');
         }
         // Create drawing dictionary
         $this->drawingHashTable->addFromSource($writerPartDrawing->allDrawings($this->presentation));
         // Create new ZIP file and open it for writing
         $objZip = new \ZipArchive();
         // Try opening the ZIP file
         if ($objZip->open($pFilename, \ZIPARCHIVE::OVERWRITE) !== true) {
             if ($objZip->open($pFilename, \ZIPARCHIVE::CREATE) !== true) {
                 throw new \Exception("Could not open " . $pFilename . " for writing.");
             }
         }
         // Add mimetype to ZIP file
         //@todo Not in ZIPARCHIVE::CM_STORE mode
         $objZip->addFromString('mimetype', $writerPartMimetype->writePart());
         // Add content.xml to ZIP file
         $objZip->addFromString('content.xml', $writerPartContent->writePart($this->presentation));
         // Add meta.xml to ZIP file
         $objZip->addFromString('meta.xml', $writerPartMeta->writePart($this->presentation));
         // Add styles.xml to ZIP file
         $objZip->addFromString('styles.xml', $writerPartStyles->writePart($this->presentation));
         // Add META-INF/manifest.xml
         $objZip->addFromString('META-INF/manifest.xml', $writerPartManifest->writePart());
         // Add Thumbnail
         if ($this->presentation->getPresentationProperties()->getThumbnailPath()) {
             $pathThumbnail = $this->presentation->getPresentationProperties()->getThumbnailPath();
             // Size : 128x128 pixel
             // PNG : 8bit, non-interlaced with full alpha transparency
             $gdImage = imagecreatefromstring(file_get_contents($pathThumbnail));
             if ($gdImage) {
                 list($width, $height) = getimagesize($pathThumbnail);
                 $gdRender = imagecreatetruecolor(128, 128);
                 $colorBgAlpha = imagecolorallocatealpha($gdRender, 0, 0, 0, 127);
                 imagecolortransparent($gdRender, $colorBgAlpha);
                 imagefill($gdRender, 0, 0, $colorBgAlpha);
                 imagecopyresampled($gdRender, $gdImage, 0, 0, 0, 0, 128, 128, $width, $height);
                 imagetruecolortopalette($gdRender, false, 255);
                 imagesavealpha($gdRender, true);
                 ob_start();
                 imagepng($gdRender);
                 $imageContents = ob_get_contents();
                 ob_end_clean();
                 imagedestroy($gdRender);
                 imagedestroy($gdImage);
                 $objZip->addFromString('Thumbnails/thumbnail.png', $imageContents);
             }
         }
         // Add charts
         foreach ($this->chartArray as $keyChart => $shapeChart) {
             $arrayFile = $writerPartChart->writePart($shapeChart);
             foreach ($arrayFile as $file => $content) {
                 if (!empty($content)) {
                     $objZip->addFromString('Object ' . $keyChart . '/' . $file, $content);
                 }
//.........这里部分代码省略.........
开发者ID:jrdncchr,项目名称:merlinleads,代码行数:101,代码来源:ODPresentation.php

示例9: date

<?php

include_once 'Sample_Header.php';
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Slide\Background\Color;
use PhpOffice\PhpPresentation\Style\Color as StyleColor;
use PhpOffice\PhpPresentation\Slide\Background\Image;
// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();
// Set Thumbnail
$objPHPPresentation->getPresentationProperties()->setThumbnailPath(__DIR__ . '\\resources\\phppowerpoint_logo.gif');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:22,代码来源:Sample_16_Thumbnail.php


注:本文中的PhpOffice\PhpPresentation\PhpPresentation::getPresentationProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。