FileFormatUtil class
FileFormatUtil class
Provides utility methods for working with file formats, such as detecting file format or converting file extensions to/from file format enums. To learn more, visit the Detect File Format and Check Format Compatibility documentation article.
Methods
Name | Description |
---|---|
contentTypeToLoadFormat(contentType) | Converts IANA content type into a load format enumerated value. |
contentTypeToSaveFormat(contentType) | Converts IANA content type into a save format enumerated value. |
detectFileFormat(fileName) | Detects and returns the information about a format of a document stored in a disk file. |
detectFileFormat(stream) | Detects and returns the information about a format of a document stored in a stream. |
extensionToSaveFormat(extension) | Converts a file name extension into a SaveFormat value. |
imageTypeToExtension(imageType) | Converts an Aspose.Words image type enumerated value into a file extension. The returned extension is a lower-case string with a leading dot. |
loadFormatToExtension(loadFormat) | Converts a load format enumerated value into a file extension. The returned extension is a lower-case string with a leading dot. |
loadFormatToSaveFormat(loadFormat) | Converts a LoadFormat value to a SaveFormat value if possible. |
saveFormatToExtension(saveFormat) | Converts a save format enumerated value into a file extension. The returned extension is a lower-case string with a leading dot. |
saveFormatToLoadFormat(saveFormat) | Converts a SaveFormat value to a LoadFormat value if possible. |
Examples
Shows how to detect encoding in an html file.
let info = aw.FileFormatUtil.detectFileFormat(base.myDir + "Document.html");
expect(info.loadFormat).toEqual(aw.LoadFormat.Html);
// The Encoding property is used only when we create a FileFormatInfo object for an html document.
expect(info.encoding).toEqual("windows-1252");
See Also
- module Aspose.Words