HtmlTaskPane class

Office 2013 and later

Represents the custom task pane that is associated the current window in which a form is being edited.

System.Object
  Microsoft.Office.InfoPath.TaskPane
    Microsoft.Office.InfoPath.HtmlTaskPane

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

No code example is currently available or this language may not be supported.

InfoPath custom task panes can only be used in a form template with the compatibility set to InfoPath Editor. To set a form template's compatibility, click the File tab, click Form Options, and then click the Compatibility category.

The HtmlTaskPane object provides properties and methods for working with InfoPath custom task panes, and it also inherits the properties of the TaskPane class.

The properties available for an InfoPath task pane are determined by the type of task pane that you are working with. If the TaskPaneType property returns TaskPaneType.Html, the task pane is a custom task pane and the properties and methods available are provided by the HtmlTaskPane class. If the TaskPaneType property returns any other value, the task pane is a built-in task pane and the properties are provided by the TaskPane class.

TheTaskPaneType property returns values defined by the TaskPaneType enumeration. These enumerated values are also used as arguments to the Item[TaskPaneType] property of the TaskPaneCollection class for returning a reference to a specified type of task pane.

To enable and add a custom task pane to a form template, you must first create one or more HTML files and add them as resource files using the Resource Files command on the Data tab in form template design mode. Then, you must configure one of the HTML files as the form template's default custom task pane, by clicking the File tab, clicking Form Options, clicking the Programming category, and then selecting the Enable custom task pane check box.

NoteNote

The properties and methods of the HtmlTaskPane object cannot be called from an event handler for the Loading event because the view is not yet loaded when this event occurs, and task panes are associated with the view.

In the following example, the Item property of the TaskPaneCollection class is used to get a reference to the TaskPane object that represents the custom task pane, which is cast to the HtmlTaskPane type. The code then calls the Navigate method of the HtmlTaskPane class to open an HTML file, which replaces the current HTML file that is loaded as the custom task pane.

No code example is currently available or this language may not be supported.

In the following example, the Item property of the TaskPaneCollection class is used to get a reference to the TaskPane object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane by using the HtmlDocument property of the HtmlTaskPane class.

To be able to work with the object model of the HTML file that is specified as a custom task pane, you use the object model provided by the Microsoft HTML Object Library (MSHTML.dll). To do that from managed code, add a reference to Microsoft.mshtml on the .NET tab of the Add Reference dialog box in Visual Studio 2012.

The following example assumes that you have a using mshtml; or Imports mshtml directive in the declarations section of your form code file.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: