Example #1
0
 /**
  * Add text element
  *
  * @param string $text
  * @param mixed $fontStyle
  * @param mixed $paragraphStyle
  * @return Text
  */
 public function addText($text, $fontStyle = null, $paragraphStyle = null)
 {
     $this->checkValidity('text');
     // Reset paragraph style for footnote and textrun. They have their own
     if (in_array($this->container, array('textrun', 'footnote', 'endnote'))) {
         $paragraphStyle = null;
     }
     $text = String::toUTF8($text);
     $textObject = new Text($text, $fontStyle, $paragraphStyle);
     $textObject->setDocPart($this->getDocPart(), $this->getDocPartId());
     $this->addElement($textObject);
     return $textObject;
 }