_ExternalApplication.Open(String, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
打开指定的 Microsoft InfoPath 窗体。
public:
void Open(System::String ^ bstrDocumentURI, int dwBehavior);
public void Open (string bstrDocumentURI, int dwBehavior);
abstract member Open : string * int -> unit
Public Sub Open (bstrDocumentURI As String, dwBehavior As Integer)
参数
- 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) 方法。
重要说明:此成员只能由已配置为使用“表单选项”对话框的“安全与信任”类别以完全信任方式运行的表单模板打开的表单访问。 此成员要求直接调用方的完全信任并且不能由部分信任的代码使用。 有关更多信息,请参阅 MSDN 上的“使用部分信任的代码中的库”。