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


PHP PhpPresentation::createSlide方法代码示例

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


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

示例1: loadSlide

 /**
  * Read Slide
  *
  * @param \DOMElement $nodeSlide
  */
 protected function loadSlide(\DOMElement $nodeSlide)
 {
     // Core
     $this->oPhpPresentation->createSlide();
     $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1);
     if ($nodeSlide->hasAttribute('draw:name')) {
         $this->oPhpPresentation->getActiveSlide()->setName($nodeSlide->getAttribute('draw:name'));
     }
     if ($nodeSlide->hasAttribute('draw:style-name')) {
         $keyStyle = $nodeSlide->getAttribute('draw:style-name');
         if (isset($this->arrayStyles[$keyStyle])) {
             $this->oPhpPresentation->getActiveSlide()->setBackground($this->arrayStyles[$keyStyle]['background']);
         }
     }
     foreach ($this->oXMLReader->getElements('draw:frame', $nodeSlide) as $oNodeFrame) {
         if ($this->oXMLReader->getElement('draw:image', $oNodeFrame)) {
             $this->loadShapeDrawing($oNodeFrame);
             continue;
         }
         if ($this->oXMLReader->getElement('draw:text-box', $oNodeFrame)) {
             $this->loadShapeRichText($oNodeFrame);
             continue;
         }
     }
     return true;
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:31,代码来源:ODPresentation.php

示例2: testParent

 public function testParent()
 {
     $object = new Note();
     $this->assertNull($object->getParent());
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->createSlide();
     $oSlide->setNote($object);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getParent());
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:9,代码来源:NoteTest.php

示例3: loadSlide

 /**
  * Extract data from slide
  * @param \DOMElement $nodeSlide
  */
 protected function loadSlide(\DOMElement $nodeSlide)
 {
     // Core
     $this->oPhpPresentation->createSlide();
     $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1);
     foreach ($this->oXMLReader->getElements('draw:frame', $nodeSlide) as $oNodeFrame) {
         if ($this->oXMLReader->getElement('draw:image', $oNodeFrame)) {
             $this->loadShapeDrawing($oNodeFrame);
             continue;
         }
         if ($this->oXMLReader->getElement('draw:text-box', $oNodeFrame)) {
             $this->loadShapeRichText($oNodeFrame);
             continue;
         }
     }
     return true;
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:21,代码来源:ODPresentation.php

示例4: loadSlide

 /**
  * Extract data from slide
  * @param string $sPart
  * @param string $baseFile
  */
 protected function loadSlide($sPart, $baseFile)
 {
     $xmlReader = new XMLReader();
     if ($xmlReader->getDomFromString($sPart)) {
         // Core
         $this->oPhpPresentation->createSlide();
         $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1);
         foreach ($xmlReader->getElements('/p:sld/p:cSld/p:spTree/*') as $oNode) {
             switch ($oNode->tagName) {
                 case 'p:pic':
                     $this->loadShapeDrawing($xmlReader, $oNode, $baseFile);
                     break;
                 case 'p:sp':
                     $this->loadShapeRichText($xmlReader, $oNode, $baseFile);
                     break;
                 default:
                     //var_export($oNode->tagName);
             }
         }
     }
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:26,代码来源:PowerPoint2007.php

示例5: createTemplatedSlide

/**
 * Creates a templated slide
 *
 * @param PHPPresentation $objPHPPresentation
 * @return \PhpOffice\PhpPresentation\Slide
 */
function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPPresentation)
{
    // Create slide
    $slide = $objPHPPresentation->createSlide();
    // Add logo
    $shape = $slide->createDrawingShape();
    $shape->setName('PHPPresentation logo')->setDescription('PHPPresentation logo')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
    $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
    // Return slide
    return $slide;
}
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:17,代码来源:Sample_Header.php

示例6: readRecordSlideContainer

 /**
  * A container record that specifies a presentation slide or title master slide.
  * @param string $stream
  * @param int $pos
  * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx
  */
 private function readRecordSlideContainer($stream, $pos)
 {
     // Core
     $this->oPhpPresentation->createSlide();
     $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1);
     // *** slideAtom (32 bytes)
     $slideAtom = $this->readRecordSlideAtom($stream, $pos);
     if ($slideAtom['length'] == 0) {
         throw new \Exception('PowerPoint97 Reader : record SlideAtom');
     }
     $pos += $slideAtom['length'];
     // *** slideShowSlideInfoAtom (24 bytes)
     $slideShowInfoAtom = $this->readRecordSlideShowSlideInfoAtom($stream, $pos);
     $pos += $slideShowInfoAtom['length'];
     // *** perSlideHFContainer (variable) : optional
     $perSlideHFContainer = $this->readRecordPerSlideHeadersFootersContainer($stream, $pos);
     $pos += $perSlideHFContainer['length'];
     // *** rtSlideSyncInfo12 (variable) : optional
     $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container($stream, $pos);
     $pos += $rtSlideSyncInfo12['length'];
     // *** drawing (variable)
     $drawing = $this->readRecordDrawingContainer($stream, $pos);
     $pos += $drawing['length'];
     // *** slideSchemeColorSchemeAtom (40 bytes)
     $slideSchemeColorAtom = $this->readRecordSlideSchemeColorSchemeAtom($stream, $pos);
     if ($slideSchemeColorAtom['length'] == 0) {
         throw new \Exception('PowerPoint97 Reader : record SlideSchemeColorSchemeAtom');
     }
     $pos += $slideSchemeColorAtom['length'];
     // *** slideNameAtom (variable)
     $slideNameAtom = $this->readRecordSlideNameAtom($stream, $pos);
     $pos += $slideNameAtom['length'];
     // *** slideProgTagsContainer (variable).
     $slideProgTags = $this->readRecordSlideProgTagsContainer($stream, $pos);
     $pos += $slideProgTags['length'];
     // *** rgRoundTripSlide (variable)
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:43,代码来源:PowerPoint97.php

示例7: date

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();
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Slide > Background > Color
$oBkgColor = new Color();
$oBkgColor->setColor(new StyleColor(StyleColor::COLOR_DARKGREEN));
$oSlide1->setBackground($oBkgColor);
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$oSlide2 = $objPHPPresentation->createSlide();
$oSlide2->addShape(clone $oShapeDrawing);
$oSlide2->addShape(clone $oShapeRichText);
// Slide > Background > Image
/*
 * @link : http://publicdomainarchive.com/public-domain-images-cave-red-rocks-light-beam-cavern/
 */
$oBkgImage = new Image();
$oBkgImage->setPath('./resources/background.jpg');
$oSlide2->setBackground($oBkgImage);
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
开发者ID:Progi1984,项目名称:PHPPresentation,代码行数:31,代码来源:Sample_15_Background.php

示例8: date

$objPHPPresentation->getDocumentProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 10 Title')->setSubject('Sample 10 Subject')->setDescription('Sample 10 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$slide0 = $objPHPPresentation->getActiveSlide();
// Create a shape (drawing)
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
$shapeDrawing = $slide0->createDrawingShape();
$shapeDrawing->setName('PHPPresentation logo')->setDescription('PHPPresentation logo')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$shapeDrawing->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
$shapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shapeRichText = $slide0->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$shapeRichText->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $shapeRichText->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
$oTransition = new Transition();
$oTransition->setManualTrigger(false);
$oTransition->setTimeTrigger(true, 4000);
$oTransition->setTransitionType(Transition::TRANSITION_SPLIT_IN_VERTICAL);
$slide0->setTransition($oTransition);
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$slide1 = $objPHPPresentation->createSlide();
$slide1->addShape(clone $shapeDrawing);
$slide1->addShape(clone $shapeRichText);
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:31,代码来源:Sample_10_Transition.php

示例9: loadSlide

 /**
  * Extract data from slide
  * @param string $sPart
  * @param string $baseFile
  */
 protected function loadSlide($sPart, $baseFile)
 {
     $xmlReader = new XMLReader();
     if ($xmlReader->getDomFromString($sPart)) {
         // Core
         $oSlide = $this->oPhpPresentation->createSlide();
         $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1);
         $oSlide->setRelsIndex('ppt/slides/_rels/' . $baseFile . '.rels');
         // Background
         $oElement = $xmlReader->getElement('/p:sld/p:cSld/p:bg/p:bgPr');
         if ($oElement) {
             $oElementColor = $xmlReader->getElement('a:solidFill/a:srgbClr', $oElement);
             if ($oElementColor) {
                 // Color
                 $oColor = new Color();
                 $oColor->setRGB($oElementColor->hasAttribute('val') ? $oElementColor->getAttribute('val') : null);
                 // Background
                 $oBackground = new \PhpOffice\PhpPresentation\Slide\Background\Color();
                 $oBackground->setColor($oColor);
                 // Slide Background
                 $oSlide = $this->oPhpPresentation->getActiveSlide();
                 $oSlide->setBackground($oBackground);
             }
             $oElementImage = $xmlReader->getElement('a:blipFill/a:blip', $oElement);
             if ($oElementImage) {
                 $relImg = $this->arrayRels['ppt/slides/_rels/' . $baseFile . '.rels'][$oElementImage->getAttribute('r:embed')];
                 if (is_array($relImg)) {
                     // File
                     $pathImage = 'ppt/slides/' . $relImg['Target'];
                     $pathImage = explode('/', $pathImage);
                     foreach ($pathImage as $key => $partPath) {
                         if ($partPath == '..') {
                             unset($pathImage[$key - 1]);
                             unset($pathImage[$key]);
                         }
                     }
                     $pathImage = implode('/', $pathImage);
                     $contentImg = $this->oZip->getFromName($pathImage);
                     $tmpBkgImg = tempnam(sys_get_temp_dir(), 'PhpPresentationReaderPpt2007Bkg');
                     file_put_contents($tmpBkgImg, $contentImg);
                     // Background
                     $oBackground = new Image();
                     $oBackground->setPath($tmpBkgImg);
                     // Slide Background
                     $oSlide = $this->oPhpPresentation->getActiveSlide();
                     $oSlide->setBackground($oBackground);
                 }
             }
         }
         // Shapes
         foreach ($xmlReader->getElements('/p:sld/p:cSld/p:spTree/*') as $oNode) {
             switch ($oNode->tagName) {
                 case 'p:pic':
                     $this->loadShapeDrawing($xmlReader, $oNode, $oSlide);
                     break;
                 case 'p:sp':
                     $this->loadShapeRichText($xmlReader, $oNode, $oSlide);
                     break;
                 default:
                     //var_export($oNode->tagName);
             }
         }
         // Layout
         $oSlide = $this->oPhpPresentation->getActiveSlide();
         foreach ($this->arrayRels['ppt/slides/_rels/' . $baseFile . '.rels'] as $valueRel) {
             if ($valueRel['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout') {
                 $layoutBasename = basename($valueRel['Target']);
                 if (array_key_exists($layoutBasename, $this->arraySlideLayouts)) {
                     $oSlide->setSlideLayout($this->arraySlideLayouts[$layoutBasename]);
                 }
                 break;
             }
         }
     }
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:80,代码来源:PowerPoint2007.php


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