Importing and exporting DataWindow data

NotePowerBuilder 9 formats not supported In PowerBuilder 9, ImportFile was enhanced to support CSV and XML, and SaveAs was enhanced to support PDF, XML, and XSL-FO. Except for CSV, these formats are not supported in PocketBuilder.

You can use the ImportFile function to import data into a DataWindow control from a tab-delimited text (.txt) file or a comma-separated values (.csv) file.

Table 19-1: Formats for ImportFile

File type

File format to be imported

.txt

On the desktop, both ANSI and Unicode files can be imported in PocketBuilder, but only Unicode files can be imported on a deployment device. Unicode files cannot be imported into PowerBuilder 9, but can be imported into PowerBuilder 10 and higher.

.csv

Files created using either PowerBuilder or PocketBuilder can be imported into both versions.

You use the SaveAs function to save the contents of a DataWindow control to one of several file formats. The following table summarizes whether the file formats differ—specifically how character strings are handled and whether they are saved in ANSI or Unicode format.

Table 19-2: Formats for SaveAs

File type

Format of saved file

CSV!

Comma-separated values saved as Unicode strings

DIF!, Excel!, Excel5!, WKS!

Character strings saved as ANSI strings

HTMLTable!

HTML syntax saved as Unicode strings

SQLInsert!

SQL syntax and data values saved as Unicode strings

Text!

Text saved as Unicode strings