protected function _writeTextRun(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_TextRun $textrun) { $elements = $textrun->getElements(); $styleParagraph = $textrun->getParagraphStyle(); $SpIsObject = $styleParagraph instanceof PHPWord_Style_Paragraph ? true : false; $objWriter->startElement('w:p'); if ($SpIsObject) { $this->_writeParagraphStyle($objWriter, $styleParagraph); } elseif (!$SpIsObject && !is_null($styleParagraph)) { $objWriter->startElement('w:pPr'); $objWriter->startElement('w:pStyle'); $objWriter->writeAttribute('w:val', $styleParagraph); $objWriter->endElement(); $objWriter->endElement(); } if (count($elements) > 0) { foreach ($elements as $element) { if ($element instanceof PHPWord_Section_Text) { $this->_writeText($objWriter, $element, true); } elseif ($element instanceof PHPWord_Section_Link) { $this->_writeLink($objWriter, $element, true); } } } $objWriter->endElement(); }
public function newRun($pStyle = NULL) { if ($pStyle == NULL) { $pStyle = isset($this->run) ? $this->run->getParagraphStyle() : 'standard'; } $this->run = $this->section->createTextRun($pStyle); return $this->run; }