Extract Specific Pages from the Document and Save them into single HTML document using .NET

Hello,

I’m trying to save a docx document into html with specific page selection. I know there is an option to select specific pages using the Aspose.Words.Saving.HtmlFixedSaveOptions pageIndex and pageCount, however the output html will be absolutely positioned.

I’m looking for the Word version of Aspose.Pdf.HtmlSaveOptions.ExplicitListOfSavedPages from the Pdf package.

Is there a workaround for me to use both regular (no absolute elements) docx to html conversion and still use page selection?

@ruspaull

In your case, we suggest you please use the PageSplitter utility to get the desired pages. This utility exports the specific pages to Document. You can join the exported pages (documents) and save the final document to HTML.

Please get the code of PageSplitter utility from here:

https://github.com/aspose-words/Aspose.Words-for-.NET

Please read following article about joining documents.
Join and Append Documents

@ruspaull

In the latest version of Aspose.Words for .NET, we added new method Document.ExtractPages to get the specified range of pages. Please use this method instead of PageSplitter code.

Following code example shows how to get specified range of pages from the document.

    Document doc = new Document(MyDir + "input.docx");
    doc = doc.ExtractPages(0, 2);
    doc.Save(ArtifactsDir + "Document.ExtractPages.docx");