question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<w:lastRenderedPageBreak />

See original GitHub issue

As part of using mammoth I’ve had a need to detect natural page breaks. While Word doesn’t mark pages, it does insert <w:lastRenderedPageBreak /> into the document at the flowed page breaks (seemingly at column breaks as well).

To detect these, I hacked together a system adding a detector to docx/body_xml.py’s def inline(element) to detect <w:lastRenderedPageBreak /> elements and call a function that inserts dummy text that I find and replace later.

Realizing that this isn’t a very reusable way of looking for these rendered page breaks, I was wondering if you had a preferred way of detecting/inserting these extra tags in the HTML. If so, I’d be happy to try turning it into a proper PR.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dwasylcommented, Nov 9, 2019

@mwilliamson is there a way you’d prefer to hook this in? I could work on a PR, but what I’ve done is simply have it replace the w:lastRenderedPageBreak with some marker text I found later. Realizing this isn’t the best overall approach, I could try refactoring it another way?

1reaction
MadMaxINDIANcommented, Jan 2, 2021

@dwasyl Yes! I am also interested in the final result of the mammoth repository modified by you

Read more comments on GitHub >

github_iconTop Results From Across the Web

softpagebreaks W:LastRenderedPageBreak - Eric White's Blog
This is a big problem in Word. The w:lastRenderedPageBreak tags are not inserted in the right place. You have identified two places, but...
Read more >
missing W:Lastrenderedpagebreak - MSDN - Microsoft
I need to find the page breaks in the word document, I am using w:lastRenderedPageBreak element to identify the page breaks. but in...
Read more >
How to make docx file render/load/add and retain all w ...
1 Answer 1 · If a document has never been rendered, there will be no w:lastRenderedPageBreak elements. · If a document has been...
Read more >
Как сделать так, чтобы файл docx отображался / загружался ...
Единственный раз, когда w: lastRenderedPageBreak будет правильно отображать разрывы страниц, - это когда я открываю файл docx и сохраняю его как файл XML....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found