本文整理汇总了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);
}
示例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'));
}
示例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'));
}
示例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));
}
示例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'));
}
示例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);
}
示例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()));
}
示例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;
}
}
}
示例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);
}
}
示例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'));
}
示例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'));
}
示例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');
示例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));
}
//.........这里部分代码省略.........
示例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;
}
示例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()));
}