_ExternalApplication.New(String, Int32) 方法

定义

基于指定的窗体创建新的 Microsoft InfoPath 窗体。

public void New (string bstrDocumentURI, int dwBehavior = 1);
abstract member New : string * int -> unit
Public Sub New (bstrDocumentURI As String, Optional dwBehavior As Integer = 1)

参数

bstrDocumentURI
String

字符串值,指定表单的统一资源标识符 (URI)。

dwBehavior
Int32

默认值为 1。 指定打开表单的方式。 这些值基于 XdDocumentVersionMode 枚举。

示例

在以下示例(用 C# 编程语言编写)中,对象的 New 方法 ExternalApplication 用于基于指定的窗体创建新窗体:

private void CreateFromForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();

 // Create an InfoPath form.
 infoPath.<span class="label">New</span>(@"C:\My Forms\Form1.xml", 1);
}

注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。

在以下示例(用 C# 编程语言编写)中,对象的 New 方法 ExternalApplication 用于基于指定的窗体创建新窗体:

private void CreateFromForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();

 // Create an InfoPath form.
 infoPath.<span class="label">New</span>(@"C:\My Forms\Form1.xml", 1);
}

注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。

注解

New 方法只能基于现有表单来新建表单,而不能基于表单模板来新建表单。 若要从表单模板创建表单,请使用 NewFromSolution(String) 方法。

使用 New 方法时,InfoPath 处于打开状态,可随时填写新表单。

注意 不能使用 Close(String) 关闭已使用 New 方法打开的窗体。 当 New 方法创建某个表单时,该表单的名称未知。

适用于