XmlFormCollection.NewFromFormTemplate Method (String, String) (Microsoft.Office.InfoPath)

Creates a new form using the specified form template and XML data file.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
Public MustOverride Function NewFromFormTemplate ( _
    formTemplateLocation As String, _
    xmlData As String _
) As XmlForm
'Usage
Dim instance As XmlFormCollection
Dim formTemplateLocation As String
Dim xmlData As String
Dim returnValue As XmlForm

returnValue = instance.NewFromFormTemplate(formTemplateLocation, xmlData)
public abstract XmlForm NewFromFormTemplate (
    string formTemplateLocation,
    string xmlData
)

Parameters

  • formTemplateLocation
    The Uniform Resource Identifier (URI) of the form template on which to base the new form.
  • xmlData
    The Uniform Resource Identifier (URI) of the XML document that provides the XML data to be used as a template for the form.

Return Value

An XmlForm object that represents the new form that was created.

Remarks

The NewFromFormTemplate method can only be used to create a new form based on an existing form template; it cannot be used to create a new form based on a form. To create a form from an existing form, use the New method.

When you use the NewFromFormTemplate method, the new form opens in InfoPath and is ready to be filled out.

This member 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.

This type or member can be accessed only from code running in forms opened in Microsoft Office InfoPath 2007.

Example

In the following example, the NewFromFormTemplate(formTemplateLocation, xmlData) method of the XmlFormCollection class is passed the URI of an existing form template, the URI of XML data, and the new form's associated XmlForm object is returned.

XmlForm newDocument = 
   this.Application.XmlForms.NewFromFormTemplate(
   @"C:\MyForm.xsn", @"C:\MyForm.xml");
Dim newDocument As XmlForm  = _
   Me.Application.XmlForms.NewFromFormTemplate(_
   "C:\MyForm.xsn", "C:\MyForm.xml")

See Also

Reference

XmlFormCollection Class
XmlFormCollection Members
Microsoft.Office.InfoPath Namespace