本主題描述如何使用提供對 FixedDocumentSequence 存取權的介面,這是 XPS OM 中檔階層的最上層。
| 介面名稱 | 邏輯子介面 | 描述 |
|---|---|---|
|
IXpsOMDocumentSequence |
IXpsOMDocument |
將一組固定文件整理為已排序的清單。 |
|
IXpsOMDocumentCollection |
沒有 |
XPS 檔序列中 FixedDocuments 的集合。 |
程式代碼範例
下列程式代碼範例會取得 IXpsOMDocumentSequence 介面的指標,其中包含由 xpsPackage所表示之 XPS OM 的文件序列。 然後,此範例會列舉集合中的檔。
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();