Skip to content

< in addHTML #791

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

Closed
sleker78 opened this issue Apr 29, 2016 · 1 comment
Closed

< in addHTML #791

sleker78 opened this issue Apr 29, 2016 · 1 comment

Comments

@sleker78
Copy link

sleker78 commented Apr 29, 2016

Hi,

Great application - thanks.
There is a problem when you have < in string:

$html='<p>something &lt; something </p>;
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);

It'll break the xml structure for docs. Possible solution is to change addHTML method:

 // Load DOM
        $dom = new \DOMDocument();
        $dom->preserveWhiteSpace = true;
        $dom->loadXML($html,LIBXML_NOCDATA);

With this replacement user can send <![CDATA[_lt_]]> instead of &lt; like this:

$html='<p>something <![CDATA[_lt_]]> something </p>;
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);

and it'll work ok.

Maybe there is some better solution but this will work for now.

Thanks

@ghost ghost mentioned this issue May 10, 2016
@ghost ghost added this to the v0.13.0 milestone Jul 9, 2016
@ghost ghost self-assigned this Jul 9, 2016
@ghost
Copy link

ghost commented Jul 9, 2016

#671 (comment).

@ghost ghost closed this as completed Jul 9, 2016
This issue was closed.
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