XpsDocument.Close 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
关闭 XPS 文档 Package。
public:
void Close();
public void Close ();
member this.Close : unit -> unit
Public Sub Close ()
示例
以下示例演示如何打开、插入内容和关闭内容 XpsDocument。
// Create an XpsDocument package (without PrintTicket).
{
Package^ package = Package::Open(packageName);
try
{
XpsDocument^ xpsDocument = gcnew XpsDocument(package);
// Add the package content (false=without PrintTicket).
AddPackageContent(xpsDocument, false);
// Close the package.
xpsDocument->Close();
} finally
{
delete package;
}
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
XpsDocument xpsDocument = new XpsDocument(package);
// Add the package content (false=without PrintTicket).
AddPackageContent(xpsDocument, false);
// Close the package.
xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
Dim xpsDocument As New XpsDocument(package1)
' Add the package content (false=without PrintTicket).
AddPackageContent(xpsDocument, False)
' Close the package.
xpsDocument.Close()
End Using
以下示例还演示如何打开、写入和关闭 。XpsDocument
// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;
注解
XpsDocument如果打开进行写入访问,则数据缓冲区将写入存储并关闭物理文档Package。
调用后 Close ,无法使用此 XpsDocument 实例访问文档的各个部分。