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

Free Support Forum - aspose.com

Export Word page to HTML

Hi,

I need to convert Word document to HTML. But only specific page(s) should be converted. I’ve read Convert a big word document into multiple HTML documents and understand the case.

But if I can pick a word page and save as PNG, why I can not do it with HTML?
Aspose.Words.Saving.ImageSaveOptions has PageIndex and PageCount properties (I’ve tried them, they work), but Aspose.Words.Saving.HtmlSaveOptions does not.

I searched on forum, but could not find an answer. Is there a way to achieve this goal?
I read about sections and page breaks, but there is no guaranty of existance of such things in documents.

Thanks,

Hi Huseyin,


Thanks for your inquiry. Well, HTML based formats are not paginated that is why when you view the Word document in the web layout, it shows as one continuous document. Secondly, you can use HtmlFixedSaveOptions.PageIndex and HtmlFixedSaveOptions.PageCount properties to export a single page to HTML format as follows:

Document doc = new Document(@“C:\Temp\in.doc”);

HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();<o:p></o:p>

saveOptions.PageIndex = 0;<o:p></o:p>

saveOptions.PageCount = 1;<o:p></o:p>

doc.Save(@“C:\temp\out.html”, saveOptions);

I hope, this helps.

Best regards,

Hi,


I’ve tried it. It worked.

Thanks.