Class FileFormatUtil

Class FileFormatUtil

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

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

public class FileFormatUtil

Inheritance

objectFileFormatUtil

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods

DetectFileFormat(Stream)

Detects and returns the information about a format of an excel stored in a stream.

public static FileFormatInfo DetectFileFormat(Stream stream)

Parameters

stream Stream

Returns

FileFormatInfo

A Aspose.Cells.FileFormatInfo object that contains the detected information.

DetectFileFormat(Stream, string)

Detects and returns the information about a format of an excel stored in a stream.

public static FileFormatInfo DetectFileFormat(Stream stream, string password)

Parameters

stream Stream

password string

The password for encrypted ooxml files.

Returns

FileFormatInfo

A Aspose.Cells.FileFormatInfo object that contains the detected information.

DetectFileFormat(string)

Detects and returns the information about a format of an excel stored in a file.

public static FileFormatInfo DetectFileFormat(string filePath)

Parameters

filePath string

The file path.

Returns

FileFormatInfo

A Aspose.Cells.FileFormatInfo object that contains the detected information.

DetectFileFormat(string, string)

Detects and returns the information about a format of an excel stored in a file.

public static FileFormatInfo DetectFileFormat(string filePath, string password)

Parameters

filePath string

The file path.

password string

The password for encrypted ooxml files.

Returns

FileFormatInfo

A Aspose.Cells.FileFormatInfo object that contains the detected information.

ExtensionToSaveFormat(string)

Converts a file name extension into a SaveFormat value.

public static SaveFormat ExtensionToSaveFormat(string extension)

Parameters

extension string

The file extension. Can be with or without a leading dot. Case-insensitive.

Returns

SaveFormat

Remarks

If the extension cannot be recognized, returns Aspose.Cells.SaveFormat.Unknown.

FileFormatToSaveFormat(FileFormatType)

Converting file format to save format.

public static SaveFormat FileFormatToSaveFormat(FileFormatType format)

Parameters

format FileFormatType

The file format type.

Returns

SaveFormat

IsTemplateFormat(string)

Returns true if the extension is .xlt, .xltX, .xltm,.ots.

public static bool IsTemplateFormat(string extension)

Parameters

extension string

Returns

bool

LoadFormatToExtension(LoadFormat)

Converts a load format enumerated value into a file extension.

public static string LoadFormatToExtension(LoadFormat loadFormat)

Parameters

loadFormat LoadFormat

The loaded file format.

Returns

string

The returned extension is a lower-case string with a leading dot.

Remarks

If it can not be converted, returns null.

LoadFormatToSaveFormat(LoadFormat)

Converts a LoadFormat value to a SaveFormat value if possible.

public static SaveFormat LoadFormatToSaveFormat(LoadFormat loadFormat)

Parameters

loadFormat LoadFormat

The load format.

Returns

SaveFormat

The save format.

SaveFormatToExtension(SaveFormat)

Converts a save format enumerated value into a file extension.

public static string SaveFormatToExtension(SaveFormat format)

Parameters

format SaveFormat

The save format.

Returns

string

The returned extension is a lower-case string with a leading dot.

SaveFormatToLoadFormat(SaveFormat)

Converts a SaveFormat value to a LoadFormat value if possible.

public static LoadFormat SaveFormatToLoadFormat(SaveFormat saveFormat)

Parameters

saveFormat SaveFormat

The save format.

Returns

LoadFormat

The load format

VerifyPassword(Stream, string)

Detects and returns the information about a format of an excel stored in a stream.

public static bool VerifyPassword(Stream stream, string password)

Parameters

stream Stream

password string

The password for encrypted ooxml files.

Returns

bool

Returns whether the password is corrected.