다음을 통해 공유


IXpsOMDocumentSequence 인터페이스 작업

이 항목에서는 XPS OM에서 문서 계층 구조의 최상위 수준인 FixedDocumentSequence에 대한 액세스를 제공하는 인터페이스를 사용하는 방법을 설명합니다.

인터페이스 이름 논리 자식 인터페이스 설명
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();