XPS OM Paket Arabirimleri

Paket arabirimleri, XPS belge dosyasına karşılık gelen XPS OM'nin en üst düzeyini temsil eder. Bu arabirimler, BIR XPS OM'yi bir XPS belgesine veya akışına seri hale getiren ve bir programın belgenin içeriğine erişmesini sağlayan bir XPS OM oluşturmak için XPS paketini seri durumdan çıkaran yöntemler içerir.

Arabirim adı Mantıksal alt arabirimler Açıklama
IXpsOMPackage
IXpsOMDocumentSequence
IXpsOMCoreProperties
XPS belgesini içeren pakete karşılık gelen eksiksiz XPS OM.
IXpsOMPackageWriter
Hiç kimse
Belge sayfalarının bir pakete artımlı seri hale getirilmesini sağlar.
IXpsOMCoreProperties
Hiç kimse
Belge meta verilerine erişir.

Kod Örnekleri

Aşağıdaki kod örnekleri, bazı paket arabirimlerinin bir program tarafından nasıl kullanıldığını gösterir. Aksi belirtilmediği sürece, tüm italik öğeler parametre adlarıdır.

XPS belgesini XPS OM'ye okuma

Dosya adı xpsDocumentFilenameiçinde depolanan mevcut bir XPS belgesinden bu kod örneği, xpsPackagetarafından başvurulan bir XPS OM oluşturur.

    HRESULT                 hr = S_OK;
    IXpsOMPackage           *xpsPackage;

    hr = xpsFactory->CreatePackageFromFile(
        xpsDocumentFilename,
        FALSE,
        &xpsPackage);

    // xpsPackage now contains a pointer to the IXpsOMPackage
    // object that has been populated with the contents
    // of the XPS document in xpsDocumentFilename.

XPS belge dosyasına XPS OM yazma

Aşağıdaki kod örneği, xpsPackagetarafından başvuruda bulunan XPS OM'yi yazar. Örnek, dosyasında adı fileNamedepolanan bir XPS belgesi oluşturur.

    HRESULT hr = S_OK;

    hr = xpsPackage->WriteToFile(
        xpsDocumentFilename,
        NULL,                    // LPSECURITY_ATTRIBUTES
        FILE_ATTRIBUTE_NORMAL,
        FALSE);                  // optimizeMarkupSize

XPS OM'nin belge dizisine erişme

Aşağıdaki kod örneği, xpsPackagetarafından temsil edilen XPS OM'nin belge sırasını içeren IXpsOMDocumentSequence arabirimine yönelik bir işaretçi alır.

    HRESULT                         hr = S_OK;
    IXpsOMDocumentSequence          *docSeq;
    IXpsOMDocumentCollection        *docs;

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

Belgenin CoreProperties öğesine erişme

Aşağıdaki kod örneği, IXpsOMCoreProperties arabirimine bir işaretçi alarak programın CoreProperties bölümünün içeriğine erişmesine olanak sağlar. Örnekte, belgenin xpsPackagetarafından temsil edilen bir XPS OM'ye okunduğu varsayılır.

    HRESULT                         hr = S_OK;
    IXpsOMCoreProperties            *coreProps;
    LPWSTR                          title;

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

    // get the title property 
    hr = coreProps->GetTitle(&title);

    // do something with the title property here...

    // free the string when finished with it
    CoTaskMemFree ( title );
    coreProps->Release();

IXpsOMPackageWriter Arabirimini Kullanma

XPS OM gezinme

IXpsOMDocumentSequence Arabirimi

IXpsOMPackage Arabirimi

IXpsOMPackageWriter Arabirimi

IXpsOMCoreProperties Arabirimi