aspose.cells

Class FileFormatUtil

Provides utility methods for converting file format enums to strings or file extensions and back.

Method Summary
static functiondetectFileFormat(stream)
Detects and returns the information about a format of an excel stored in a stream.
static functiondetectFileFormat(stream, password)
static functiondetectFileFormat(filePath)
Detects and returns the information about a format of an excel stored in a file.
static functiondetectFileFormat(filePath, password)
Detects and returns the information about a format of an excel stored in a file.
static functionextensionToSaveFormat(extension)
Converts a file name extension into a SaveFormat value.
static functionfileFormatToSaveFormat(format)
Converting file format to save format.
static functionisTemplateFormat(extension)
Returns true if the extension is .xlt, .xltX, .xltm,.ots.
static functionloadFormatToExtension(loadFormat)
Converts a load format enumerated value into a file extension.
static functionloadFormatToSaveFormat(loadFormat)
Converts a LoadFormat value to a SaveFormat value if possible.
static functionsaveFormatToExtension(format)
Converts a save format enumerated value into a file extension.
static functionsaveFormatToLoadFormat(saveFormat)
Converts a SaveFormat value to a LoadFormat value if possible.
static functionverifyPassword(stream, password)
Detects and returns the information about a format of an excel stored in a stream.
 

    • Method Detail

      • detectFileFormat

        static function detectFileFormat(stream)
        Detects and returns the information about a format of an excel stored in a stream.
        Parameters:
        stream: InputStream - The stream
        Returns:
        A FileFormatInfo object that contains the detected information.
      • detectFileFormat

        static function detectFileFormat(stream, password)
      • verifyPassword

        static function verifyPassword(stream, password)
        Detects and returns the information about a format of an excel stored in a stream.
        Parameters:
        stream: InputStream -
        password: String - The password for encrypted ooxml files.
        Returns:
        Returns whether the password is corrected.
      • detectFileFormat

        static function detectFileFormat(filePath)
        Detects and returns the information about a format of an excel stored in a file.
        Parameters:
        filePath: String - The file path.
        Returns:
        A FileFormatInfo object that contains the detected information.
      • detectFileFormat

        static function detectFileFormat(filePath, password)
        Detects and returns the information about a format of an excel stored in a file.
        Parameters:
        filePath: String - The file path.
        password: String - The password for encrypted ooxml files.
        Returns:
        A FileFormatInfo object that contains the detected information.
      • fileFormatToSaveFormat

        static function fileFormatToSaveFormat(format)
        Converting file format to save format.
        Parameters:
        format: Number - A FileFormatType value. The file format type.
        Returns:
        A SaveFormat value.
      • extensionToSaveFormat

        static function extensionToSaveFormat(extension)
        Converts a file name extension into a SaveFormat value. If the extension cannot be recognized, returns SaveFormat.UNKNOWN.
        Parameters:
        extension: String - The file extension. Can be with or without a leading dot. Case-insensitive.
        Returns:
        A SaveFormat value.
      • isTemplateFormat

        static function isTemplateFormat(extension)
        Returns true if the extension is .xlt, .xltX, .xltm,.ots.
        Parameters:
        extension: String -
        Returns:
      • loadFormatToExtension

        static function loadFormatToExtension(loadFormat)
        Converts a load format enumerated value into a file extension. If it can not be converted, returns null.
        Parameters:
        loadFormat: Number - A LoadFormat value. The loaded file format.
        Returns:
        The returned extension is a lower-case string with a leading dot.
      • loadFormatToSaveFormat

        static function loadFormatToSaveFormat(loadFormat)
        Converts a LoadFormat value to a SaveFormat value if possible.
        Parameters:
        loadFormat: Number - A LoadFormat value. The load format.
        Returns:
        A SaveFormat value. The save format.
      • saveFormatToExtension

        static function saveFormatToExtension(format)
        Converts a save format enumerated value into a file extension.
        Parameters:
        format: Number - A SaveFormat value. The save format.
        Returns:
        The returned extension is a lower-case string with a leading dot.
      • saveFormatToLoadFormat

        static function saveFormatToLoadFormat(saveFormat)
        Converts a SaveFormat value to a LoadFormat value if possible.
        Parameters:
        saveFormat: Number - A SaveFormat value. The save format.
        Returns:
        A LoadFormat value. The load format