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

Free Support Forum - aspose.com

Convert document to HTML without HTML, Head and Body tags using C#

I can create word file and convert HTML with aspose.words API. How do I get the BODY content in HTML with the API (withou html,head,body tag/ only body content). I will use this to show the output in the WYSIWYG editors (summernote) application.

Note: I am developing the application with .net Framework (C#)


Following code example shows how to export first section of document into HTML without HTML, Head and Body tags. You can iterate over sections of document and export its body to HTML as shown below.

Document doc = new Document(MyDir + "inputdocx.docx");
Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions();
String html = doc.FirstSection.Body.ToString(options);