mwilliamson / python-mammoth

Convert Word documents (.docx files) to HTML
BSD 2-Clause "Simplified" License
785 stars 121 forks source link

Q: how to match "run style"? #128

Closed zopyx closed 1 year ago

zopyx commented 1 year ago

I have a DOCX with custom styles. However, I don't know how to map/match a "run style" in my styles mapping file

Unrecognised run style: Literaturverweis (Style ID: Literaturverweis)
Unrecognised run style: TherapieVergleich (Style ID: TherapieVergleich)
Unrecognised run style: Legendenzeichen Pfeil Blau (Style ID: LegendenzeichenPfeilBlau)
Unrecognised run style: Legendenzeichen Pfeil Gelb (Style ID: LegendenzeichenPfeilGelb)
mwilliamson commented 1 year ago

If, for instance, you wanted to map Literaturverweis to span.literaturverweis:

r[style-name='Literaturverweis'] => span.literaturverweis
zopyx commented 1 year ago

Thanks, problem solved. This information is missing in the docs.

mwilliamson commented 1 year ago

I believe it's covered under the section "Document element matchers": https://github.com/mwilliamson/python-mammoth#document-element-matchers