KS CSV-Reader OCX Documentation
Fast CSV-Reader Component
Library: KSCSVLib (KSCSV ActiveX Control module)
GUID: {9D50E0E8-3451-4D82-B3EC-4E85E8C7D3CE}
Version: 1.2
Dependencies: none
General Information
Download
License
Installation
Interface
Sample Source Code
General Information
KS CSV-Reader Control enables you to read CSV-Table data from Comma-Seperated-Values files.
CSV files are written by database application and are a widly used standard for data exchange between applications.
Most database applications support CSV export.
Main advantages of using KS CSV-Reader are
- No other dependencies to other database libraries as MS-ADO/MS-Jet, etc.
- Read UNIX style CSV-files (with LineFeed line delimiters) as well
- Optional convert from DOS to ANSI character set
- Read CSV-Files with text lines over line boundaries (wich are invalid CSV-files,
but many applications write those files when exporting long text fields with line breaks.)
- Autodetect delimiters
- Error tolerant
- Fast scan for maximum column widths
- Fast C++ implementation
Download
You can always find the current version at
http://www.kroll-software.de/download/KSCSV.zip
Different versions will have the same download filename.
License
Disclaimer: KS CSV-Reader Control is provided "as is" with no warranty of any kind.
KS CSV-Reader Control is not Freeware.
The Demo Version returns a maximum of 1.000 lines/records. With a valid license, the control returns all lines/records.
More information about licensing the control can be found at the
Kroll-Software website.
Or contact info@kroll-software.de
Installation
- Copy the file kscsv.ocx to a directory with a short (DOS) pathname
- Open the windows command prompt
- Register the control with the following command
regsvr32.exe <Drive:Path\>kscsv.ocx
Enumerations
KSCSVLib.ColumnTypes
CT_UNKNOWN = 0
CT_STRING = 1
Properties
| Property |
Type |
In/Out |
Default |
Remark |
| ColumnCount |
long |
read only |
0 |
Number of Columns |
| ColumnHeaders |
Boolean |
read/write |
True |
First line has column headers / skip first line |
| ColumnMaxLen(ColumnIndex As Integer) |
long |
read only |
0 |
Maximum text-width of this column |
| ColumnType(ColumnIndex As Integer) |
ColumnTypes |
read only |
CT_UNKNOWN |
Text or unknown column. Text, if there was a TextDelimiter |
| ColumnValue(ColumnIndex As Integer) |
String |
read only |
"" |
Current Data Value |
| ConvertFromAscii |
Boolean |
read/write |
False |
Convert from DOS to ANSI character set |
| DecimalMarker |
String |
read/write |
, |
Decimal delimiter |
| Delimiter |
String |
read/write |
; |
Delimiter |
| EOF |
Boolean |
read only |
False |
End Of File |
| Filename |
String |
read/write |
"" |
Full path to CSV-file |
| LastError |
Long |
read only |
0 |
0 = no error; other than 0: check LastErrorDescription |
| LastErrorDescription |
String |
read only |
"" |
Error message if LastError <> 0 |
| ProgressPercent |
Double |
read only |
0.0 |
Progress in percent (0..100) |
| ReadBufferSize |
long |
read/write |
4096 |
Readbuffer size |
| Recordcount |
long |
read only |
0 |
Number of records/lines read |
| StringBufferSize |
long |
read/write |
65535 |
Size of the StringBuffer = max. Stringsize |
| TextMarker |
String |
read/write |
" |
Delimiter for text-values |
Methods
AboutBox()
Return Value: void
Parameters: none
Shows the AboutBox.
AutoDetectDelimiter()
Return Value: String
Parameters: none
Returns the detected delimiter or empty string if the delimiter could not be detected.
Cancel()
Return Value: void
Parameters: none
Cancels a ReadMaxColumnWidth() process.
Close()
Return Value: void
Parameters: none
Closes a CSV-File opend with Open().
InitRead()
Return Value: Boolean
Parameters: none
Initializes read, resets the internal cursor to the first position.
Returns True for success
InitReadLine()
Return Value: Boolean
Parameters: none
Initializes line-read, resets the internal cursor to the first line.
Returns True for success
License()
Return Value: void
Parameters: LicUser As String, LPCTSTR As String
Unlocks the component to the full version.
LineValue()
Return Value: String
Parameters: none
Contents of the current line.
MoveFirst()
Return Value: void
Parameters: none
Move to the first line (table data).
MoveFirstLine()
Return Value: void
Parameters: none
Move to the first line (line data).
MoveNext()
Return Value: void
Parameters: none
Move to the next line (table data).
MoveNextLine()
Return Value: void
Parameters: none
Move to the next line (line data).
Open()
Return Value: Boolean
Parameters: none
Open the CSV-file specified with Property Filename.
Returns True for success
ReadMaxColumnWidth()
Return Value: void
Parameters: none
Fast scan the entire file for maximum column lengths.
Check the max len of each column with ColumnMaxLen(ColumnIndex As Integer)
Reset()
Return Value: void
Parameters: none
Reset everything to it's defaults.
Sample Source Code
Pseudo Code (VB6 like)
--- End ---