pydocx
pydocx copied to clipboard
pydocx not recognizing highlight_color of font in a run
Hello,
I am trying to separate contents of a document based on the highlight color of font. e.g.
Third party is coloring the documents for me. In some cases, pydocx is not recognizing any highlight color for the text in the document, but when I again highlight the same font with same color, it recognizes the highlight color. What wrong could be going when the third party is coloring it?
Has it been resolved? My code is reporting an error: ValueError: WD_COLOR_INDEX has no XML mapping for 'none'. The code is following: from docx import Document from docx.enum.text import WD_COLOR_INDEX
doc = Document('D:/Desktop/123.docx') para = doc.paragraphs[0] for index, run in enumerate(para.runs): if run.font.highlight_color is None: print(1) else: print(2)