Is there any way to export word to html page by pages?

currently the Document.save method can only export the doc into html in web view mode,which means all the containts are in a single web page. I am wondering whether there is a way to export the document page by page, (not section by section, as one section may contains lots of pages according to pagesetup),thanks

Hi

Thanks for your inquiry. No, there is no way to export document to HTML page by page. However, if you can split your document into pages, you can achieve this. Could you please attach your document here for testing? Maybe you can try splitting document by headings.

Best regards.

testing document is in the attachement, could you please give me an example codes to split document page by page, than i will be able to exports these document one by to to simulate this inquiry,thank you!

Hi,

Thank you for additional information. MS Word document is flow document and does not contain any information about its layout into lines and pages. So, there is no public API, which allows to determine where page starts or ends.

Best regards.

thanks for the reply,maybe i can do this by caculate the content height and cut it page by page, best regards

Hi

Thanks for your request. This is not so easy as it sounds. To calculate height of content you need to calculate number of lines in your document. This requires calculating size of each character. Moreover, there can be images and tables in your document, what much more complicates the task.

Best regards.

The issues you have found earlier (filed as WORDSNET-2973) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

HI,

According to this release note, this feature is now available. But I cannot find any documentation for this. Can you give me a sample code?

@RMS_DEV,

Thanks for your inquiry. Please use the following code example to convert each page of Word document into separate HTML page. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();

opts.PageIndex = 0;
opts.PageCount = doc.PageCount;
opts.PageSavingCallback = new HandlePageSavingCallback();

doc.Save(MyDir + "17.7.html", opts);

private class HandlePageSavingCallback : IPageSavingCallback
{
    public void PageSaving(PageSavingArgs args)
    {
        args.PageFileName = string.Format(MyDir + @"Page_{0}.html", args.PageIndex);
    }
}