_ExternalApplication2.Close(String) 方法

定义

关闭指定的表单。

public:
 void Close(System::String ^ bstrDocumentURI);
public void Close (string bstrDocumentURI);
abstract member Close : string -> unit
Public Sub Close (bstrDocumentURI As String)

参数

bstrDocumentURI
String

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

实现

示例

在以下示例(以 C# 编程语言编写)中,对象的 Close 方法 ExternalApplication 用于关闭当前打开的窗体:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);
 // Close the InfoPath form.
 infoPath.<span class="label">Close</span>(@"C:\My Forms\Form1.xml");
 // Quit the InfoPath application.
 infoPath.Quit();
}

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

在以下示例(以 C# 编程语言编写)中,对象的 Close 方法 ExternalApplication 用于关闭当前打开的窗体:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);
 // Close the InfoPath form.
 infoPath.<span class="label">Close</span>(@"C:\My Forms\Form1.xml");
 // Quit the InfoPath application.
 infoPath.Quit();
}

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

注解

Close 方法可在不退出 InfoPath 应用程序的情况下关闭当前打开的表单。 使用 Close 方法时,表单将无条件关闭,这意味着不会保存对表单内的数据所做的任何更改。

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

适用于