Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydocx not recognizing highlight_color of font in a run #226

Open
Aliases opened this issue Feb 5, 2017 · 1 comment
Open

pydocx not recognizing highlight_color of font in a run #226

Aliases opened this issue Feb 5, 2017 · 1 comment

Comments

@Aliases
Copy link

Aliases commented Feb 5, 2017

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?

@xiangleichushi
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants