pydocx icon indicating copy to clipboard operation
pydocx copied to clipboard

pydocx not recognizing highlight_color of font in a run

Open Aliases opened this issue 8 years ago • 1 comments

Hello,

I am trying to separate contents of a document based on the highlight color of font. e.g.

screen shot 2017-02-04 at 4 32 03 pm

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?

Aliases avatar Feb 05 '17 00:02 Aliases

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)

xiangleichushi avatar Jul 22 '24 09:07 xiangleichushi