IXpsFixedDocumentReader.Uri Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает универсальный код ресурса (URI) объекта FixedDocument.
public:
property Uri ^ Uri { Uri ^ get(); };
public Uri Uri { get; }
member this.Uri : Uri
Public ReadOnly Property Uri As Uri
Значение свойства
Объект Uri , представляющий универсальный код ресурса (URI) для документа.
Примеры
В следующем примере показано, как использовать свойство Uri.
// --------------------- IterateXpsPackageParts() ---------------------
/// <summary>
/// Iterates through the parts contained in a given XpsDocument
/// package initializing a tree view control with the name of each
/// part contained within the package.</summary>
/// <param name="xpsDocument">
/// The XPS document to extract the part names from.</param>
/// <param name="treeView">
/// The TreeView control to insert the part names into.</param>
/// <param name="fileName">
/// The XPS document filename.</param>
public void IterateXpsPackageParts(
XpsDocument xpsDocument, TreeView treeView, string fileName)
{
// Set up the Tree View
treeView.Items.Clear();
treeView.Visibility = Visibility.Visible;
TreeViewItem packageNode = new TreeViewItem();
packageNode.ToolTip = fileName;
packageNode.Header = System.IO.Path.GetFileName(fileName);
treeView.Items.Add(packageNode);
// Start with a DoucmentSequence.
IXpsFixedDocumentSequenceReader docSeq =
xpsDocument.FixedDocumentSequenceReader;
TreeViewItem docSeqNode = AddUriToTreeView(packageNode, docSeq.Uri);
// For every FixedDocument within the DocumentSequence.
foreach (IXpsFixedDocumentReader docReader in docSeq.FixedDocuments)
{
TreeViewItem docNode = AddUriToTreeView(docSeqNode, docReader.Uri);
// For every FixedPage within the FixedDocument.
foreach (IXpsFixedPageReader page in docReader.FixedPages)
{
TreeViewItem pageNode = AddUriToTreeView(docNode, docReader.Uri);
// For every Image on the page.
foreach (XpsImage image in page.Images)
{
AddUriToTreeView(pageNode, image.Uri);
}
// For every Font on the page.
foreach (XpsFont font in page.Fonts)
{
AddUriToTreeView(pageNode, font.Uri);
}
}
}
}// end:IterateXpsPackageParts()
' --------------------- IterateXpsPackageParts() ---------------------
''' <summary>
''' Iterates through the parts contained in a given XpsDocument
''' package initializing a tree view control with the name of each
''' part contained within the package.</summary>
''' <param name="xpsDocument">
''' The XPS document to extract the part names from.</param>
''' <param name="treeView">
''' The TreeView control to insert the part names into.</param>
''' <param name="fileName">
''' The XPS document filename.</param>
Public Sub IterateXpsPackageParts(xpsDocument As XpsDocument, treeView As TreeView, fileName As String)
' Set up the Tree View
treeView.Items.Clear()
treeView.Visibility = Visibility.Visible
Dim packageNode As New TreeViewItem With {
.ToolTip = fileName,
.Header = System.IO.Path.GetFileName(fileName)
}
treeView.Items.Add(packageNode)
' Start with a DoucmentSequence.
Dim docSeq As IXpsFixedDocumentSequenceReader = xpsDocument.FixedDocumentSequenceReader
Dim docSeqNode As TreeViewItem = AddUriToTreeView(packageNode, docSeq.Uri)
' For every FixedDocument within the DocumentSequence.
For Each docReader As IXpsFixedDocumentReader In docSeq.FixedDocuments
Dim docNode As TreeViewItem = AddUriToTreeView(docSeqNode, docReader.Uri)
' For every FixedPage within the FixedDocument.
For Each page As IXpsFixedPageReader In docReader.FixedPages
Dim pageNode As TreeViewItem = AddUriToTreeView(docNode, docReader.Uri)
' For every Image on the page.
For Each image As XpsImage In page.Images
AddUriToTreeView(pageNode, image.Uri)
Next image
' For every Font on the page.
For Each font As XpsFont In page.Fonts
AddUriToTreeView(pageNode, font.Uri)
Next font
Next page
Next docReader
End Sub