Skip to main content
A newer version of this page is available. .
Row

SpreadsheetImageSource.FromFile(String) Method

Creates an image source object from the specified file.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v18.2.Core.dll

Declaration

[ComVisible(false)]
public static SpreadsheetImageSource FromFile(
    string fileName
)

Parameters

Name Type Description
fileName String

A string that contains the path to a file from which to create the image.

Returns

Type Description
SpreadsheetImageSource

A SpreadsheetImageSource object representing the image in the spreadsheet.

Remarks

Note

When you use the FromFile method to create an image, the method locks the file until the application is closed. This happens because the method internally creates a file stream intended to load the image from the file, which is not disposed of together with the Workbook/SpreadsheetControl instance and stays alive until you close the application.

If you require releasing the file while the program is running, you can use the SpreadsheetImageSource.FromStream method to create an image and close the stream manually after the image is inserted into the document.

See Also