From f7afdebb0331b393a157bb0874c7cf5209a9fbe3 Mon Sep 17 00:00:00 2001 From: Henri MEDOT Date: Thu, 12 Nov 2015 18:51:04 +0100 Subject: [PATCH 1/3] Added support for linebreaks
in Shared\Html::addHtml() --- src/PhpWord/Shared/Html.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index cdc88b4396..d9a3f40ed3 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -128,6 +128,7 @@ protected static function parseNode($node, $element, $styles = array(), $data = 'ul' => array('List', null, null, $styles, $data, 3, null), 'ol' => array('List', null, null, $styles, $data, 7, null), 'li' => array('ListItem', $node, $element, $styles, $data, null, null), + 'br' => array('LineBreak', null, $element, $styles, null, null, null), ); $newElement = null; @@ -374,4 +375,17 @@ private static function parseStyle($attribute, $styles) return $styles; } + + /** + * Parse line break + * + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + * @return null + */ + private static function parseLineBreak($element) + { + $element->addTextBreak(); + + return null; + } } From 9081ed9868f517d84a83599a5ccd4325677736a1 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 17:40:23 +0100 Subject: [PATCH 2/3] fix warning --- src/PhpWord/Shared/Html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index e19c3fb6c1..d448e697e5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -527,11 +527,11 @@ private static function mapBorderStyle($cssBorderStyle) /** * Parse line break - * - * @param \PhpOffice\PhpWord\Element\AbstractContainer $element - */ + * + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + */ private static function parseLineBreak($element) { $element->addTextBreak(); } -} \ No newline at end of file +} From c079bf7f10123b3b7190c25b2deb58484da2e37a Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 20:47:34 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e39ed3fe4..82f1cc5963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This is the last version to support PHP 5.3 - Support for Comments - @troosan #1067 - Support for paragraph textAlignment - @troosan #1165 - Add support for HTML underline tag in addHtml - @zNightFalLz #1186 +- Add support for HTML
in addHtml - @anrikun @troosan #659 - Allow to change cell width unit - guillaume-ro-fr #986 - Allow to change the line height rule @troosan