change text color docx python

Solutions on MaxInterview for change text color docx python by the best coders in the world

showing results for - "change text color docx python"
Anthony
18 Mar 2020
1from docx import Document
2from docx.shared import RGBColor
3document = Document()
4run = document.add_paragraph().add_run('some text')
5font = run.font
6font.color.rgb = RGBColor(0x42, 0x24, 0xE9)
7p=document.add_paragraph('aaa')
8document.save('demo1.docx')