Skip to content

HTML Reader : Override inline style on HTML attribute for table #2301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ phpword.ini
/.project
/nbproject
/.php_cs.cache
/.phpunit.result.cache
9 changes: 5 additions & 4 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ protected static function parseInlineStyle($node, $styles = [])
foreach ($attributes as $attribute) {
$val = $attribute->value;
switch (strtolower($attribute->name)) {
case 'style':
$styles = self::parseStyle($attribute, $styles);

break;
case 'align':
$styles['alignment'] = self::mapAlign(trim($val));

Expand Down Expand Up @@ -152,6 +148,11 @@ protected static function parseInlineStyle($node, $styles = [])
break;
}
}

$attributeStyle = $attributes->getNamedItem('style');
if ($attributeStyle) {
$styles = self::parseStyle($attributeStyle, $styles);
}
}

return $styles;
Expand Down
322 changes: 176 additions & 146 deletions tests/PhpWordTests/Shared/HtmlTest.php

Large diffs are not rendered by default.