FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: accept fractional w:pgMar twips values in ST_TwipsMeasure by SAY-5 · Pull Request #1552 · python-openxml/python-docx · GitHub

fix: accept fractional w:pgMar twips values in ST_TwipsMeasure - #1552

Open
SAY-5 wants to merge 1 commit into
python-openxml:masterfrom
SAY-5:fix-1539-twips-float
Open

fix: accept fractional w:pgMar twips values in ST_TwipsMeasure#1552
SAY-5 wants to merge 1 commit into
python-openxml:masterfrom
SAY-5:fix-1539-twips-float

Conversation

SAY-5 commented May 12, 2026

Copy link
Copy Markdown

Some Word documents store w:pgMar attributes like w:right="0.218505859375", which currently raises ValueError from int() when reading section.right_margin. This mirrors the rounding already done by ST_SignedTwipsMeasure so unsigned twips measures tolerate the same fractional values. Closes #1539

SAY-5 commented Aug 16, 2026

Copy link
Copy Markdown
Author

Gentle ping on this. Word docs in the wild do write fractional twips in w:pgMar (LibreOffice does it), and python-docx currently raises on them, so this just rounds instead of rejecting.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Getting "ValueError: invalid literal for int() with base 10" error when access section's margin

1 participant


Back | FazBrowse Home | New Git URL