Replies: 4   Views: 3800
Css not being parsed for included html content
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Damien Westacott  · 14-02-2014 - 06:54

Hi guys,

We're trying to build Word versions of existing HTML reports generated by our metrics system. PHPDocX is doing a good job of taking our basic table structures and data across to .docx files. Unfortunately, not a single line of CSS is being correctly processed.

Furthermore, the PHPDocX examples are having the same issue - when we run the EmbedHTMLinTable.php script our output (in the example_embedHTMLinTable.docx file) is substantially different to that found at - specifically, our .docx has black table borders. The !DOCTYPE declaration is also visible in the output.

I'm suspicious that there's a basic parsing issue here - and I was wondering if the cause might be that we've recently migrated to PHP 5.3.1 (in which I believe they've changed some fundamental things about regular expressions: )

If so, we probably won't be the only people with this problem. If not, I'm keen to get any insights (since I've been beating my head against this issue for too many hours already).

Thanks in advance,


Posted by jorgelj  · 14-02-2014 - 08:00


Is Tidy installed and active? Please check it and try again after you enable Tidy.

Everything must run fine with PHP 5.3.


Posted by Damien Westacott  · 17-02-2014 - 00:38


Is Tidy installed and active? Please check it and try again after you enable Tidy.


Tidy made a positive difference. Thanks!

It's probably worth mentioning in your 'HTML To Word' documentation page at that Tidy needs to be enabled for CSS parsing to work. I believe Tidy is already bundled with PHP 5.3, but it's not enabled by default.


Posted by jorgelj  · 17-02-2014 - 11:40


Thanks for your tip, we're writing new documentation and we'll add it.