createParagraph() public method

Create paragraph
public createParagraph ( ) : Paragraph
return PhpOffice\PhpPresentation\Shape\RichText\Paragraph
Esempio n. 1
0
 public function testActiveParagraph()
 {
     $object = new RichText();
     $this->assertEquals(0, $object->getActiveParagraphIndex());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph());
     $this->assertCount(2, $object->getParagraphs());
     $value = rand(0, 1);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value));
     $this->assertEquals($value, $object->getActiveParagraphIndex());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph());
     $value = rand(0, 1);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value));
 }
Esempio n. 2
0
 /**
  * Read List Item
  * @param RichText $oShape
  * @param \DOMElement $oNodeParent
  * @param \DOMElement $oNodeParagraph
  */
 protected function readListItem(RichText $oShape, \DOMElement $oNodeParent, \DOMElement $oNodeParagraph)
 {
     $oParagraph = $oShape->createParagraph();
     if ($oNodeParagraph->hasAttribute('text:style-name')) {
         $keyStyle = $oNodeParagraph->getAttribute('text:style-name');
         if (isset($this->arrayStyles[$keyStyle])) {
             $oParagraph->setAlignment($this->arrayStyles[$keyStyle]['listStyle'][$this->levelParagraph]['alignment']);
             $oParagraph->setBulletStyle($this->arrayStyles[$keyStyle]['listStyle'][$this->levelParagraph]['bullet']);
         }
     }
     foreach ($this->oXMLReader->getElements('text:span', $oNodeParent) as $oNodeRichTextElement) {
         $this->readParagraphItem($oParagraph, $oNodeRichTextElement);
     }
 }