Skip to content

Commit c467fe0

Browse files
authored
Merge pull request #2301 from Progi1984/htmlTableStyleAttribute
HTML Reader : Override inline style on HTML attribute for table
2 parents 02ccca1 + f8d0b2a commit c467fe0

File tree

3 files changed

+182
-150
lines changed

3 files changed

+182
-150
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ phpword.ini
2121
/.project
2222
/nbproject
2323
/.php_cs.cache
24+
/.phpunit.result.cache

src/PhpWord/Shared/Html.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ protected static function parseInlineStyle($node, $styles = [])
107107
foreach ($attributes as $attribute) {
108108
$val = $attribute->value;
109109
switch (strtolower($attribute->name)) {
110-
case 'style':
111-
$styles = self::parseStyle($attribute, $styles);
112-
113-
break;
114110
case 'align':
115111
$styles['alignment'] = self::mapAlign(trim($val));
116112

@@ -152,6 +148,11 @@ protected static function parseInlineStyle($node, $styles = [])
152148
break;
153149
}
154150
}
151+
152+
$attributeStyle = $attributes->getNamedItem('style');
153+
if ($attributeStyle) {
154+
$styles = self::parseStyle($attributeStyle, $styles);
155+
}
155156
}
156157

157158
return $styles;

tests/PhpWordTests/Shared/HtmlTest.php

+176-146
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)