Exemplo n.º 1
0
 /**
  * Parse text node
  *
  * @param \DOMNode $node
  * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
  * @param array &$styles
  * @return null
  */
 private static function parseText($node, $element, &$styles)
 {
     $styles['font'] = self::parseInlineStyle($node, $styles['font']);
     // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case.
     // @todo Find better error checking for this one
     // if (method_exists($element, 'addText')) {
     $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']);
     // }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Parse text node
  *
  * @param \DOMNode $node
  * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
  * @param array $styles
  * @param mixed $data
  * @param mixed $argument1
  * @param mixed $argument2
  * @param \DOMNode $parentNode
  * @return null
  */
 private static function parseText($node, $element, $styles, $data, $argument1, $argument2, $parentNode)
 {
     $styles['font'] = self::parseInlineStyle($node, $styles['font'], $parentNode);
     // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case.
     // @todo Find better error checking for this one
     // if (method_exists($element, 'addText')) {
     $text = str_replace('&', '&', $node->nodeValue);
     $text = preg_replace('#(\\s)(\\s+)#ims', '$1', $text);
     //$text	=	rtrim($text);
     $element->addText($text, $styles['font'], $styles['paragraph']);
     // }
     return null;
 }