<< Click to display table of contents >> LoadCSV Function |
The function loads CSV ("comma-separated values") files as a table. Only ANSI files can be loaded.
Unit rvcsv.
function LoadCSV(const FileName: String; rv: TCustomRichView;
Separator: TRVAnsiChar; UseQuotes: Boolean;
TextStyleNo, ParaNo: Integer): TRVTableItemInfo;
Parameters:
FileName – file to load.
rv – TCustomRichView component where you plan to insert the loaded table (it is not inserted by this function).
Separator – character used to separate values. The most common possible values:
•',' (comma)
•';' (semicolon)
•' ' (space)
•#9 (tab)
UseQuotes – if True, double-quotes are used to allow separators inside text values (in the input file); double double-quotes are treated as double-quote character.
TextStyleNo, ParaNo – styles of text and paragraph used to add text
Return value:
the loaded table; nil in case of failure.
Example:
var table: TRVTableItemInfo;
...
table := LoadCSV(FileName, RichViewEdit1, ',', True, 0, 0);
if table<>nil then
RichViewEdit1.InsertItem('', table);
You can implement inserting CSV files using TRVAControlPanel.OnCustomFileOperation event.