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


PHP PhpPresentation::getActiveSlide方法代码示例

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


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

示例1: testTypeBar

 public function testTypeBar()
 {
     $seriesData = array('A' => 1, 'B' => 2, 'C' => 4, 'D' => 3, 'E' => 2);
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oShape = $oSlide->createChartShape();
     $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80);
     $oBar = new Bar();
     $oSeries = new Series('Downloads', $seriesData);
     $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
     $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKBLUE));
     $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKGREEN));
     $oSeries->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKRED));
     $oSeries->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKYELLOW));
     $oBar->addSeries($oSeries);
     $oShape->getPlotArea()->setType($oBar);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml'));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt/c:spPr';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:tx/c:v';
     $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/' . $oShape->getIndexedFilename())->nodeValue);
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:28,代码来源:ChartBarTest.php

示例2: testCommentsAuthors

 public function testCommentsAuthors()
 {
     $oAuthor = new Comment\Author();
     $oComment = new Comment();
     $oComment->setAuthor($oAuthor);
     $oPhpPresentation = new PhpPresentation();
     $oPhpPresentation->getActiveSlide()->addShape($oComment);
     $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $this->assertTrue($pres->elementExists('/Relationships/Relationship[@Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"]', 'ppt/_rels/presentation.xml.rels'));
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:10,代码来源:RelationshipsTest.php

示例3: testVisibility

 public function testVisibility()
 {
     $expectedElement = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePage0\']/style:drawing-page-properties';
     $pres = TestHelperDOCX::getDocument($this->oPresentation, 'ODPresentation');
     $this->assertTrue($pres->elementExists($expectedElement, 'content.xml'));
     $this->assertFalse($pres->attributeElementExists($expectedElement, 'presentation:visibility', 'content.xml'));
     $oSlide = $this->oPresentation->getActiveSlide();
     $oSlide->setIsVisible(false);
     $pres = TestHelperDOCX::getDocument($this->oPresentation, 'ODPresentation');
     $this->assertTrue($pres->elementExists($expectedElement, 'content.xml'));
     $this->assertTrue($pres->attributeElementExists($expectedElement, 'presentation:visibility', 'content.xml'));
     $this->assertEquals('hidden', $pres->getElementAttribute($expectedElement, 'presentation:visibility', 'content.xml'));
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:13,代码来源:ContentTest.php

示例4: testGroup

 public function testGroup()
 {
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oGroup = $oSlide->createGroup();
     $oDrawing = new Drawing();
     $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation));
     $this->assertEmpty($oDrawing->allDrawings($oPhpPresentation));
     $oGroup->createDrawingShape();
     $oGroup->createDrawingShape();
     $oGroup->createDrawingShape();
     $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation));
     $this->assertCount(3, $oDrawing->allDrawings($oPhpPresentation));
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:14,代码来源:DrawingTest.php

示例5: testMemoryDrawing

 public function testMemoryDrawing()
 {
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oShape = new MemoryDrawing();
     $gdImage = @imagecreatetruecolor(140, 20);
     $textColor = imagecolorallocate($gdImage, 255, 255, 255);
     imagestring($gdImage, 1, 5, 5, 'Created with PhpPresentation', $textColor);
     $oShape->setImageResource($gdImage)->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT);
     $oSlide->addShape($oShape);
     $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation');
     $element = '/manifest:manifest/manifest:file-entry[5]';
     $this->assertTrue($pres->elementExists($element, 'META-INF/manifest.xml'));
     $this->assertEquals('Pictures/' . $oShape->getIndexedFilename(), $pres->getElementAttribute($element, 'manifest:full-path', 'META-INF/manifest.xml'));
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:15,代码来源:ManifestTest.php

示例6: testSave

 /**
  * Test save
  */
 public function testSave()
 {
     $filename = tempnam(sys_get_temp_dir(), 'PhpPresentation');
     $imageFile = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/images/PhpPresentationLogo.png';
     $oPhpPresentation = new PhpPresentation();
     $slide = $oPhpPresentation->getActiveSlide();
     $slide->createRichTextShape();
     $slide->createLineShape(10, 10, 10, 10);
     $slide->createChartShape()->getPlotArea()->setType(new \PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D());
     $slide->createDrawingShape()->setName('Drawing')->setPath($imageFile);
     $slide->createTableShape()->createRow();
     $object = new ODPresentation($oPhpPresentation);
     $object->save($filename);
     $this->assertTrue(file_exists($filename));
     unlink($filename);
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:19,代码来源:ODPresentationTest.php

示例7: testTypeArea

 public function testTypeArea()
 {
     $seriesData = array('A' => 1, 'B' => 2, 'C' => 4, 'D' => 3, 'E' => 2);
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oShape = $oSlide->createChartShape();
     $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80);
     $oArea = new Area();
     $oSeries = new Series('Downloads', $seriesData);
     $oSeries->getFill()->setStartColor(new Color('FFAABBCC'));
     $oArea->addSeries($oSeries);
     $oShape->getPlotArea()->setType($oArea);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml'));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:20,代码来源:ChartAreaTest.php

示例8: testStrokeDash

 public function testStrokeDash()
 {
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oRichText1 = $oSlide->createRichTextShape();
     $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setLineStyle(Border::LINE_SINGLE);
     $arrayDashStyle = array(Border::DASH_DASH, Border::DASH_DASHDOT, Border::DASH_DOT, Border::DASH_LARGEDASH, Border::DASH_LARGEDASHDOT, Border::DASH_LARGEDASHDOTDOT, Border::DASH_SYSDASH, Border::DASH_SYSDASHDOT, Border::DASH_SYSDASHDOTDOT, Border::DASH_SYSDOT);
     foreach ($arrayDashStyle as $style) {
         $oRichText1->getBorder()->setDashStyle($style);
         $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation');
         $element = '/office:document-styles/office:styles/draw:stroke-dash[@draw:name=\'strokeDash_' . $style . '\']';
         $this->assertTrue($pres->elementExists($element, 'styles.xml'));
         $this->assertEquals('rect', $pres->getElementAttribute($element, 'draw:style', 'styles.xml'));
         $this->assertTrue($pres->attributeElementExists($element, 'draw:distance', 'styles.xml'));
         switch ($style) {
             case Border::DASH_DOT:
             case Border::DASH_SYSDOT:
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1', 'styles.xml'));
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1-length', 'styles.xml'));
                 break;
             case Border::DASH_DASH:
             case Border::DASH_LARGEDASH:
             case Border::DASH_SYSDASH:
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2', 'styles.xml'));
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2-length', 'styles.xml'));
                 break;
             case Border::DASH_DASHDOT:
             case Border::DASH_LARGEDASHDOT:
             case Border::DASH_LARGEDASHDOTDOT:
             case Border::DASH_SYSDASHDOT:
             case Border::DASH_SYSDASHDOTDOT:
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1', 'styles.xml'));
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1-length', 'styles.xml'));
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2', 'styles.xml'));
                 $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2-length', 'styles.xml'));
                 break;
         }
     }
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:39,代码来源:StylesTest.php

示例9: loadShapeRichText

 /**
  * Read Shape RichText
  *
  * @param \DOMElement $oNodeFrame
  */
 protected function loadShapeRichText(\DOMElement $oNodeFrame)
 {
     // Core
     $oShape = $this->oPhpPresentation->getActiveSlide()->createRichTextShape();
     $oShape->setParagraphs(array());
     $oShape->setWidth($oNodeFrame->hasAttribute('svg:width') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:width'), 0, -2))) : '');
     $oShape->setHeight($oNodeFrame->hasAttribute('svg:height') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:height'), 0, -2))) : '');
     $oShape->setOffsetX($oNodeFrame->hasAttribute('svg:x') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:x'), 0, -2))) : '');
     $oShape->setOffsetY($oNodeFrame->hasAttribute('svg:y') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:y'), 0, -2))) : '');
     foreach ($this->oXMLReader->getElements('draw:text-box/*', $oNodeFrame) as $oNodeParagraph) {
         $this->levelParagraph = 0;
         if ($oNodeParagraph->nodeName == 'text:p') {
             $this->readParagraph($oShape, $oNodeParagraph);
         }
         if ($oNodeParagraph->nodeName == 'text:list') {
             $this->readList($oShape, $oNodeParagraph);
         }
     }
     if (count($oShape->getParagraphs()) > 0) {
         $oShape->setActiveParagraph(0);
     }
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:27,代码来源:ODPresentation.php

示例10: testChartArea

 public function testChartArea()
 {
     $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
     $oSeries->getFill()->setStartColor(new Color('FF93A9CE'));
     $oArea = new Area();
     $oArea->addSeries($oSeries);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oChart = $oSlide->createChartShape();
     $oChart->getPlotArea()->setType($oArea);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:body/office:chart/chart:chart';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('chart:area', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml'));
     $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('chart:area', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml'));
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleSeries0\']/style:graphic-properties';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertFalse($pres->attributeElementExists($element, 'draw:fill', 'Object 1/content.xml'));
     $this->assertTrue($pres->attributeElementExists($element, 'draw:fill-color', 'Object 1/content.xml'));
     $this->assertEquals('#93A9CE', $pres->getElementAttribute($element, 'draw:fill-color', 'Object 1/content.xml'));
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:23,代码来源:ChartAreaTest.php

示例11: testChartBarHorizontal

 public function testChartBarHorizontal()
 {
     $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
     $oSeries->setShowSeriesName(true);
     $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8'));
     $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744'));
     $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F'));
     $oBar = new Bar();
     $oBar->setBarDirection(Bar::DIRECTION_HORIZONTAL);
     $oBar->addSeries($oSeries);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oChart = $oSlide->createChartShape();
     $oChart->getPlotArea()->setType($oBar);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:body/office:chart/chart:chart';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml'));
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml'));
     $this->assertFalse($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml'));
     $this->assertFalse($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml'));
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:24,代码来源:ChartBarTest.php

示例12: date

<?php

include_once 'Sample_Header.php';
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\IOFactory;
// 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;
$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 03 Title')->setSubject('Sample 03 Subject')->setDescription('Sample 03 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();
// Create a shape (drawing)
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
$shape = $currentSlide->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);
// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shape = $currentSlide->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
// Save serialized file
$basename = basename(__FILE__, '.php');
echo date('H:i:s') . ' Write to serialized format' . EOL;
$objWriter = IOFactory::createWriter($objPHPPresentation, 'Serialized');
开发者ID:won21kr,项目名称:PHPPresentation,代码行数:31,代码来源:Sample_02_Serialized.php

示例13: loadShapeRichText

 protected function loadShapeRichText(XMLReader $document, \DOMElement $node, $baseFile)
 {
     // Core
     $oShape = $this->oPhpPresentation->getActiveSlide()->createRichTextShape();
     $oShape->setParagraphs(array());
     // Variables
     $fileRels = 'ppt/slides/_rels/' . $baseFile . '.rels';
     $oElement = $document->getElement('p:spPr/a:xfrm', $node);
     if ($oElement && $oElement->hasAttribute('rot')) {
         $oShape->setRotation(CommonDrawing::angleToDegrees($oElement->getAttribute('rot')));
     }
     $oElement = $document->getElement('p:spPr/a:xfrm/a:off', $node);
     if ($oElement) {
         if ($oElement->hasAttribute('x')) {
             $oShape->setOffsetX(CommonDrawing::emuToPixels($oElement->getAttribute('x')));
         }
         if ($oElement->hasAttribute('y')) {
             $oShape->setOffsetY(CommonDrawing::emuToPixels($oElement->getAttribute('y')));
         }
     }
     $oElement = $document->getElement('p:spPr/a:xfrm/a:ext', $node);
     if ($oElement) {
         if ($oElement->hasAttribute('cx')) {
             $oShape->setWidth(CommonDrawing::emuToPixels($oElement->getAttribute('cx')));
         }
         if ($oElement->hasAttribute('cy')) {
             $oShape->setHeight(CommonDrawing::emuToPixels($oElement->getAttribute('cy')));
         }
     }
     $arrayElements = $document->getElements('p:txBody/a:p', $node);
     foreach ($arrayElements as $oElement) {
         // Core
         $oParagraph = $oShape->createParagraph();
         $oParagraph->setRichTextElements(array());
         $oSubElement = $document->getElement('a:pPr', $oElement);
         if ($oSubElement) {
             if ($oSubElement->hasAttribute('algn')) {
                 $oParagraph->getAlignment()->setHorizontal($oSubElement->getAttribute('algn'));
             }
             if ($oSubElement->hasAttribute('fontAlgn')) {
                 $oParagraph->getAlignment()->setVertical($oSubElement->getAttribute('fontAlgn'));
             }
             if ($oSubElement->hasAttribute('marL')) {
                 $oParagraph->getAlignment()->setMarginLeft(CommonDrawing::emuToPixels($oSubElement->getAttribute('marL')));
             }
             if ($oSubElement->hasAttribute('marR')) {
                 $oParagraph->getAlignment()->setMarginRight(CommonDrawing::emuToPixels($oSubElement->getAttribute('marR')));
             }
             if ($oSubElement->hasAttribute('indent')) {
                 $oParagraph->getAlignment()->setIndent(CommonDrawing::emuToPixels($oSubElement->getAttribute('indent')));
             }
             if ($oSubElement->hasAttribute('lvl')) {
                 $oParagraph->getAlignment()->setLevel($oSubElement->getAttribute('lvl'));
             }
             $oElementBuFont = $document->getElement('a:buFont', $oSubElement);
             $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE);
             if ($oElementBuFont) {
                 if ($oElementBuFont->hasAttribute('typeface')) {
                     $oParagraph->getBulletStyle()->setBulletFont($oElementBuFont->getAttribute('typeface'));
                 }
             }
             $oElementBuChar = $document->getElement('a:buChar', $oSubElement);
             if ($oElementBuChar) {
                 $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
                 if ($oElementBuChar->hasAttribute('char')) {
                     $oParagraph->getBulletStyle()->setBulletChar($oElementBuChar->getAttribute('char'));
                 }
             }
             /*$oElementBuAutoNum = $document->getElement('a:buAutoNum', $oSubElement);
               if ($oElementBuAutoNum) {
                   $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NUMERIC);
                   if ($oElementBuAutoNum->hasAttribute('type')) {
                       $oParagraph->getBulletStyle()->setBulletNumericStyle($oElementBuAutoNum->getAttribute('type'));
                   }
                   if ($oElementBuAutoNum->hasAttribute('startAt') && $oElementBuAutoNum->getAttribute('startAt') != 1) {
                       $oParagraph->getBulletStyle()->setBulletNumericStartAt($oElementBuAutoNum->getAttribute('startAt'));
                   }
               }*/
         }
         $arraySubElements = $document->getElements('(a:r|a:br)', $oElement);
         foreach ($arraySubElements as $oSubElement) {
             if ($oSubElement->tagName == 'a:br') {
                 $oParagraph->createBreak();
             }
             if ($oSubElement->tagName == 'a:r') {
                 $oElementrPr = $document->getElement('a:rPr', $oSubElement);
                 if (is_object($oElementrPr)) {
                     $oText = $oParagraph->createTextRun();
                     if ($oElementrPr->hasAttribute('b')) {
                         $oText->getFont()->setBold($oElementrPr->getAttribute('b') == 'true' ? true : false);
                     }
                     if ($oElementrPr->hasAttribute('i')) {
                         $oText->getFont()->setItalic($oElementrPr->getAttribute('i') == 'true' ? true : false);
                     }
                     if ($oElementrPr->hasAttribute('strike')) {
                         $oText->getFont()->setStrikethrough($oElementrPr->getAttribute('strike') == 'noStrike' ? false : true);
                     }
                     if ($oElementrPr->hasAttribute('sz')) {
                         $oText->getFont()->setSize((int) ($oElementrPr->getAttribute('sz') / 100));
                     }
//.........这里部分代码省略.........
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:101,代码来源:PowerPoint2007.php

示例14: readRecordOfficeArtSpgrContainer

 /**
  * The OfficeArtSpgrContainer record specifies a container for groups of shapes.
  * @param string $stream
  * @param integer $pos
  * @param boolean $bInGroup
  * @link : https://msdn.microsoft.com/en-us/library/dd910416(v=office.12).aspx
  */
 private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false)
 {
     $arrayReturn = array('length' => 0);
     $data = $this->loadRecordHeader($stream, $pos);
     if ($data['recVer'] == 0xf && $data['recInstance'] == 0x0 && $data['recType'] == 0xf003) {
         $arrayReturn['length'] += 8;
         do {
             $rhFileBlock = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']);
             if (!($rhFileBlock['recVer'] == 0xf && $rhFileBlock['recInstance'] == 0x0 && ($rhFileBlock['recType'] == 0xf003 || $rhFileBlock['recType'] == 0xf004))) {
                 throw new \Exception('PowerPoint97 Reader : readRecordOfficeArtSpgrContainer.');
             }
             switch ($rhFileBlock['recType']) {
                 case 0xf003:
                     // Core
                     $this->oCurrentGroup = $this->oPhpPresentation->getActiveSlide()->createGroup();
                     $this->bFirstShapeGroup = false;
                     // OfficeArtSpgrContainer
                     $fileBlock = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length'], true);
                     $arrayReturn['length'] += $fileBlock['length'];
                     $data['recLen'] -= $fileBlock['length'];
                     break;
                 case 0xf004:
                     // Core
                     if (!$bInGroup) {
                         $this->oCurrentGroup = null;
                     }
                     // OfficeArtSpContainer
                     $fileBlock = $this->readRecordOfficeArtSpContainer($stream, $pos + $arrayReturn['length']);
                     $arrayReturn['length'] += $fileBlock['length'];
                     $data['recLen'] -= $fileBlock['length'];
                     // Core
                     //@todo
                     if (!is_null($fileBlock['shape'])) {
                         if ($bInGroup) {
                             $this->oCurrentGroup->addShape($fileBlock['shape']);
                         } else {
                             $this->oPhpPresentation->getActiveSlide()->addShape($fileBlock['shape']);
                         }
                     }
                     break;
             }
         } while ($data['recLen'] > 0);
     }
     return $arrayReturn;
 }
开发者ID:hxsam,项目名称:PHPPresentation,代码行数:52,代码来源:PowerPoint97.php

示例15: testMemoryDrawing

 public function testMemoryDrawing()
 {
     $gdImage = imagecreatetruecolor(140, 20);
     $textColor = imagecolorallocate($gdImage, 255, 255, 255);
     imagestring($gdImage, 1, 5, 5, 'Created with PHPPresentation', $textColor);
     $oShape = new Drawing\Gd();
     $oShape->setImageResource($gdImage);
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oSlide->addShape($oShape);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $this->assertTrue($oXMLDoc->fileExists('ppt/media/' . $oShape->getIndexedFilename()));
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:13,代码来源:PptMediaTest.php


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