Reputation: 1
I am using docxtpl to dealing with word template. Using RichText can change the new add font, but I want to change font color that exist in word template. Is there any solution?
Upvotes: 0
Views: 311
Reputation: 491
You can change the font to your desired color directly to the expression in your template document.
So, say the expression you want to render in color is {{website}}
and the value is 'stack overflow' you can set the font of the expression in the Word Template:
And in your code create the context
and render
it:
template = DocxTemplate(path_to_template)
context = {'website':"stack overflow"}
template.render(context)
template.save(path_to_output_file)
Upvotes: 0