<w:lastRenderedPageBreak />
See original GitHub issueAs 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:
- Created 5 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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?@dwasyl Yes! I am also interested in the final result of the mammoth repository modified by you