TCustomStringGrid.LoadFromCSVFile procedure
Loads the grid from a file with delimited values for the columns and rows.
Declaration
procedure LoadFromCSVFile(AFilename: string; ADelimiter: char=',';
UseTitles: Boolean=True; FromLine: Integer=0;
SkipEmptyLines: Boolean=True)Arguments
AFilename | File name with the content loaded in the method. |
ADelimiter | Delimiter between cell values in the file; default is Comma (','). |
UseTitles | Indicates if column captions are loaded from values in the file. |
FromLine | Initial line number from the file loaded in the method. |
SkipEmptyLines | Indicates if empty lines in the file are ignored in the method. |
Description
LoadFromCSVFile is a method used to delimited values from the file name in
AFilename. It creates a temporary TFileStream instance
that is used to load values from the file by calling the
LoadFromCSVStream method.
ADelimiter is a character which identifies the delimiter used
between column values on a row. Its default value is ',' (Comma) (decimal
44), but can be changed to another character value if needed.
Each row of values is terminated by a Carriage Return (Decimal 13) or Line Feed (Decimal 10) character. CR+LF may also be used. When either of the characters is encountered, they are processed as an end-of-line marker.
UseTitles indicates whether the first row of values in the file
are treated as fixed column titles in the grid. When set to
True,
each column value is stored as the caption for the corresponding entry in
the Columns collection (when enabled). The Columns collection is enabled when
its Count property has a positive non-zero value. If Columns are not used, the
values are stored as Cell data in row 0. If UseTitles is set to
False,
the first row is treated as Cell data in row 0. The default value for UseTitles
is
True.
FromLine indicates the ordinal line number that is the first row
loaded in the method. The default value is 0, and causes processing to begin
at the first line. When a positive non-zero value is used, the specified number
of lines are skipped by reading the corresponding number of end-of-line
sequences.
SkipEmptyLines indicates whether blank lines are skipped when the
row and column values are loaded in the method. The default value is
True, and causes any row with a single empty column value to be
skipped.
Use LoadFromCSVStream to load delimited row and column values from a TStream instance.
Use SaveToCSVFile or SaveToCSVStream to store the content in the grid as comma-separated values.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
