本文整理汇总了PHP中PhpOffice\PhpPresentation\PhpPresentation::setActiveSlideIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpPresentation::setActiveSlideIndex方法的具体用法?PHP PhpPresentation::setActiveSlideIndex怎么用?PHP PhpPresentation::setActiveSlideIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpOffice\PhpPresentation\PhpPresentation
的用法示例。
在下文中一共展示了PhpPresentation::setActiveSlideIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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);
}
}
}
}
示例4: 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)
}
示例5: testSetActiveSlideIndexException
/**
* Test set active slide index exception
*
* @expectedException Exception
* @expectedExceptionMessage Active slide index is out of bounds.
*/
public function testSetActiveSlideIndexException()
{
$object = new PhpPresentation();
$object->setActiveSlideIndex(1);
}
示例6: 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;
}
}
}
}