PlotDocument Object

A PlotDocument object corresponds to an SRF file. PlotDocument objects are created by the Documents.Add or Documents.Open methods of the Documents Collection. All drawing objects within the document are stored in the Shapes collection. All selected objects are part of the Selection collection.

The PlotDocument provides access to all the drawing and map objects. Use methods and properties in the PlotDocument object to save Surfer files [.SRF], to import and export files, to print, and to change the default line, fill, font, and symbol for a plot.

Use the Shapes, Selection, and Window properties to access the collection objects having the same names. These collection objects provide access to the next layer of objects in the object hierarchy. Use the Shapes collection object to create new drawing and map objects.

Derived from: Document object (All methods and properties of Document apply to this object.)

The following table provides the properties of the PlotDocument object:

Property

Description

DefaultFill

Returns the default fill properties object for this document. It is a read only property.

DefaultFont

Returns the default font properties object for this document. It is a read only property.

DefaultLine

Returns the default line properties object for this document. It is a read only property.

DefaultSymbol

Returns the default symbol properties object for this document. It is a read only property.

PageSetup

Returns the PageSetup object. It is a read-only property.

Selection

Returns the current selection. It is a read-only property.

Shapes

Returns the Shapes collection. It is a read-only property.

ShowContentsWindow

Sets or returns the Contents window visibility state.

ShowPropertiesWindow

Sets or returns the Properties window visibility state.

The following table provides all methods of the PlotDocument object:

Method

Description

AddLegend

Creates a TopLegend object.

Export2

Exports the document to a specified graphics file. The [.PDF] format can only be exported with Export2 method.

ExportArea

Exports a specified region of the document.

Import2

Imports a graphic file.

PrintOut

Sends the document to the current printer.

Example 1

This script displays all the methods and properties in the PlotDocument object.

Example 2

The following script demonstrates how the PlotDocument object is used in reference to the Documents collection.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it to

'the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Plot as an object

Dim Plot As Object

 

'Creates a plot document in Surfer and assigns it to the variable named

'"Plot"

Set Plot = SurferApp.Documents.Add(srfDocPlot)

 

End Sub