Replies: 5   Views: 2838
Unable to remove the highlighted word from ms word
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  · 08-06-2017 - 14:02

I am highlighting a word in HTML format. My code is:

require_once '../../../classes/';

$docx = new CreateDocxFromTemplate('../../files/TemplateHTML.docx');

$docx->replaceVariableByHTML('ADDRESS', 'inline', '<p style="font-family: verdana; font-size: 11px">C/ Matías Turrión 24, Madrid 28043 <b style="color: white;background: red;">Spain</b></p>', array('isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false));


 O/P DOCX File:
 My problem is I cannot remove the red highlight from the word using "No Color" MS Word option.

Posted by admin  · 08-06-2017 - 14:17


Your username doesn't have any license tied. Which license and version of phpdocx are you using?


Posted by  · 08-06-2017 - 14:54

I'm using PHPdocX 6.0 under Basic License purchased for

Posted by admin  · 08-06-2017 - 16:26


We have checked it and we can remove the background color.

It's not a highlight color but a background color; you just need to select the text and remove or set a new shading value to the text. When you select the text a small dialog appears.


Posted by  · 08-06-2017 - 16:44

I'm testing it on MS Word 2010. On hovering over the text, we can change the background color to anything. When we choose "No Color" as text highlight color, it is supposed to remove the red color but it isn't doing so. The word is highlighted using the PHPDOCX code mentioned above.

See screenshot:

Posted by admin  · 08-06-2017 - 17:29


We have tested it using MS Word 2010 and it works fine too.

As we tried to explain on our previous update, you're trying to remove a highlight color, and that color is not a hightlight but a shading color (we have changed the white color of the word to a black one just to show it):