Get FixedDocuments from FixedDocumentSequence

Pretty simple:

I have an XPSDocument that I am removing from disk. I would like to get FixedDocuments from this XpsDocument, but I hit a bit of trimmer, since I can only get FixedDocumentSequence, and I can't figure out how to get XpsDocuments out of this sequence.

So far I have tried something like:

FixedDocument doc = (FixedDocument)myFixedDocSequence.References.First();   

This action does not work, but it illustrates what I am trying to achieve.

+3
source share
1 answer

myFixedDocSequence.References.First();must return DocumentReference. What instead of casting did you try to use a method DocumentReference.GetDocumentthat returns FixedDocument? The code will look like this:

DocumentReference docReference = myFixedDocSequence.References.First();
FixedDocument doc = docReference.GetDocument(false);

GetDocument. , , References.First() , FirstOrDefault() .

+6

Source: https://habr.com/ru/post/1749419/


All Articles