From d721b5eda7e93997a4b5f4de31b24ca3751306da Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 23 Nov 2022 13:32:03 +0100 Subject: [PATCH] HTML Reader : Set style name from the CSS class (and if not CSS is loaded) --- src/PhpWord/Shared/Html.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index c937d29918..3253b83c99 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -160,8 +160,10 @@ protected static function parseInlineStyle($node, $styles = []) } $attributeClass = $attributes->getNamedItem('class'); - if ($attributeClass && self::$css) { - $styles = self::parseStyleDeclarations(self::$css->getStyle('.' . $attributeClass->value), $styles); + if ($attributeClass) { + if (self::$css) { + $styles = self::parseStyleDeclarations(self::$css->getStyle('.' . $attributeClass->value), $styles); + } $styles['className'] = $attributeClass->value; }