We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page breaks in html to word convert

I'm trying to convert a HTML document containing "page-break-after" styles into a word Document.
Using Aspose Words 15.6.0 the style seems to be ignored.

According to W3C it is supported since CSS 2.1.
http://www.w3.org/TR/CSS21/page.html#page-breaks

Here the code I use:

String base = "issue25/";
LoadOptions loadOptions = new LoadOptions();
loadOptions.setLoadFormat(LoadFormat.HTML);
Document contentDocument = new Document(base + "data.html");
contentDocument.save(base + "output.docx", SaveFormat.DOCX);

Here is the test example I use:
https://msdn.microsoft.com/en-us/library/ms530842(v=vs.85).aspx

Is the style not supported, will it be supported in the future?

Nevermind I just found this post:

http://stackoverflow.com/questions/8218377/rendering-page-breaks-in-word-with-html

This does the job:
<br style=page-break-before: always>
1 Like

Hi Peter,


Thanks for your inquiry. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,