FlexCel Studio for VCL/LCL
ContentsIndex
PreviousUpNext
TFlexCelImport.OpenText Method (TFileName, UTF16Char)

This method will create a new worksheet and load a text file into it.

Pascal
procedure OpenText(const FileName: TFileName; const Delimiter: UTF16Char); overload;
C++
__fastcall OpenText(const TFileName FileName, const UTF16Char Delimiter);
Parameters 
Description 
const FileName: TFileName 
File to Open. 
const Delimiter: UTF16Char 
The character used to separate fields. 

If you need more control, for example to import a text file beginning on cell C4 of an existing worksheet, you should use the LoadFromTextDelim global method (on unit "UTextDelim").

To open a CSV file (Comma Separated Values):

OpenText('Filename', ',' );

 

To open a CSV file (Comma Separated Values) that uses ";" instead of "," to separate the fields:

//This is the way CSV is saved on countries where the "," and not the "." is the decimal separator.
OpenText('Filename', ';' );

 

To open a Tab Delimited file:

OpenText('Filename', #9 );
Copyright (c) 2002-2008 TMS Software. All rights reserved.
What do you think about this topic? Send feedback!