共用方式為


IXpsOMPackage interface

Provides the top-level entry into the XPS object model tree.

Although this interface does not correspond to any XPS markup, it does correspond to the XPS document, and it is required to save the components of an XPS object model tree as an XPS document.

When to implement

Never. Custom implementation of this interface is not supported.

Members

The IXpsOMPackage interface inherits from the IUnknown interface. IXpsOMPackage also has these types of members:

  • Methods

Methods

The IXpsOMPackage interface has these methods.

Method Description
GetCoreProperties

Gets a pointer to the IXpsOMCoreProperties interface of the XPS package.

GetDiscardControlPartName

Gets the name of the discard control part in the XPS package.

GetDocumentSequence

Gets a pointer to the IXpsOMDocumentSequence interface that contains the document sequence of the XPS package.

GetThumbnailResource

Gets a pointer to the IXpsOMImageResource interface of the thumbnail resource that is associated with the XPS package.

SetCoreProperties

Sets the IXpsOMCoreProperties interface of the XPS package.

SetDiscardControlPartName

Sets the name of the discard control part in the XPS package.

SetDocumentSequence

Sets the IXpsOMDocumentSequence interface of the XPS package.

SetThumbnailResource

Sets the thumbnail image of the XPS document.

WriteToFile

Writes the XPS package to a specified file.

WriteToStream

Writes the XPS package to a specified stream.

 

Remarks

The code example that follows illustrates how to create an instance of this interface.

IXpsOMPackage    *newInterface;

// Note the implicit requirement that CoInitializeEx 
//  has previously been called from this thread.

hr = CoCreateInstance(
      __uuidof(XpsOMObjectFactory),
      NULL, 
      CLSCTX_INPROC_SERVER,
      __uuidof(IXpsOMObjectFactory),
      reinterpret_cast<LPVOID*>(&xpsFactory)
      );

if (SUCCEEDED(hr))
{
    hr = xpsFactory->CreatePackage (&newInterface);
    if (SUCCEEDED(hr))
    {
        // use newInterface

        newInterface->Release();
    }

    xpsFactory->Release();
}
else
{
    // evaluate HRESULT error returned in hr
}

For information about using this interface in a program, see Create a Blank XPS OM.

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

IXpsOMObjectFactory::CreatePackage

IXpsOMObjectFactory::CreatePackageFromFile

IXpsOMObjectFactory::CreatePackageFromStream

Interfaces

Create a Blank XPS OM

XML Paper Specification