TTMSFNCCustomDataGrid.LoadFromCSVData Method
Loads cell data from a CSV file using the system default (ANSI) encoding.
API unit family: TMSFNCDataGrid
Declaring type: TTMSFNCCustomDataGrid
Overloads
Overload 1
Loads cell data from a CSV file using the system default (ANSI) encoding.
procedure LoadFromCSVData(AFileName: string); overload; virtual;
virtual void __fastcall LoadFromCSVData(System::UnicodeString AFileName)/* overload */;
Remarks
Values are written from Options.IO.StartRow / Options.IO.StartColumn on; RowCount is adjusted to the loaded rows and ColumnCount grows to the widest line. The delimiter comes from Options.IO.Delimiter and is detected automatically when it is #0; Options.IO.MaxRows limits the number of lines. Each value passes through OnLoadCellData.
Use the overload with an encoding for UTF-8 files.
Parameters
| Name | Description |
|---|---|
AFileName |
Path of the CSV file to load. |
Exceptions
| Exception | Description |
|---|---|
Exception |
Raised when the file is empty. |
Examples
Grid.LoadFromCSVData('data.csv', TEncoding.UTF8);
Related API
Overload 2
Loads cell data from a CSV file using the specified encoding.
procedure LoadFromCSVData(AFileName: string; AEncoding: TEncoding); overload; virtual;
virtual void __fastcall LoadFromCSVData(System::UnicodeString AFileName, System::Sysutils::TEncoding* AEncoding)/* overload */;
Remarks
Uses Options.IO (start row/column, delimiter, maximum rows) like the other CSV overloads.
Parameters
| Name | Description |
|---|---|
AFileName |
Path of the CSV file to load. |
AEncoding |
Text encoding used to read the file, for example TEncoding.UTF8. |
Exceptions
| Exception | Description |
|---|---|
Exception |
Raised when the file is empty. |