This project is read-only.

Changing Color of text in setValue()

Feb 3, 2014 at 2:00 PM
Edited Feb 4, 2014 at 5:52 AM
I am trying to generate a DOCX file where I need to search & replace some "specific" contents of a DOCX template with some value. setValue() helps me achieve these .

By default, the text that is inserted as replacement by setValue() in the generated docx file has black color.
But however I need the color of the text to be red.

I tried using setValue(string1,string2, array(color=>'FF0000H')). But this doesn't work.
Also I tried using addText().

But perhaps PHP Word doesn't allow formatting of text elements 'On the Fly'.

Can someone please drop a hint?
Mar 20, 2014 at 6:18 AM
Currently, setValue can only search for a certain format, i.e. ${VAR}. You can't replace the color since it's not formatted like that. The only solution that I can find is you must be able to read the DOCX content, put it into PHPWord objects, and manipulate the objects with PHPWord methods.

We're working on DOCX Reader. This scenario should be possible in a near future.