View.SelectText 方法
選取繫結至指定之 XML 文件物件模型 (DOM) 節點的可編輯欄位中包含的文字。
**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)
語法
'宣告
<DispIdAttribute(13)> _
Sub SelectText ( _
<InAttribute> pxnField As IXMLDOMNode, _
<InAttribute> <OptionalAttribute> varViewContext As Object _
)
'用途
Dim instance As View
Dim pxnField As IXMLDOMNode
Dim varViewContext As Object
instance.SelectText(pxnField, varViewContext)
[DispIdAttribute(13)]
void SelectText (
[InAttribute] IXMLDOMNode pxnField,
[OptionalAttribute] [InAttribute] Object varViewContext
)
參數
- pxnField
XML DOM 節點。
- varViewContext
內容中使用的控制項識別碼,是具有指定 xd:CtrlId 檢視內容的元素。
備註
如果已指定檢視內容,要選取的可編輯欄位必須在該內容中。
在指定的檢視內容中,如果有多組檢視元素對應到同一指定的 XML DOM 節點,則 SelectText 方法會傳回錯誤。此外,如果 SelectText 方法的任一引數為 null,或未顯示於檢視中,則 SelectText 方法也會傳回錯誤。
範例
在下列範例中,ViewObject 物件的 SelectText 方法是用於在繫結至 XML DOM 節點的欄位中選取文字:
IXMLDOMNode field1;
field1 = thisXDocument.DOM.selectSingleNode(@"/my:myFields/my:field1");
thisXDocument.View.SelectText(field1, Type.Missing);