File: xdmthExecuteAction.htm

package info (click to toggle)
office2003-schemas 1.0%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 42,304 kB
  • sloc: javascript: 2,429; makefile: 29
file content (9 lines) | stat: -rw-r--r-- 9,899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01025179"><META NAME="lcid" CONTENT="1033"><title>ExecuteAction Method</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>ExecuteAction Method</h1><DIV class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="appliesto" onclick="toggleList()" onkeypress="toggleList()"></span><a class="ofvbanavex" href="#example"><span class="ofvbanavreuse" id="example"></span></a><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></DIV><p><p>Executes a Microsoft Office InfoPath 2003 editing command against a form's underlying XML document, based on the data selected in the view  that is associated with the <b class="bterm"><a href="xdobjView.htm" id="HV01021249" lcid=" ">View</a></b> object.</p><p class="signature"><i>expression</i>.<b class="bterm">ExecuteAction</b>(ByVal <b class="bterm"><i>bstrAction</i></b> As String, [ByVal <b class="bterm"><i>varXmlToEdit</i></b> As Variant])</p><p><i>expression   </i> Required. An expression that returns a reference to the <b class="bterm">View</b> object.</p><p><b class="bterm"><i>bstrAction</i></b> Required <b class="bterm">String</b>. The name of the editing action to perform.</p><p><b class="bterm"><i>varXmlToEdit</i></b> Optional <b class="bterm">Variant</b>. The name of the field or group to which to apply the editing action. This is equivalent to the value of the <b class="bterm"><a href="xsfatrname_7.htm" id="HV01021580" lcid=" ">name</a></b> attribute in the <b class="bterm"><a href="xsfelmxmlToEdit.htm" id="HV01021519" lcid=" ">xmlToEdit</a></b> element of the <a href="#" class="glossary" onclick="AppendPopup(this,'xdformdefinitionfilexsf')" onkeypress="AppendPopup(this,'xdformdefinitionfilexsf')">form definition (.xsf) file</a>.</p></p><h2>Security Level</h2><p>2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.</p><h2>Remarks</h2><p><p>The <b class="bterm">ExecuteAction</b> method is used to programmatically perform built-in InfoPath editing actions against a form's underlying XML document, based on the selected context in a view.</p><p>The action that is executed will be the same action that would be used when clicking on an equivalent menu or toolbar button; namely one for which the button element in the .xsf file has corresponding <b class="bterm"><a href="xsfatrxmlToEdit.htm" id="HV01021626" lcid=" ">xmlToEdit</a></b> and <b class="bterm"><a href="xsfatraction.htm" id="HV01021520" lcid=" ">action</a></b> attributes. As with using a button, the action will be based on current selection: it will act on the selected context (and in the case where the selection would lead the button to be disabled, then the <b class="bterm">ExecuteAction</b> method will have no effect).<p><b>Note</b>  It is possible with scripting code  to first set the selection context by using the <b class="bterm"><a href="xdmthSelectNodes.htm" id="HV01025479" lcid=" ">SelectNodes</a></b> or <b class="bterm"><a href="xdmthSelectText.htm" id="HV01025481" lcid=" ">SelectText</a></b> methods of the <b class="bterm">View</b> object, then calling the <b class="bterm">ExecuteAction</b> method to act on that context.</p></p><p>The <b class="bterm">ExecuteAction</b> method will return an error for the following reasons:<ul><li>The <b class="bterm"><i>bstrAction</i></b> parameter does not contain a valid editing component name.</li><li>The <b class="bterm"><i>varXmlToEdit</i></b> parameter does not match an editing component that is defined in the view.</li><li>The <b class="bterm"><i>varXmlToEdit</i></b> parameter is required for a specific editing action.</li><li>The editing action is not applicable to the selected context.</li></ul></p><p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Valid parameter combinations</a></p><div id="ExpCol" class="collapsed" border="0"><p>The following is a table of parameter combinations that can be used with the <b class="bterm">ExecuteAction</b> method.</p><table><tr><th>Combination</th><th>Description</th></tr><tr><td>"Copy"</td><td>Copies the selected data to the clipboard.</td></tr><tr><td>"Paste"</td><td>Copies data from the clipboard to the insertion point.</td></tr><tr><td>"Cut"</td><td>Removes the selected data and copies it to the clipboard.</td></tr><tr><td>"Delete"</td><td>Deletes the selected data.</td></tr><tr><td>"xCollection::insert", "<i>xmlToEdit</i>"</td><td>Inserts data based on the selected context using the xCollection editing component. If current selection is within a container of the xCollection, specified by its <b class="bterm"><a href="xsfelmxmlToEdit.htm" id="HV01021519" lcid=" ">xmlToEdit</a></b> element in the .xsf,  then the <b class="bterm"><a href="xsfelmfragmentToInsert.htm" id="HV01021482" lcid=" ">fragmentToInsert</a></b> element data is appended within that container.</td></tr><tr><td>"xCollection::insertBefore", "<i>xmlToEdit</i>"</td><td>Inserts data before the selected context using the xCollection editing component. If current selection is within an item of the xCollection, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf,  then the <b class="bterm">fragmentToInsert</b> element data is inserted before that item.</td></tr><tr><td>"xCollection::insertAfter", "<i>xmlToEdit</i>"</td><td>Inserts data after the selected context using the xCollection editing component. If current selection is within an item of the xCollection, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf, then the <b class="bterm">fragmentToInsert</b> element  data is inserted after that item.</td></tr><tr><td>"xCollection::remove", "<i>xmlToEdit</i>"</td><td>Deletes data from the selected context using the xCollection editing component. If current selection is within an item of the xCollection, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf, then that item is deleted.</td></tr><tr><td>"xCollection::removeAll", "<i>xmlToEdit</i>"</td><td>Deletes all data contained within the selected context using the xCollection editing component. If current selection is within a container of the xCollection, as specified by the <b class="bterm">xmlToEdit</b> element in the .xsf, then this action deletes all the items within that container.</td></tr><tr><td>"xReplace::replace", "<i>xmlToEdit</i>"</td><td>Replaces the data in the selected context using the xReplace editing component. If current selection is within an item of the xReplace, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf,  then that item is replaced by the <b class="bterm">fragmentToInsert</b> element data.</td></tr><tr><td>"xOptional::insert", "<i>xmlToEdit</i>"</td><td>Inserts data based on the selected context using the xOptional editing component. If current selection is within an container of the xOptional, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf, then the <b class="bterm">fragmentToInsert</b> element data is appended within that container.</td></tr><tr><td>"xOptional::remove", "<i>xmlToEdit</i>"</td><td>Deletes data from the selected context using the xOptional editing component. If current selection is within an item of the xOptional, as specified by its <b class="bterm">xmlToEdit</b> element in the .xsf, then that item is deleted.</td></tr></table></div><p><b>Note</b>  In some cases, calling the <b class="bterm">ExecuteAction</b> method from the <b class="bterm"><a href="xdevtOnClick.htm" id="HV01027661" lcid=" ">OnClick</a></b> event for a button in a view may cause an error. This is because the selected context changes to the button when the button is clicked. In this case, it is better to use a button (or link) on a custom task pane, toolbar, or menu to call the <b class="bterm">ExecuteAction</b> method.</p></p></p><h2><a id="#example" name="#example">Example</a></h2><p><p>In the following example, the <b class="bterm">ExecuteAction</b> method of the <b class="bterm">View</b> object is used to delete selected data and place it on the clipboard:</p><pre><code>XDocument.View.<b class="bterm">ExecuteAction</b>("Cut");</code></pre><p>In the following example, the <b class="bterm">ExecuteAction</b> method of the <b class="bterm">View</b> object is used to insert data using the xCollection editing component, based on the selected context:</p><pre><code>XDocument.View.<b class="bterm">ExecuteAction</b>("xCollection::insert", "group1_1");</code></pre></p><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/xdmthExecuteAction_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">&copy;2003-2004 Microsoft Corporation. All rights reserved.</a>  

Permission to copy, display and distribute this document is available at: <a 

href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&amp;CTT=11&amp;Origin=HV011232471033" 

target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>