open-xml-templating / docxtemplater

Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js or the browser. Demo: https://www.docxtemplater.com/demo. #docx #office #generator #templating #report #json #generate #generation #template #create #pptx #docx #xlsx #react #vuejs #angularjs #browser #typescript #image #html #table #chart
https://www.docxtemplater.com
Other
3.03k stars 349 forks source link

Page break propogates to all elements inside div #738

Closed tylerlinquata closed 9 months ago

tylerlinquata commented 9 months ago

Environment

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 :

Actual outcome:

edi9999 commented 9 months ago

Hello @tylerlinquata ,

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

Best,

Edgar

edi9999 commented 9 months ago

I can confirm the bug.

tylerlinquata commented 9 months ago

Thank you @edi9999!

Pablo87996 commented 9 months ago

@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.

edi9999 commented 9 months ago

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