Spread 8.0 Documentation
SSLoadTextFile Function
Support Options
DLL Reference > DLL Functions > SSLoadTextFile Function

Glossary Item Box

SSLoadTextFile Function


See Also    ActiveX

Applies To

Spread control

Description

Loads a text file.

Syntax

C

BOOL SSLoadTextFile(HWND hWnd, LPCTSTR pcszFileName, LPCTSTR pcszCellDelim, LPCTSTR pcszColDelim, LPCTSTR pcszRowDelim, long lFlags, LPCTSTR pcszLogFile);

C++

BOOL TSpread::LoadTextFile(LPCTSTR pcszFileName, LPCTSTR pcszCellDelim, LPCTSTR pcszColDelim, LPCTSTR pcszRowDelim, long lFlags, LPCTSTR pcszLogFile);

Parameters

The following parameters are available:

Parameter Description
pcszFileName Path and file name of the text file to load
pcszCellDelim String containing the cell delimiter
For more information about the cell delimiter, see the Remarks section.
pcszColDelim String containing the column delimiter
pcszRowDelim String containing the row delimiter
The row delimiter is required for the method to return TRUE.
Flags Whether the text file provides column and row header text, and whether the sheet maintains formatting settings when loading the text file
Constant Description
SS_LOADTEXT_NOHEADERS The file does not provide header text
SS_LOADTEXT_COLHEADERS The file provides column header text
SS_LOADTEXT_ROWHEADERS The file provides row header text
SS_LOADTEXT_CLEARDATAONLY The sheet clears any existing data, but maintains existing formatting when loading the text file
pcszLogFile Path and file name of log file to create
If you do not provide a file name, the export will not create a log file. If you do not want to create a log file, set this parameter to NULL.

Remarks

This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.

Call this function to load a text file that uses multiple delimiters, or delimiters other than tab characters. Call the SSLoadTabFile function to load a simple, tab-delimited file. Call the SSLoadFromFile function to load a Spread binary (.SS8) file.

If you want your file to be in a spreadsheet format, your text file must have delimiters so the fpSpread control can find the data and populate the sheet appropriately. The text file must have a row delimiter. If you do not specify a row delimiter, the control assumes that a carriage return/line feed is the row delimiter. If the text file does not have a cell or column delimiter, specify "" as the delimiter.

If the file uses a column or row delimiter, and the data itself contains that delimiter character, the control assumes that the data will have a cell delimiter (double quotes (") by default) around the cell's data containing the delimiter character. For example, if your column delimiter is a comma, and a cell contains the data ab,cd, the control assumes the data will be represented as "ab,cd" when reading the file. If a different cell delimiter was used in the file, you must specify it for your file to be read appropriately.

Note: If you are depending on the default cell delimiter value, do not use double quotes (") in your data, or you might encounter unexpected results.

Caution: Loading a text file into the control deletes the data currently in the control. The loaded file overwrites existing data. Also, if your sheet had more columns and rows than the loaded sheet, those columns and rows are removed. For example, if your sheet had 100 columns and rows of data, and the loaded sheet has 50 columns and rows of data, once the new sheet is loaded, the sheet only has 50 columns and rows.

Return Type

True if the method completes successfully; False otherwise.

See Also

Loading a Text File

SSExportRangeToTextFile, SSExportToTextFile, SSLoadFromFile, SSLoadTabFile, SSSetSheet functions

ActiveX Correspondence

LoadTextFile method

Copyright © GrapeCity, inc. All rights reserved.