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

How to get page number? #1332

Open
enrac5 opened this issue Jan 30, 2024 · 1 comment
Open

How to get page number? #1332

enrac5 opened this issue Jan 30, 2024 · 1 comment

Comments

@enrac5
Copy link

enrac5 commented Jan 30, 2024

Is there a way via the docx API to get the page number when I'm parsing a table?

@Mathacc
Copy link

Mathacc commented Mar 21, 2024

Well, yes and no, depends on the engine the docx was created. The pages are actually renderized on the engine you are running your docx file, what I mean with that: for example, the pages can be different if you open a docx file on google docs or office package. But there is a way to get the possible pages that were created. You must search for something like this in your xml file:

if 'lastRenderedPageBreak' in element._element.xml or ('w:br' in element._element.xml and 'type="page"' in element._element.xml)

this is a page break, than you must keep track of your pages for this to work.

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