_ExternalApplication.Open(String, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
打开指定的 Microsoft InfoPath 窗体。
public void Open (string bstrDocumentURI, int dwBehavior = 1);
abstract member Open : string * int -> unit
Public Sub Open (bstrDocumentURI As String, Optional dwBehavior As Integer = 1)
参数
- bstrDocumentURI
- String
字符串值,指定表单的统一资源标识符 (URI)。
- dwBehavior
- Int32
默认值为 1。 指定打开表单的方式。 这些值基于 XdDocumentVersionMode 枚举。
示例
在以下示例(用 C# 编程语言编写)中,对象的 Open 方法 ExternalApplication 用于从文件系统打开窗体:
private void AutomateInfoPathForm()
{
ExternalApplication infoPath = new ExternalApplicationClass();
// Open an InfoPath form.
infoPath.<span class="label">Open</span>(@"C:\My Forms\Form1.xml", 1);
// Close the InfoPath form.
infoPath.Close(@"C:\My Forms\Form1.xml");
// Quit the InfoPath application.
infoPath.Quit();
}
注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。
在以下示例(用 C# 编程语言编写)中,对象的 Open 方法 ExternalApplication 用于从文件系统打开窗体:
private void AutomateInfoPathForm()
{
ExternalApplication infoPath = new ExternalApplicationClass();
// Open an InfoPath form.
infoPath.<span class="label">Open</span>(@"C:\My Forms\Form1.xml", 1);
// Close the InfoPath form.
infoPath.Close(@"C:\My Forms\Form1.xml");
// Quit the InfoPath application.
infoPath.Quit();
}
注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。
注解
Open 方法只能用于打开表单,不能用于打开表单模板。 若要从表单模板创建表单,请使用 NewFromSolution(String) 方法。 若要基于现有窗体创建窗体,请使用 New(String, Int32) 方法。