Modifica

Condividi tramite


HTMLTaskPaneObject Interface

Definition

Represents a custom task pane in a Microsoft InfoPath form that is associated with a window.

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

Examples

In the following example, the P:Microsoft.Office.Interop.InfoPath.TaskPanes.Item(System.Object) property of the T:Microsoft.Office.Interop.InfoPath.TaskPanesCollection collection is used to get a reference to the T:Microsoft.Office.Interop.InfoPath.TaskPaneObject object that represents the custom task pane. The code then calls the Navigate(String) method of the HTMLTaskPane object to open an HTML file.

public void CustomTaskPaneNavigation()
{
 // Get a reference to the custom task pane. It is always index [0] in the TaskPanes collection.   
<span class="label">HTMLTaskPane</span> oTaskPane = (HTMLTaskPane)thisXDocument.View.Window.TaskPanes[0];

 // Navigate based on url specified.
 oTaskPane.Navigate("taskpane2.html");
}

In the following example, the Item[Object] property of the TaskPanesCollection collection is used to get a reference to the TaskPaneObject object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane using the HTMLDocument property of the HTMLTaskPane object, which is inherited by the TaskPane object.

// Ensure View has loaded before trying to access the task pane.
if (thisXDocument.View != null)
{
 // Get a reference to the custom task pane.  It is always the 0-th
 // task pane in the TaskPanes collection.
<span class="label">HTMLTaskPane</span> custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes[0];

 // Ensure that the task pane is completely loaded.
 if (custom != null &amp;&amp; custom.HTMLDocument.readyState == "complete")
 {
  mshtml.IHTMLWindow2 window = custom.HTMLDocument.parentWindow;

  object[] args =  new object[] {"ViewID"};

  // call into script through CLR late binding mechanism
  window.GetType().InvokeMember(
   "SelectView",      // late bound method      
   System.Reflection.BindingFlags.InvokeMethod |   // binding flags
   System.Reflection.BindingFlags.DeclaredOnly | 
   System.Reflection.BindingFlags.Public | 
   System.Reflection.BindingFlags.Instance,     
   null,        // binder object
   window,        // target object
   args);
 }
}

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, seeHTMLTaskPane.

The HTMLTaskPane object provides a number of properties and methods for working with the InfoPath custom task pane, and it provides properties and methods of the TaskPaneObject object.

The properties and methods that are available for an InfoPath task pane are determined by the type of task pane that you are working with. If the TaskPaneType property returns 0, the task pane is a custom task pane and the properties and methods that are available are provided by the HTMLTaskPane object. 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 object.

The TaskPaneType property is based on the XdTaskPaneType enumeration. These enumerated values are also used as arguments to the Item[Object] property of the TaskPanesCollection collection for returning a reference to a specified type of task pane.

Note: The properties and methods of the HTMLTaskPane object cannot be called during an _XDocumentEventSink2_OnLoadEventHandler event because the view is not yet loaded when this event occurs, and task panes are associated with the view.

Properties

HTMLDocument

Gets a reference to an HTML document object of the Microsoft Office InfoPath 2003 custom task pane.

(Inherited from HTMLTaskPane)
HTMLWindow

Gets a reference to an HTML window object of the Microsoft Office InfoPath 2003 custom task pane.

(Inherited from HTMLTaskPane)
TaskPaneType

Gets a value indicating the type of task pane represented by the HTMLTaskPaneObject object, which is always a custom task pane.

(Inherited from HTMLTaskPane)
Visible

Gets or sets a value indicating that the task pane represented by the HTMLTaskPaneObject object, which is always a custom task pane, is visible in the Microsoft Office InfoPath 2003 user interface.

(Inherited from HTMLTaskPane)

Methods

Navigate(String)

Loads the specified HTML document into the Microsoft Office InfoPath 2003 custom task pane.

(Inherited from HTMLTaskPane)

Applies to