SaveAs

Description

Saves the data in a graph in the format you specify.

Applies to

PowerBuilder DataWindow

DataWindow control

Syntax

PowerBuilder

integer dwcontrol.SaveAs ( string graphcontrol {, string filename, SaveAsType saveastype, boolean colheading { , encoding } } )

Argument

Description

dwcontrol

A reference to the DataWindow control containing the graph.

graphcontrol 

A string whose value is the name of the graph in the DataWindow control.

filename 

(optional)

A string whose value is the name of the file in which you want to save the data in the graph. If you omit filename or specify an empty string (""), the user is prompted for a file name.

saveastype (optional)

A value of the SaveAsType enumerated datatype (in PowerBuilder) specifying the format in which to save the data represented in the graph.

For a list of values, see SaveAsType.

colheading (optional)

A boolean value indicating whether you want column headings with the saved data. The default value is true. This argument is used for the following formats: Clipboard, CSV, Excel, and Text. For most other formats, column headings are always saved.

encoding (optional)

Character encoding of the file to which the data is saved. This parameter applies only to the following formats: TEXT, CSV, SQL, HTML, and DIF. If you do not specify an encoding parameter, the file is saved in ANSI format. Values are:

  • EncodingANSI! (default)

  • EncodingUTF8!

  • EncodingUTF16LE!

  • EncodingUTF16BE!


Return value

Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, SaveAs returns null.

If you do not specify any arguments, PowerBuilder saves the DataWindow data rather than the data in the graph control. In this case, or in the case where you specify only the graph control name as an argument, PowerBuilder displays the Save As dialog box, letting the user specify the format of the saved data. 

Examples

PowerBuilder

This statement saves the contents of gr_computers in the DataWindow control dw_equipmt to the file G:\INVENTORY\SALES.XLS. The format is comma-separated values with column headings:

dw_equipmt.SaveAs("gr_computers", &
      "G:\INVENTORY\SALES.XLS", CSV!, true)

See also

Print

SaveAs