次の方法で共有


IXpsOMDocumentSequence インターフェイスの操作

このトピックでは、XPS OM のドキュメント階層の最上位レベルである FixedDocumentSequence へのアクセスを提供するインターフェイスを使用する方法について説明します。

インターフェイス名 論理子インターフェイス Description
IXpsOMDocumentSequence
IXpsOMDocument
FixedDocuments のセットを順序付きリストにグループ化します。
IXpsOMDocumentCollection
なし
XPS ドキュメント シーケンス内の FixedDocuments のコレクション。

コード例

次のコード例では、xpsPackage で表される XPS OM のドキュメント シーケンスを含む IXpsOMDocumentSequence インターフェイスへのポインターを取得します。 次に、コレクション内のドキュメントを列挙します。

    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();