Forum


Replies: 1   Views: 2138
Css cause error: the document may be corrupt or damaged
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 teacheradvisor  · 13-02-2019 - 17:24

Hi,

There are cases where HTML contains CSS to hide the last column of a table. Converting this HTML to Word result in a corrupt or damaged document.

div.wrapper table tr td:last-child { display: none; }

If I remove this CSS, the conversion works fine.

 

Please advise,

Thanks

Posted by admin  · 13-02-2019 - 17:45

Hello,

The OOXML standard (DOCX documents) requires that all cells must have at least one content (this can be a paragraph, other table, a blank space...), otherwise, MS Word shows a corrupted DOCX.

You can't hide/remove all cell contents. At least one content must be added to the cell. If you set display: none to all cell content when importing HTML then no content is added to the cell, and at least one content needs to be added.

Regards.