Methods

static

detectFileFormat(stream) → FileFormatInfo

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

Parameter

Name Type Optional Description

stream

InputStream

 

The stream

Returns

FileFormatInfo A FileFormatInfo object that contains the detected information.

static

detectFileFormat()

static

detectFileFormat(filePath) → FileFormatInfo

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

Parameter

Name Type Optional Description

filePath

String

 

The file path.

Returns

FileFormatInfo A FileFormatInfo object that contains the detected information.

static

detectFileFormat(filePath, password) → FileFormatInfo

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

Parameters

Name Type Optional Description

filePath

String

 

The file path.

password

String

 

The password for encrypted ooxml files.

Returns

FileFormatInfo A FileFormatInfo object that contains the detected information.

static

detectFileFormatFromStream(stream, callback) → FileFormatInfo

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

Example

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var readStream = fs.createReadStream("Book2.xlsx");
aspose.cells.FileFormatUtil.detectFileFormatFromStream(readStream, function(result, err) {
if (!err) {
console.log("detect result: " + result.getFileFormatType());
}
});

Parameters

Name Type Optional Description

stream

ReadableStream

 

The stream

callback

Callback

 

The callback function

Returns

FileFormatInfo A FileFormatInfo object that contains the detected information.

static

extensionToSaveFormat(extension) → Number

Converts a file name extension into a SaveFormat value. If the extension cannot be recognized, returns SaveFormat.UNKNOWN.

Parameter

Name Type Optional Description

extension

String

 

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

Returns

Number A SaveFormat value.

static

fileFormatToSaveFormat(format) → Number

Converting file format to save format.

Parameter

Name Type Optional Description

format

Number

 

FileFormatType

Returns

Number A SaveFormat value.

static

isTemplateFormat(extension) → boolean

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

Parameter

Name Type Optional Description

extension

String

 

Returns

boolean 

static

loadFormatToExtension(loadFormat) → String

Converts a load format enumerated value into a file extension. If it can not be converted, returns null.

Parameter

Name Type Optional Description

loadFormat

Number

 

LoadFormat

Returns

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

static

loadFormatToSaveFormat(loadFormat) → Number

Converts a LoadFormat value to a SaveFormat value if possible.

Parameter

Name Type Optional Description

loadFormat

Number

 

LoadFormat

Returns

Number A SaveFormat value. The save format.

static

saveFormatToExtension(format) → String

Converts a save format enumerated value into a file extension.

Parameter

Name Type Optional Description

format

Number

 

SaveFormat

Returns

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

static

saveFormatToLoadFormat(saveFormat) → Number

Converts a SaveFormat value to a LoadFormat value if possible.

Parameter

Name Type Optional Description

saveFormat

Number

 

SaveFormat

Returns

Number A LoadFormat value. The load format

static

verifyPassword(stream, password) → boolean

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

Parameters

Name Type Optional Description

stream

InputStream

 

password

String

 

The password for encrypted ooxml files.

Returns

boolean Returns whether the password is corrected.