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

Free Support Forum - aspose.com

Re: Text location moving issue and pagebreak problem when docx to html convert

dear i also have a same problem but i am not getting any idea how to achieve page break

my doc file have 32 page when i upload and save then it show as single html and there page number also 1 so how i break the html can u help me with this problem.

i am use following code

thanks in advance

// For uploading the file we require MultiPartRequest
MultipartRequest mp = new MultipartRequest(request, serverPath, 1024 * 1024 * 1024);
// for getting file name
Enumeration <?> itr = mp.getFileNames();
while (itr.hasMoreElements())
{
    filename = mp.getFilesystemName((String)itr.nextElement());
    System.out.println("filename=" + filename);
}

Document doc = new Document(serverPath + "\\" + filename);
doc.updatePageLayout();
int pageCoun = doc.getPageCount();
System.out.println(pageCoun);
DocumentBuilder builder = new DocumentBuilder(doc);
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportPageSetup(true);
options.setExportImagesAsBase64(true);
options.setEncoding(java.nio.charset.Charset.forName("UTF-8"));
options.setPrettyFormat(true);
options.setExportPageSetup(true);
// options.setDocumentSplitCriteria(1);
doc.save(serverPath + "\\temp.html", options);

Hi there,

Thanks for your inquiry. We suggest you please save the document to HtmlFixed file format as shown below.

Document doc = new Document(MyDir + "input.docx");
HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();
// Specify options as required
doc.save(MyDir +"output 17.1.0.html", opts);

If you still face problem, please attach the following resources here for testing:

  • Your input Word document
  • Please attach the output HtmlFixed file that shows the undesired behavior.
  • Please share the screenshot of problematic sections in output document.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.