View.GetSelectedNodes Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a reference to an XMLNodesCollection collection that is populated with XML Document Object Model (DOM) nodes based on the current selection of items in a view.
public:
Microsoft::Office::Interop::InfoPath::XMLNodesCollection ^ GetSelectedNodes();
public Microsoft.Office.Interop.InfoPath.XMLNodesCollection GetSelectedNodes ();
abstract member GetSelectedNodes : unit -> Microsoft.Office.Interop.InfoPath.XMLNodesCollection
Public Function GetSelectedNodes () As XMLNodesCollection
Returns
A reference to the XMLNodesCollection collection.
Examples
In the following example, the GetSelectedNodes method of the ViewObject object is used to set a reference to a collection of XML DOM nodes based on what is currently selected in the view. Then the code determines whether nodes were returned and, if they were, displays information about the first node found in the XMLNodesCollection collection in a message box.
XMLNodesCollection selectedNodes = thisXDocument.View.<span class="label">GetSelectedNodes</span>();
if (selectedNodes.Count > 0)
{
thisXDocument.UI.Alert(selectedNodes[0].nodeName + "\n\n" + selectedNodes[0].text);
}
Remarks
If no items are selected in a view, or if only text is selected, then the GetSelectedNodes method returns an empty collection.
Note: The GetSelectedNodes method will not return nodes based on the current selection if used in the OnClick event of a button in the view, since the focus is lost from the control that is intended to be in context. To avoid this behavior, use the GetSelectedNodes method from a custom task pane, menu or toolbar.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기