Back to Devexpress

TdxCustomSpreadSheet.LoadFromStream(TStream,TdxSpreadSheetCustomFormatClass) Method

vcl-dxspreadsheetcore-dot-tdxcustomspreadsheet-dot-loadfromstream-x28-system-dot-classes-dot-tstream-dxspreadsheetcore-dot-tdxspreadsheetcustomformatclass-x29.md

latest4.1 KB
Original Source

TdxCustomSpreadSheet.LoadFromStream(TStream,TdxSpreadSheetCustomFormatClass) Method

Loads a spreadsheet document from a stream.

Declaration

delphi
procedure LoadFromStream(AStream: TStream; AFormat: TdxSpreadSheetCustomFormatClass); overload; virtual;

Parameters

NameTypeDescription
AStreamTStream

The source stream.

| | AFormat | TdxSpreadSheetCustomFormatClass |

The required spreadsheet document format for the source stream (AStream).

The specified format must match the actual document format within the source stream. Otherwise, an error occurs.

|

Remarks

Call this procedure to load workbook data and accompanying settings previously saved to a stream (an instance of the TStream descendant) passed as the AStream parameter. The information loaded from the specified stream can include (depending on its internal data format):

The LoadFromFile procedure calls the LoadFromStream procedure to load a spreadsheet document from a file stream. Calling this procedure raises the OnProgress event multiple times on reaching certain inner marks dependant on the steam data format, allowing you to track the loading progress.

The AFormat parameter in the second overloaded version allows you to specify a custom stream object format class. For instance, if you need to load CSV from a stream, specify the class reference to an object corresponding to the CSV format explicitly:

delphi
var
  AStream: TMemoryStream;
//...
  dxSpreadSheet1.LoadFromStream(AStream, TdxSpreadSheetCSVFormat);
cpp
TMemoryStream* AStream;
//...
  dxSpreadSheet1->LoadFromStream(AStream, TdxSpreadSheetCSVFormat);

Note

The CSV file format settings, applied to all Save/Load operations, can be customized by calling the dxSpreadSheetCSVFormatSettings function declared in the dxSpreadSheetFormatCSV unit.

See Also

TdxCustomSpreadSheet.SaveToFile

TdxCustomSpreadSheet.SaveToStream

TdxCustomSpreadSheet Class

TdxCustomSpreadSheet Members

dxSpreadSheetCore Unit