Compartilhar via


Trabalhando com interfaces IXpsOMDocumentSequence

Este tópico descreve como usar as interfaces que fornecem acesso ao FixedDocumentSequence, que é o nível superior da hierarquia de documentos em um OM XPS.

Nome da interface Interfaces filho lógicas Descrição
IXpsOMDocumentSequence
IXpsOMDocument
Agrupa um conjunto de FixedDocuments em uma lista ordenada.
IXpsOMDocumentCollection
Nenhum
A coleção de FixedDocuments em uma sequência de documentos XPS.

Exemplo de código

O exemplo de código a seguir obtém um ponteiro para a interface IXpsOMDocumentSequence que contém a sequência de documentos do OM XPS representado por xpsPackage. Em seguida, o exemplo enumera os documentos na coleção.

    HRESULT                         hr = S_OK;

    IXpsOMDocumentSequence          *docSeq;
    IXpsOMDocumentCollection        *docs;
    IXpsOMDocument                  *doc;

    UINT32  numDocs = 0;
    UINT32  thisDoc = 0;

    // get the fixed document sequence of the package
    hr = xpsPackage->GetDocumentSequence(&docSeq);

    // get the collection of fixed documents in 
    //  the fixed document sequence
    hr = docSeq->GetDocuments(&docs);

    // walk the collection of documents;
    hr = docs->GetCount(&numDocs);
    thisDoc = 0;
    while (thisDoc < numDocs) {
        hr = docs->GetAt(thisDoc, &doc);
 
        // use this doc for something

        // release this doc and then go to the next one
        doc->Release();
        thisDoc++;
    }
    // release the document collection and
    // the document sequence
    docs->Release();
    docSeq->Release();