open-xml-templating/docxtemplater

Page break propogates to all elements inside div

tylerlinquata opened this issue · 5 comments

Environment

  • Version of docxtemplater : 3.42.2
  • Used docxtemplater-modules : HTML v3.37.1

How to reproduce my problem :

Reproducible using the HTML demo page and the following JSON:

{ 
    "html": "
<div>
    <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
    </p>
    <p style='break-before: page'>
        Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
    </p>
    <p>
        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
    </p>
    <p>
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
    <p>
        Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
    </p>
</div>
"}

I would expect it to :

  • break the page before the second paragraph

Actual outcome:

  • page is broken before every paragraph

Hello @tylerlinquata ,

I'm looking into this, I hope to get a fix out by Tuesday !

Best,

Edgar

I can confirm the bug.

Thank you @edi9999!

@tylerlinquata, while the bug isn't resolved use the tag span instead the tag p in the paragraph with the style attribute. It works for me.

I've just released a new version, 3.42.1 of the HTML module which fixes the issue :

Use following command to update all docxtemplater related dependencies :

npm install docxtemplater && npx -y update-docxtemplater && npm install