_styleFont = new PHPWord_Style_Font('text'); foreach($styleFont as $key => $value) { if(substr($key, 0, 1) != '_') { $key = '_'.$key; } $this->_styleFont->setStyleValue($key, $value); } } else { $this->_styleFont = $styleFont; } // Set paragraph style if(is_array($styleParagraph)) { $this->_styleParagraph = new PHPWord_Style_Paragraph(); foreach($styleParagraph as $key => $value) { if(substr($key, 0, 1) != '_') { $key = '_'.$key; } $this->_styleParagraph->setStyleValue($key, $value); } } else { $this->_styleParagraph = $styleParagraph; } $pattern = '/({.*?})/'; $this->_text = preg_split($pattern, $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); return $this; } /** * Get Text style * * @return PHPWord_Style_Font */ public function getFontStyle() { return $this->_styleFont; } /** * Get Paragraph style * * @return PHPWord_Style_Paragraph */ public function getParagraphStyle() { return $this->_styleParagraph; } /** * Get Text content * * @return string */ public function getText() { return $this->_text; } } ?>