diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 64bcab1eb1..60ebf472a4 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -111,6 +111,7 @@ protected static function parseNode($node, $element, $styles = array(), $data = $nodes = array( // $method $node $element $styles $data $argument1 $argument2 'p' => array('Paragraph', $node, $element, $styles, null, null, null), + 'br' => array('Linebreak', $node, $element, $styles, null, null, null), 'h1' => array('Heading', null, $element, $styles, null, 'Heading1', null), 'h2' => array('Heading', null, $element, $styles, null, 'Heading2', null), 'h3' => array('Heading', null, $element, $styles, null, 'Heading3', null), @@ -197,10 +198,26 @@ private static function parseParagraph($node, $element, &$styles) { $styles['paragraph'] = self::parseInlineStyle($node, $styles['paragraph']); $newElement = $element->addTextRun($styles['paragraph']); + $newElement->addTextBreak(1); return $newElement; } + /** + * Parse paragraph node + * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + * @param array &$styles + * @return \PhpOffice\PhpWord\Element\TextRun + */ + private static function parseLinebreak($node, $element, &$styles) + { + $element->addTextBreak(1); + + return $element; + } + /** * Parse heading node *