_ExternalApplication2.New 方法 (String, Int32)

基于指定的表单创建新表单。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
Sub New ( _
    bstrDocumentURI As String, _
    dwBehavior As Integer _
)
用法
Dim instance As _ExternalApplication2
Dim bstrDocumentURI As String
Dim dwBehavior As Integer

instance.New(bstrDocumentURI, dwBehavior)
void New(
    string bstrDocumentURI,
    int dwBehavior
)

参数

  • bstrDocumentURI
    类型:System.String

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

实现

_ExternalApplication.New(String, Int32)

备注

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

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

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

重要

只能由从表单模板打开的表单访问此成员,已使用"表单选项"对话框"安全和信任"类别将该模板配置为以完全信任状态运行。此成员要求直接调用方的完全信任并且不能由部分信任的代码使用。有关更多信息,请参阅 MSDN 上的"使用部分信任的代码中的库"。

示例

在以下示例(用 C# 编程语言编写)中,ExternalApplication 对象的 New 方法用来基于指定的表单模板新建表单:

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

 // Create an InfoPath form.
 infoPath.New(@"C:\My Forms\Form1.xml", 1);
}

备注

上面的示例假定正在使用 Microsoft.Office.Interop.InfoPath 命名空间并引用 Microsoft InfoPath 3.0 类型库。

另请参阅

引用

_ExternalApplication2 接口

_ExternalApplication2 成员

New 重载

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间