Back to Devexpress

SpreadsheetImageSource.FromFile(String) Method

officefileapi-devexpress-dot-spreadsheet-dot-spreadsheetimagesource-dot-fromfile-x28-system-dot-string-x29.md

latest2.3 KB
Original Source

SpreadsheetImageSource.FromFile(String) Method

Creates an image source object from the specified file.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
[ComVisible(false)]
public static SpreadsheetImageSource FromFile(
    string fileName
)
vb
<ComVisible(False)>
Public Shared Function FromFile(
    fileName As String
) As SpreadsheetImageSource

Parameters

NameTypeDescription
fileNameString

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

|

Returns

TypeDescription
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

SpreadsheetImageSource Class

SpreadsheetImageSource Members

DevExpress.Spreadsheet Namespace