Condividi tramite


Interfaccia HTMLTaskPaneObject

Rappresenta un riquadro attività personalizzato in un modulo di Microsoft Office InfoPath 2007 associato a una finestra.

Spazio dei nomi: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in microsoft.office.interop.infopath.dll)

Sintassi

<GuidAttribute("096CD548-0786-11D1-95FA-0080C78EE3BB")> _
<CoClassAttribute(GetType(HTMLTaskPaneObjectClass))> _
Public Interface HTMLTaskPaneObject
    Inherits HTMLTaskPane

Dim instance As HTMLTaskPaneObject
[GuidAttribute("096CD548-0786-11D1-95FA-0080C78EE3BB")] 
[CoClassAttribute(typeof(HTMLTaskPaneObjectClass))] 
public interface HTMLTaskPaneObject : HTMLTaskPane

Osservazioni

Questo tipo è un wrapper per una coclasse richiesta dal codice gestito per l'interoperabilità COM. Utilizzare questo tipo per accedere ai membri dell'interfaccia COM implementata dalla coclasse. Per informazioni sull'interfaccia COM e un collegamento alle descrizioni dei relativi membri, vedere HTMLTaskPane.

L'oggetto HTMLTaskPane rende disponibili vari metodi e proprietà per l'utilizzo del riquadro attività personalizzato di InfoPath, nonché proprietà e metodi dell'oggetto TaskPaneObject.

Le proprietà e i metodi disponibili per un riquadro attività di InfoPath dipendono dal tipo di riquadro attività in uso. Se la proprietà TaskPaneType restituisce 0, il riquadro attività è un riquadro attività personalizzato e le proprietà e i metodi disponibili vengono forniti dall'oggetto HTMLTaskPane. Se la proprietà TaskPaneType restituisce qualsiasi altro valore, il riquadro attività è uno dei riquadri attività predefiniti e le proprietà vengono fornite direttamente dall'oggetto TaskPane.

La proprietà TaskPaneType si basa sull'enumerazione XdTaskPaneType. Questi valori enumerati vengono utilizzati anche come argomenti per la proprietà Item dell'insieme TaskPanesCollection per restituire un riferimento al tipo di riquadro attività specificato.

Nota:

Le proprietà e i metodi dell'oggetto HTMLTaskPane non possono essere richiamati durante un evento _XDocumentEventSink2_OnLoadEventHandler, perché quando si verifica l'evento la visualizzazione non è ancora stata caricata e i riquadri attività sono associati alla visualizzazione.

Esempio

Nell'esempio seguente, la proprietà P:Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPanes.Item(System.Object) dell'insieme T:Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPanesCollection viene utilizzata per ottenere un riferimento all'oggetto T:Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPaneObject che rappresenta il riquadro attività personalizzato. Il codice richiama quindi il metodo Navigate dell'oggetto HTMLTaskPane per aprire un file HTML.

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

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

Nell'esempio seguente, la proprietà Item dell'insieme TaskPanesCollection viene utilizzata per ottenere un riferimento all'oggetto TaskPaneObject che rappresenta il riquadro attività personalizzato. Il codice, quindi, richiama una funzione di script definita nel codice HTML del riquadro attività personalizzato mediante la proprietà HTMLDocument dell'oggetto HTMLTaskPane, ereditato dall'oggetto TaskPane.

// 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.
 HTMLTaskPane custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes[0];

 // Ensure that the task pane is completely loaded.
 if (custom != null && 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);
 }
}

Vedere anche

Riferimenti

Membri HTMLTaskPaneObject
Spazio dei nomi Microsoft.Office.Interop.InfoPath