PhpOffice\PhpPresentation\Shape\RichText::setActiveParagraph PHP Method

setActiveParagraph() public method

Set active paragraph
public setActiveParagraph ( integer $index ) : Paragraph
$index integer
return PhpOffice\PhpPresentation\Shape\RichText\Paragraph
    public function setActiveParagraph($index = 0)
    {
        if ($index >= count($this->richTextParagraphs)) {
            throw new \Exception("Invalid paragraph count.");
        }
        $this->activeParagraph = $index;
        return $this->getActiveParagraph();
    }

Usage Example

Example #1
0
 /**
  * @expectedException \Exception
  * expectedExceptionMessage Invalid paragraph count.
  */
 public function testActiveParagraphException()
 {
     $object = new RichText();
     $object->setActiveParagraph(1000);
 }