Search code examples
asposeaspose.words

Aspose.Words convert to html (only body content)


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#)


Solution

  • Document doc = new Document(MyDir + "inputdocx.docx");
    var options = new Aspose.Words.Saving.HtmlSaveOptions(SaveFormat.Html)
    {
    ImageSavingCallback = new HandleImageSaving(),
    }; 
    String html = doc.FirstSection.Body.ToString(options);