Syntax 1 For graph objects – PB Docs 126

Syntax 1 For graph objects

Description

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

Controls

Graph controls in windows and user objects, and graphs in
DataWindow controls and DataStores

Syntax

Argument

Description

controlname

The name of the graph control whose contents
you want to save or the name of the DataWindow DataStore containing
the graph.

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 (“”), PowerBuilder prompts the user for
a file name.

graphcontrol (DataWindow control
only) (optional)

A string whose value is the name of the
graph in the DataWindow control or DataStore whose contents you
want to save.

saveastype (optional)

A value of the SaveAsType enumerated
datatype specifying the format in which to save the data represented
in the graph. Values are:

  • Clipboard! – Save
    an image of the graph to the clipboard

  • CSV! – Comma-separated values

  • dBASE2! – dBASE-II format

  • dBASE3! – dBASE-III format

  • DIF! – Data Interchange Format

  • EMF! – Enhanced Metafile Format

  • Excel! – Microsoft Excel format

  • Excel5! – Microsoft Excel version 5 format

  • Excel8! – Microsoft Excel version 8 and
    higher format

  • HTMLTable! – HTML TABLE, TR, and TD elements

  • PDF! – Adobe Portable Document Format

  • PSReport! – Powersoft Report (PSR) format

  • SQLInsert!SQL syntax

  • SYLK! – Microsoft Multiplan format

  • Text! – (Default) Tab-separated columns
    with a return at the end of each row

  • WKS! – Lotus 1-2-3 format

  • WK1! – Lotus 1-2-3 format

  • WMF! – Windows Metafile Format

  • XLSB! – Excel 2007 format for binary data

  • XLSX! – Excel 2007 format for XML data

  • XML! – Extensible Markup Language

  • XSLFO! – Extensible Stylesheet Language
    Formatting Objects

note.png Obsolete values

The following SaveAsType values are considered to be obsolete
and will be removed in a future release: Excel!, WK1!, WKS!, SYLK!,
dBase2!, WMF!. Use Excel8!, XLSB!, or XLSX! for current versions
of Microsoft Excel! and EMF! in place of WMF!.

colheading (optional)

A boolean value indicating whether you
want column headings with the saved data. The default value is true.
Colheading is ignored for dBASE files; 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 Values

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

Usage

You must use zero or three arguments. If you do not specify
any arguments for SaveAs, PowerBuilder displays
the Save As dialog box, letting the user specify the format of the
saved data.

note.png Regional settings

If you use date formats in your graph, you must verify that yyyy is
the Short Date Style for year in the Regional Settings of the user’s
Control Panel. Your program can check this with the RegistryGet function.

If the setting is not correct, you can ask the user to change
it manually or to have the application change it (by calling the RegistrySet function).
The user may need to reboot after the setting is changed.

Examples

This statement saves the contents of the graph gr_History.
The file and format information are not specified, so PowerBuilder
prompts for the file name and save the graph as tab-delimited text:

This statement saves the contents of gr_History to
the file G:HREMPLOYEE.HIS.
The format is CSV without column headings:

This statement saves the contents of gr_computers in
the DataWindow control dw_equipmt to
the file G:INVENTORYSALES.XLS.
The format is Excel with column headings:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x