ViewObject Interface

Definition

Represents a view within a Microsoft Office InfoPath form.

public interface class ViewObject : Microsoft::Office::Interop::InfoPath::View
[System.Runtime.InteropServices.Guid("096CD55D-0786-11D1-95FA-0080C78EE3BB")]
public interface ViewObject : Microsoft.Office.Interop.InfoPath.View
type ViewObject = interface
    interface View
Public Interface ViewObject
Implements View
Derived
Attributes
Implements

Examples

In the following example, the IsDefault property of the ViewInfoObject object is used to determine whether a view is the default view of the form. Then the code uses the Name property of the ViewInfo object to display the name of the default view in a message box.

ViewInfos viewInfos;
// Set a reference to the ViewInfos collection.
viewInfos = thisXDocument.ViewInfos;
// Determine the default view and display a 
// message box with its name.
foreach (ViewInfo viewInfo in viewInfos)
{
 if (viewInfo.IsDefault)
 {
  thisXDocument.UI.Alert("The default view is: " + viewInfo.Name);
 }
}

The View object is accessed through the View property of the XDocument object. For example, the following code sets a reference to a form's currently active view:

View view;

view = thisXDocument.<span class="label">View</span>;

To change the currently active view, you can use the SwitchView method of the View object as follows:

thisXDocument.<span class="label">View</span>.SwitchView("View2");

To force an update of a view based on changes in a form's underlying XML document, you can use the ForceUpdate method of the View object, as shown here:

thisXDocument.<span class="label">View</span>.ForceUpdate();

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeView.

The ViewObject object provides a number of properties and methods that can be used to programmatically interact with an InfoPath view, including methods for selecting data contained in the view, switching from one view to another, synchronizing the view with a form's underlying XML document, and executing an InfoPath editing action

Properties

Name

Gets the name of the view.

(Inherited from View)
Window

Gets a reference to the window associated with the view.

(Inherited from View)

Methods

DisableAutoUpdate()

Disables automatic synchronization between a form's underlying XML document and the associated view.

(Inherited from View)
EnableAutoUpdate()

Enables automatic synchronization between a form's underlying XML document and the associated view.

(Inherited from View)
ExecuteAction(String, Object)

Executes a Microsoft Office InfoPath 2003 editing command against a form's underlying XML document, based on the data selected in the view.

(Inherited from View)
Export(String, String)

Exports the view to a file of the specified format.

(Inherited from View)
ForceUpdate()

Forces synchronization between a form's underlying XML document and the associated view.

(Inherited from View)
GetContextNodes(Object, Object)

Gets a reference to an XMLNodesCollection collection that is populated with XML Document Object Model (DOM) nodes based on the current context.

(Inherited from View)
GetSelectedNodes()

Gets a reference to an XMLNodesCollection collection that is populated with XML Document Object Model (DOM) nodes based on the current selection of items in a view.

(Inherited from View)
SelectNodes(IXMLDOMNode, Object, Object)

Selects a range of nodes in a view based on the specified starting XML Document Object Model (DOM) node, the ending XML DOM node, and the view context.

(Inherited from View)
SelectText(IXMLDOMNode, Object)

Selects the text contained in an editable field that is bound to the specified XML Document Object Model (DOM) node.

(Inherited from View)
SwitchView(String)

Changes the active view of a Microsoft Office InfoPath form to a specified view.

(Inherited from View)

Applies to