1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01103984"><META NAME="lcid" CONTENT="1033"><title>NewFromSolutionWithData 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>NewFromSolutionWithData 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>Creates a new Microsoft Office InfoPath 2003 form using the specified XML data and form template.</p>
<p class="signature"><i>expression</i>. <b class="bterm">NewFromSolutionWithData</b>(ByVal <b class="bterm"><i>varXMLData</i></b> As Variant, ByVal <b class="bterm"><i>varSolutionURI</i></b> As Variant, [ByVal <b class="bterm"><i>dwBehavior</i></b> As Long = 1]) As XDocument</p>
<p><i>expression </i> An expression that returns a reference to an <a href="xdcolXDocuments.htm" id="HV01021190" lcid=" "><b class="bterm">XDocuments</b></a> collection.</p><p>
<i><b class="bterm">varXMLData</b> </i>
Required <b class="bterm">Variant</b>. Provides the XML data to be used as a template for the form. Can be a string that specifies the <a href="#" class="glossary" onclick="AppendPopup(this,'ofuniformresourceidentifieruri')" onkeypress="AppendPopup(this,'ofuniformresourceidentifieruri')">Uniform Resource Identifier (URI)</a> of an XML document, or an <b class="bterm">XMLDOMNode</b> that contains the XML to be used as the XML document (template).</p>
<p>
<i><b class="bterm">varSolutionURI</b> </i>
Required <b class="bterm">Variant</b>. String which specifies the Uniform Resource Identifier (URI) of a form template file (an .xsf or .xsn file).</p>
<p>
<i><b class="bterm">dwBehavior</b> </i>
Optional <b class="bterm">Long</b>. Reserved for future use. This value should be omitted or set to 1.</p>
<p><i>returns </i> A reference to an <a href="xdobjXDocument.htm" id="HV01021254" lcid=" "><b class="bterm">XDocument</b></a> object.</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 following related methods of the <b class="bterm">XDocuments</b> collection are also available:</p>
<ul><li><p>The <a href="xdmthNew_2.htm" id="HV01021394" lcid=" "><b class="bterm">New</b></a> method enables creating a new instance of InfoPath by using a specified XML document. The XML document must correspond to an InfoPath form. A new form is opened in InfoPath, using the supplied XML document as initial data, and its associated form template as specified in the <a href="#" class="glossary" onclick="AppendPopup(this,'xdprocessinginstructions')" onkeypress="AppendPopup(this,'xdprocessinginstructions')">processing instructions</a> in the header of the document.</p></li><li><p>The <a href="xdmthNewFromSolution_2.htm" id="HV01021395" lcid=" "><b class="bterm">NewFromSolution</b></a> method enables creating a new instance of InfoPath using a specified form template, and its associated XML form (the initial template data). </p></li></ul><p>The <b class="bterm">NewFromSolutionWithData</b> method supports a scenario that is not provided by the foregoing two methods: specifying both the XML document used as initial data and the form template. The XML document does not need to have been created by InfoPath. It can be supplied either as a URI or as an <b class="bterm">XMLDOMNode</b>.</p><p>When you use the <b class="bterm">NewFromSolutionWithData</b> method, the new form opens in InfoPath and is ready to be filled out.</p><p><p><b>Note</b> This object model member is not supported when the <b class="ui">Disable Service Pack features</b> option on the <b class="ui">Advanced</b> tab of the <b class="ui">Options</b> dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.</p></p></p><h2><a id="#example" name="#example">Example</a></h2><p>
<p>In the following example, the <b class="bterm">NewFromSolutionWithData</b> method of the <b class="bterm">XDocuments</b> collection is passed the URIs of an existing XML document, and an existing <a href="#" class="glossary" onclick="AppendPopup(this,'xdformtemplate')" onkeypress="AppendPopup(this,'xdformtemplate')">form template</a>, and a new form is created and its associated <b class="bterm">XDocument</b> object is returned:</p>
<pre><code>var objXDoc = Application.XDocuments.<b class="bterm">NewFromSolutionWithData</b>("C:\\InitialData.xml", "C:\\MyForm.xsn");</code></pre>
<p>In the following example, the <b class="bterm">NewFromSolutionWithData</b> method of the <b class="bterm">XDocuments</b> collection is passed an <b class="bterm">XMLDOMNode</b> as initial data and the URI of an existing form, and a new form is created and its associated <b class="bterm">XDocument</b> object is returned:</p>
<pre><code>var objXMLNode = XDocument.DOM.selectSingleNode("/employees/employee");
var objXDoc = Application.XDocuments.<b class="bterm">NewFromSolutionWithData</b>(objXMLNode, "C:\\Employee.xsn");</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/xdmthNewFromSolutionWithData_HV01103984_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©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&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|