View Object
InfoPath Developer Reference |
Represents a view within a Microsoft Office InfoPath 2007 form.
Version Information
Version Added: InfoPath 2003
Remarks
The View 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.
InfoPath forms can contain one or more views, and one view is always defined as the default view. When you work with a view using the View object, you are accessing the currently active view.
Note |
---|
The InfoPath object model also provides the ViewInfos collection, which can be used to get information about all of the views implemented in a form. |
For more information about using the View object, see Working with views.
Example
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:
JScript |
---|
|
To change the currently active view, you can use the SwitchView method of the View object as follows:
JScript |
---|
|
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:
JScript |
---|
|
See Also