Forum


Replies: 1   Views: 3174
Changing background color of cells in existing table
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 jrhilldev  · 18-12-2016 - 15:27

Hello,

I can't see a way of doing this in the docs so I thought I would check. Is there any way of targeting specific cells in an existing table and changing their background color?  Because of the way the project I have been working on has been setup it will be easier and quicker to do it this way rather than dynamically building a table from scratch.

Thanks

Posted by admin  · 19-12-2016 - 07:25

Hello,

DOCXCustomizer, available in Premium licenses, allows changing styles on-the-fly. For example to set custom cell backgroundcolors.

The replaceTableVariable method allows to add new rows and replace placeholders in it.

To use background colors, they must be already set it in the template or create the table from scratch (using addTable, embedHtml or WordFragments).

Regards.