com.aspose.words

Class HtmlVersion

  • java.lang.Object
    • com.aspose.words.HtmlVersion
public class HtmlVersion 
extends java.lang.Object

Utility class containing constants. Indicates the version of HTML is used when saving the document to SaveFormat.HTML and SaveFormat.MHTML formats.

Example:

Shows how to set a saved .html document to a specific version.
Document doc = new Document(getMyDir() + "Rendering.docx");

// Save the document to a .html file of the XHTML 1.0 Transitional standard
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
{
    options.setHtmlVersion(com.aspose.words.HtmlVersion.XHTML);
    options.setExportXhtmlTransitional(true);
    options.setPrettyFormat(true);
}

// The DOCTYPE declaration at the top of this document will indicate the html version we chose
doc.save(getArtifactsDir() + "HtmlSaveOptions.HtmlVersion.html", options);

Field Summary
static final intXHTML = 0
Saves the document in compliance with the XHTML 1.0 Transitional standard.
static final intHTML_5 = 1
Saves the document in compliance with the HTML 5 standard.
 

    • Field Detail

      • XHTML = 0

        public static final int XHTML
        Saves the document in compliance with the XHTML 1.0 Transitional standard.

        Aspose.Words aims to output XHTML according to the XHTML 1.0 Transitional standard, but the output will not always validate against the DTD. Some structures inside a Microsoft Word document are hard or impossible to map to a document that will validate against the XHTML schema. For example, XHTML does not allow nested lists (UL cannot be nested inside another UL element), but in Microsoft Word document multilevel lists occur quite often.

      • HTML_5 = 1

        public static final int HTML_5
        Saves the document in compliance with the HTML 5 standard.