Replies: 4   Views: 3905
Highlight/background color for templatevariable
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 Andrew Goodricke  · 16-10-2013 - 17:13

I'm trying to get a variable to have a different background dependant upon the value.

e.g. 1 would be red, 2 would be orange and 3 would be green.

I've tried doing:
$code = '<head><style type="text/css">body{font-family: Arial;font-size:11pt;background-color: yellow;}</style></head><body>9</body>';
$docx->addTemplateVariable('FIELD_BK',$code, 'html');

but this doesn't do anything.  Any pointers would be greatfully received.