XpsDocument.Close Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Closes the XPS document Package.
public:
void Close();
public void Close ();
member this.Close : unit -> unit
Public Sub Close ()
Examples
The following example shows how to open, insert content, and close an 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
The following example also shows how to open, write to, and close an XpsDocument.
// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;
Remarks
If the XpsDocument was opened for write access, data buffers are written to the store and the physical document Package is closed.
After Close has been called, no parts of the document can be accessed with this XpsDocument instance.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET