I’m positively surprised about how good HTML import is working for Aspose.Words. However, I’m having a problem with “page-break-inside:avoid” for HTML import.
In our HTML, we have the “page-break-inside:avoid” style on div elements. However, because div elements are converted to Sections, there is no support for page break behavior. We are not sure how to make “page-break-inside:avoid” work instead.
The style “page-break-before: always” is working perfectly for heading (h1,h2,etc.) elements. However it does not make sense to apply the “page-break-inside:avoid” on headings, because headings are not containers for text elements or tables.
We also tried the “page-break-before: always” on paragraph elements (p tags), but this also does not produce the expected result.
To view the HTML we tested with, please visit: https://jsfiddle.net/1cp3xaqj/. We imported it by using “builder.InsertHtml(html);” and then exported it to a docx document.
Our expectation was that the second paragraph would appear on the next page on its own. However, this is not the case. Can you explain what we are doing wrong?