Click or drag to resize
LoadFormat Enumeration
Indicates the format of the document that is to be loaded.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public enum LoadFormat
Members
  Member nameValueDescription
Auto0 Instructs Aspose.Words to recognize the format automatically.
Doc10 Microsoft Word 97 - 2007 Document.
Dot11 Microsoft Word 97 - 2007 Template.
DocPreWord6012 The document is in the Word 6 or Word 95 format. Aspose.Words does not currently support loading such documents.
Docx20 Office Open XML WordprocessingML Document (macro-free).
Docm21 Office Open XML WordprocessingML Macro-Enabled Document.
Dotx22 Office Open XML WordprocessingML Template (macro-free).
Dotm23 Office Open XML WordprocessingML Macro-Enabled Template.
FlatOpc24 Office Open XML WordprocessingML stored in a flat XML file instead of a ZIP package.
FlatOpcMacroEnabled25 Office Open XML WordprocessingML Macro-Enabled Document stored in a flat XML file instead of a ZIP package.
FlatOpcTemplate26 Office Open XML WordprocessingML Template (macro-free) stored in a flat XML file instead of a ZIP package.
FlatOpcTemplateMacroEnabled27 Office Open XML WordprocessingML Macro-Enabled Template stored in a flat XML file instead of a ZIP package.
Rtf30 RTF format.
WordML31 Microsoft Word 2003 WordprocessingML format.
Html50 HTML format.
Mhtml51 MHTML (Web archive) format.
Mobi52 MOBI is an eBook format used by the MobiPocket Reader and Amazon Kindle Readers.
Odt60 ODF Text Document.
Ott61 ODF Text Document Template.
Text62 Plain Text.
Markdown63 Markdown text document.
Unknown255 Unrecognized format, cannot be loaded by Aspose.Words.
Examples
Explicitly loads a document as HTML without automatic file format detection.
LoadOptions loadOptions = new LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Html;

Document doc = new Document(MyDir + "Document.LoadFormat.html", loadOptions);
Examples
Shows how to open older binary DOC format for Word6.0/Word95 documents
LoadOptions loadOptions = new LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.DocPreWord60;

Document doc = new Document(MyDir + "Document.PreWord60.doc", loadOptions);
Examples
Shows how to insert the HTML contents from a web page into a new document.
// The url of the page to load 
String url = "http://www.aspose.com/";

// Create a WebClient object to easily extract the HTML from the page.
WebClient client = new WebClient();
String pageSource = client.DownloadString(url);
client.Dispose();

// Get the HTML as bytes for loading into a stream.
Encoding encoding = client.Encoding;
byte[] pageBytes = encoding.GetBytes(pageSource);

// Load the HTML into a stream.
using (MemoryStream stream = new MemoryStream(pageBytes))
{
    // The baseUri property should be set to ensure any relative img paths are retrieved correctly.
    LoadOptions options = new LoadOptions(Aspose.Words.LoadFormat.Html, "", url);

    // Load the HTML document from stream and pass the LoadOptions object.
    Document doc = new Document(stream, options);

    // Save the document to disk.
    // The extension of the filename can be changed to save the document into other formats. e.g PDF, DOCX, ODT, RTF.
    doc.Save(ArtifactsDir + "Document.HtmlPageFromWebpage.doc");
}
See Also