共用方式為


IXpsOMPackageWriter::Close method

Closes any open parts of the package, then closes the package.

Syntax

HRESULT Close();

Parameters

This method has no parameters.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return code Description
S_OK

The method succeeded.

XPS_E_UNAVAILABLE_PACKAGE

A severe error occurred and the contents of the XPS OM might be unrecoverable. Some components of the XPS OM might still be usable but only after they have been verified. Because the state of the XPS OM cannot be predicted after this error is returned, all components of the XPS OM should be released and discarded.

 

This method calls the Packaging API. For information about the Packaging API return values, see Packaging Errors.

Remarks

If any discardable parts that are referenced by a call to AddPage have not been received, an error will be returned.

After this method is called, calling any other IXpsOMPackageWriter method except IsClosed will return an error.

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

Xpsobjectmodel.h

IDL

XpsObjectModel.idl

See also

IXpsOMPackageWriter

IXpsOMPackageWriter3D

Using the IXpsOMPackageWriter Interface

Packaging Errors

XPS Document Errors

XML Paper Specification