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

Glossary Item Box

SSExportToTextFileU Function


See Also    ActiveX

Applies To

fpSpread control

Description

Saves a sheet to a Unicode text file and lets you specify the delimiters.

Syntax

C

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

C++

BOOL TSpread::ExportToTextFileU(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 Unicode text file to create
pcszCellDelim Cell delimiter
For more information about the cell delimiter, see the Remarks section.
pcszColDelim Column delimiter
pcszRowDelim Row delimiter
If you do not provide a row delimiter, the control uses a carriage return/line feed as the delimiter.
lFlags Whether to append or over-write the file, whether to export formatted or unformatted data, and whether to export column and row headers
You must specify whether to append or create a new file. If you do not specify other options, formatted data will be exported, without column and row header text.
Use the (|) OR operator and combine the following values as indicated:
Constant Description
Use one of the following values:
SS_EXPORTTEXT_CREATE To create a new text file
SS_EXPORTTEXT_APPEND To append to an existing text file
Use the following value:
SS_EXPORTTEXT_UNFORMATTED To export data as unformatted data
Use one or both of the following values:
SS_EXPORTTEXT_COLHEADERS To export column header text
SS_EXPORTTEXT_ROWHEADERS To export row header text
Use the following value:
SS_EXPORTTEXT_CHECKBOXFALSE To write the false value as 0
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 "".

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 the SSExportToTextFileU function to save a Unicode sheet to a text file. If you want to save the sheet to an ANSI text file, call the SSExportToTextFile function.

Use strings to specify the delimiters to separate your data in the text file. If you do not want to provide a column delimiter, specify " " as the delimiter. If you do not provide a row delimiter, the control uses a carriage return/line feed as the delimiter. You can use more than one character as the delimiter, enabling you to insert field names around data.

If you have specified a column or row delimiter, a cell delimiter is automatically provided. The cell delimiter is provided if one of the following is true:

By default, the control provides double quotes (") as the cell delimiter. You can specify another delimiter, if you prefer.

If the data contains the character used as the column or row delimiter, the entire cell data is placed between the cell delimiter character. For example, if the column delimiter is a comma, the data ab,cd becomes "ab,cd". If the data contains the character defined as the cell delimiter, the character in the data is preceded by another cell delimiter; for example, ab,"cd becomes "ab,""cd". Only cells that have data that contains a delimiter character have cell delimiters applied to them.

Use the lFlags parameter to specify whether formatted or unformatted data is saved to the text file. For more information about formatted and unformatted data, see Formatted and Unformatted Data. Also use the lFlags parameter to specify whether to append the data to an existing file, or to create a new file, and to specify whether column and row headers are exported.

By default, text files with custom delimiters created using Spread or the Spread Designer have the extension .TXT. However, you can use any extension.

Tip: You might want to save your sheet as a Spread (.SS8) file in addition to exporting it to text so that you can open the Spread (.SS8) file for future modifications.

The following table summarizes the formats to which you can save data:

To Save To . . . Use Function
Binary file (proprietary format) SSSaveToFile
Tab-delimited file SSSaveTabFile or SSSaveTabFileU
Delimited file (offers user-defined delimiters) SSExportToTextFile or SSExportRangeToTextFile
or SSExportToTextFileU or SSExportRangeToTextFileU
Excel-formatted file SSExportExcelBook or SSExportToExcel
HTML file SSExportToHTML or SSExportRangeToHTML
XML file SSExportToXML or SSExportRangeToXML
XML buffer SSExportToXMLBuffer or SSExportRangeToXMLBuffer
An array SSGetArray

Note that the SSSaveTabFileU and the SSExportRangeToTextFileU and SSExportToTextFileU functions are similar. If you want to save the entire sheet to a Unicode tab-delimited file, you might find it faster to call the SSSaveTabFileU function. If you want to save only a portion of the sheet, or if you want to define your own delimiters, call the SSExportRangeToTextFileU or SSExportToTextFileU function.

Return Type

True if the function completes successfully; False otherwise.

See Also

Saving to a Text File

SSExportRangeToTextFile, SSExportRangeToTextFileU, SSExportToTextFile, SSLoadTextFile, SSSaveTabFileU, SSSetSheet functions

ActiveX Correspondence

ExportToTextFileU method

Copyright © GrapeCity, inc. All rights reserved.