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

Support pagination in MSWord documents #833

Open
dhdaines opened this issue Jan 29, 2025 · 4 comments
Open

Support pagination in MSWord documents #833

dhdaines opened this issue Jan 29, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@dhdaines
Copy link

Requested feature

It's more or less possible to get pagination out of a DOCX file created by some versions of MSWord (notably not Word 365..) by looking at the <w:lastRenderedPageBreak/> elements. See https://ooxml.info/docs/17/17.3/17.3.3/17.3.3.13/

This is only partially supported by python-docx but we can just get it with XPath. I read CONTRIBUTING.md and I'm not supposed to do this, but I need the feature, so I made a PR anyway 😉 #832

Alternatives

There is no alternative! No, not true - pagination is always approximate for DOCX since it isn't (exactly) a presentation format. So, if you want to really know the page number, then render to a PDF first. Now you have two problems!

@dhdaines dhdaines added the enhancement New feature or request label Jan 29, 2025
@dhdaines
Copy link
Author

dhdaines commented Jan 29, 2025

Note that it is generally impossible to get accurate pagination out of OOXML (docx)
So for this reason you may prefer not to do this! But even very approximate page numbers can still be useful.

@dolfim-ibm
Copy link
Contributor

Do you mean out CONTRIBUTING.md? We are very happy having the community building up these extensions. Thanks a lot for the contribution.

@maxmnemonic maxmnemonic self-assigned this Jan 29, 2025
@dhdaines
Copy link
Author

Do you mean out CONTRIBUTING.md? We are very happy having the community building up these extensions. Thanks a lot for the contribution.

Ah, just because CONTRIBUTING.md mentions that you should start a discussion before making a PR :)

There are a couple of things in the PR that may need to be improved!

@dhdaines
Copy link
Author

dhdaines commented Feb 7, 2025

I believe the PR should be complete now but obviously needs review...

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

No branches or pull requests

4 participants