Skip to content
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

HTML tag LI align not working #2304

Open
mivart opened this issue Sep 30, 2022 · 0 comments
Open

HTML tag LI align not working #2304

mivart opened this issue Sep 30, 2022 · 0 comments

Comments

@mivart
Copy link

mivart commented Sep 30, 2022

Describe the Bug

LI tag with inline style ""text-align:justify" does not justify text inside LI element.

Steps to Reproduce

<ol>
	<li style="text-align:justify;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam..</li>
</ol>

Possible solution

/PhpWord/Shared/Html.php

    protected static function parseListItem($node, $element, &$styles, $data)
    {
        $cNodes = $node->childNodes;
        if (!empty($cNodes)) {
            
             /*FIX issue with incorrect style parsing  of LI element*/
             $styles['paragraph'] = self::recursiveParseStylesInHierarchy($node, $styles['paragraph']);
            /**/

            $listRun = $element->addListItemRun($data['listdepth'], $styles['list'], $styles['paragraph']);
            foreach ($cNodes as $cNode) {
                self::parseNode($cNode, $listRun, $styles, $data);
            }
        }
    }

Context

  • PHP Version: 7.3.1
  • PHPWord Version: 0.18.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant