|
ERRCODE TFormer_SetTxtDataFile |
( |
HTFORM |
pInstance, |
|
|
LPCSTR |
pszFileName, |
|
|
CHAR |
cSeparator, |
|
|
CHAR |
cTextQualifier | |
|
) |
| | |
Specifies a text-file as DataSource.
- Returns:
- - ErrOk (0) in case of success
- Non-zero if error occurred
- Parameters:
-
[in] | pInstance | The TFORMer-Instance provided by a previous call to TFormer_Init. |
[in] | pszFileName | Data-File Name. |
[in] | cSeparator | DataField separator (e.g. , or ;). |
[in] | cTextQualifier | Text qualifier (e.g. ' or " - default is none). |
- Note:
- Behavior if no input data was supplied: If no DataSource was specified (either by TFormer_SetXXXDataFile, TFormer_SetODBCData or via TFormer_NewRecord and TFormer_SetVarValue) the default data-file (located in the same directory as the FormLayout itself and generated by the last TFORMer Designer session) is used. If this default data-file does not exists no output will be produced. The name of the default data-file is
path/FormName.xml .
A data file may be passed in the following ways:
- Specify the filename directly.
- Specify the filename of a ZIP-file (e.g. with WinZip) containing the required file.
- BASE64-encode the content of the required file (see Convert class of .NET) and use this string instead of a filename.
- BASE64-encode the content of a ZIP-file (see Convert class of .NET) containing the required file(s). Use this string instead of a filename.
- Note:
- BASE64 encoded strings must start with the sequence
BASE64: . When passing a zipped file TFORMer expects a real WinZip compatible format. A zipped stream is not suitable! For more details please refer to the TFORMer Runtime DLL Programming Reference.
Must be called after TFormer_SetFormName and before TFormer_Print.
The following example file contains 2 records. The first line lists the DataField-names. The comma (,) is used as Separator-character and the double quote (") is used as Qualifier-character:
Sample CSV-File
Name/Value | Separator | Name/Value | Separator | Name/Value |
"Email" | , | "JobTitle" | , | "Name" |
"support@tec-it.com" | , | "Support Engineer" | , | "Mr. Harald Backoffice" |
"sales@tec-it.com" | , | "Sales Assistant" | , | "Mrs. Susan Frontdesk" |
- See also:
- TFormer_SetXmlDataFile, TFormer_SetImportFieldForRecordCopy.
|