-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to change the color of a cell in a word table created with template? #984
Comments
I also get into the same issue needing to change the color of template text. Is there anyone have done with this? Much appreciate your help! |
@emateos For now, it is not easy. I managed a method, but I doubt it is optimal, first you need my PHPWord branch that contains the Segment() TemplateProcessor commands. Now this only works on the LibreOffice generated tables, MSOffice has another structure, but maybe it is helpful:
getSegment() is new and has not made it yet into PHPWord, check my fork https://github.com/FBnil/PHPWord or copy all segment commands from pastebin |
Good Morning.
I have a php that generates a word document from a template using phpword.
In this template I have created a table, which is filled perfectly with the values I extract from the database.
The problem is that the background color of the cell should vary depending on the value of the cell.
For example if the value> 50 Color red
If the value> 20 and value <50 yellow.
It's the first time I use phpword and I haven´t idea how to do it.
Please, any suggestions?
// Contenido table TT
$templateWord->setValue('NUA#'.$i,$UA);
$templateWord->setValue('NombreUA#'.$i,utf8_encode($row_RsTT['S1']));
$templateWord->setValue('Sabados#'.$i,$PP01."%");
$templateWord->setValue('Festivos#'.$i,$PP02."%");
$templateWord->setValue('Descanso#'.$i,$PP05."%");
$templateWord->setValue('Personal#'.$i,$PP06."%");
I execute a clonerow from there the #
Thank you very much!!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: