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
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
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
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
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
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
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
IsTemplateFormat(string)
Returns true if the extension is .xlt, .xltX, .xltm,.ots.
public static bool IsTemplateFormat(string extension)
Parameters
extension
string
Returns
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
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
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
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
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
Returns whether the password is corrected.