I’m using Actions for Microsoft Flow to create a DOCX file based on a template with incoming JSON and I’m wondering if there’s currently any way to allow for the dynamic modification of the text color (or background color of a table cell), based on the JSON itself?
For example, if the incoming number from the JSON is 0, is there a way to specify that that text’s color should be red? Whereas if the value were 100, it would be green?
There’s no such functionality in Actions for now.
You can try using formatting rules in Excel and create XLSX instead.
Also, we can suggest you paid support if this functionality is critical for you. Please send us a message to support@plumsail.com with requirements in that case.
Hi - I am building a report that requires the same functionality mentioned here. I'm hoping that there has been some sort of solution since the original post.
Is there any way we can dynamically render a cell shading colour based on an incoming value from the JSON? Like a conditional statement, or perhaps using HTML?
Hi @kyleprowe, @anita.tran - we implemented a similar functionality using rules for showing/hidding different rows of the table. My examples shows some grades (beween 1 and 6) in different colors, depending on the value. See attachment.
Example:
Hides the block: {{STATIONEN.Kriterium.Note1}:hide-block-if(value>=4.5 || value == null)}
Shows the value: {{STATIONEN.Kriterium.Note1}}
If you need to change cell colors based on their values, we recommend using an Excel template. Excel supports conditional formatting, so it is much easier to set this up there.
Please follow this article for instructions.
For DOCX templates, there is no direct way to change a cell background color based on its value. However, you can use the hide-block-if formatter as a workaround.
For example, you can create several cells or rows with different colors and show or hide them depending on the value.
Could you please share a few more details about your requirements, including an example of the values and colors you would like to apply? So we can take a look and suggest the best approach.