XlsFile.Import Method
Overloads
- XlsFile.Import(TextReader, Int32, Int32, Int32[], ColumnImportType[], String[])
- XlsFile.Import(TextReader, Int32, Int32, Char, Char, ColumnImportType[], String[])
XlsFile.Import(TextReader, Int32, Int32, Int32[], ColumnImportType[], String[])
Imports a text file (fixed length columns) into the current sheet. Note that this method won't clear any existing data.
Syntax
Namespace: FlexCel.XlsAdapter
public override void Import(TextReader aTextReader, Int32 firstRow, Int32 firstCol, Int32[] columnWidths, ColumnImportType[] columnFormats, String[] dateFormats)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
aTextReader | TextReader | StreamReader with the text to import. | |
firstRow | Int32 | Row in the Active sheet where we will start importing the text file. | |
firstCol | Int32 | Column in the Active sheet where we will start importing the text file. | |
columnWidths | Int32[] | An array with the column widths for every column you want to import. | |
columnFormats | ColumnImportType[] | An array of ColumnImportType elements, telling how each column should be imported. See the example in ExcelFile.Open(Stream, TFileFormats, Char, Int32, Int32, ColumnImportType[]) for more information on how to use it. |
|
dateFormats | String[] | A list of formats allowed for dates and times, when opening text files. Windows is a little liberal in what it thinks can be a date, and it can convert things like "1.2" into dates. By setting this property, you can ensure the dates are only in the formats you expect. If you leave it null, we will trust "DateTime.TryParse" to guess the correct values. This value has no meaning in normal xls files, only text files. |
See also
XlsFile.Import(TextReader, Int32, Int32, Char, Char, ColumnImportType[], String[])
Imports a text file (character-delimited columns) into the current sheet. Note that this method won't clear any existing data.
Syntax
Namespace: FlexCel.XlsAdapter
public override void Import(TextReader aTextReader, Int32 firstRow, Int32 firstCol, Char delimiter, Char textQualifier, ColumnImportType[] columnFormats, String[] dateFormats)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
aTextReader | TextReader | TextReader with the text to import. | |
firstRow | Int32 | Row in the Active sheet where we will start importing the text file. | |
firstCol | Int32 | Column in the Active sheet where we will start importing the text file. | |
delimiter | Char | Character used to separate columns. | |
textQualifier | Char | Character used to quote strings when they contain the delimiter. This is normally the double quote (") but you might change it by a single quote or any other character. Use a char 0 if the original file isn't quoted. | |
columnFormats | ColumnImportType[] | An array of ColumnImportType elements, telling how each column should be imported. See the example in ExcelFile.Open(Stream, TFileFormats, Char, Int32, Int32, ColumnImportType[]) for more information on how to use it. |
|
dateFormats | String[] | A list of formats allowed for dates and times, when opening text files. Windows is a little liberal in what it thinks can be a date, and it can convert things like "1.2" into dates. By setting this property, you can ensure the dates are only in the formats you expect. If you leave it null, we will trust "DateTime.TryParse" to guess the correct values. This value has no meaning in normal xls files, only text files. |