Forum


Replies: 1   Views: 960
Styles are reset if there is no data in html-tags
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 hostmaster  · 20-12-2021 - 14:07

Hello! Our company has a "Premium" version of your library. We encountered a problem described in this block https://www.phpdocx.com/en/forum/default/topic/1896. That is, if there is no data in the html-tag, then the styles we set are not used. The option with the addition of & nbsp; that you advised us is not suitable, because our data is generated automatically and change them is a problem. Accordingly, the question is, could you show in the source code what needs to be changed in order to regardless of whether the tag is filled in or not to still apply the styles that were set by us?

And from this problem follows the following that after generation of docx of the document if to try to correct in manual any block, for example the list styles too are reset.

Posted by admin  · 20-12-2021 - 16:33

Hello,

Some styles can only be applied when tags contain values. This is a requirement that can't be changed (at least in the current stable release). MS Word have also some requirements (that phpdocx follows and fix automatically to avoid generating corrupted documents); for example a cell content can't be empty or the document will appear as corrupted when being opened with MS Word, it must contain at least one paragraph (empty or with contents).

Please post (or send to contact[at]phpdocx.com) the most simple HTML that illustrates what you need to do and we'll check it.

About:

And from this problem follows the following that after generation of docx of the document if to try to correct in manual any block, for example the list styles too are reset.

sorry, but we don't understand it. On https://www.phpdocx.com/htmlapi-documentation/html-standard/insert-ul-ol-li-list-Word-document-with-HTML you can read the supported attributes and styles when adding lists from HTML, a custom list style (https://www.phpdocx.com/api-documentation/layout-and-general/create-Word-custom-list-style-with-PHP) can be applied to generate and apply more list styles to HTML (https://www.phpdocx.com/documentation/introduction/html-to-word-PHP Lists section).

Regards.