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

Fix error for documents without ListParagraph style #518

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

ColonelThirtyTwo
Copy link
Collaborator

Also adds checking in a few other places where styles are assigned.

In my experience, deleting the list paragraph style will also delete the
numberings XML document entirely, which python-docx cannot recreate.
This patch also checks for that and shows the user a more friendly error
message.

Fixes #499

Combining the two still produces ugly results, since in Word a paragraph
cannot have a "List Paragraph" and "Blockquote" style at the same time.
However it no longer throws an error.

Fixes GhostManager#516
Also adds checking in a few other places where styles are assigned.

In my experience, deleting the list paragraph style will also delete the
numberings XML document entirely, which python-docx cannot recreate.
This patch also checks for that and shows the user a more friendly error
message.

Fixes GhostManager#499
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.96%. Comparing base (3519d65) to head (ee3b1e3).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #518   +/-   ##
=======================================
  Coverage   91.95%   91.96%           
=======================================
  Files         314      314           
  Lines       18158    18158           
=======================================
+ Hits        16698    16699    +1     
+ Misses       1460     1459    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chrismaddalena chrismaddalena merged commit 87c819d into GhostManager:master Sep 12, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

KeyError: "no style with name 'ListParagraph'" during export
2 participants