IDocumentPaginatorSource インターフェイス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
実際のコンテンツの改ページ位置の自動修正を実行するソース オブジェクトを定義します。
public interface class IDocumentPaginatorSource
public interface IDocumentPaginatorSource
type IDocumentPaginatorSource = interface
Public Interface IDocumentPaginatorSource
- 派生
例
次の例は、 インターフェイスの使用を IDocumentPaginatorSource 示しています。
// ------------------------- LoadDocumentViewer -----------------------
/// <summary>
/// Loads content from a file to a DocumentViewer control.</summary>
/// <param name="xpsFilename">
/// The path and name of the XPS file to
/// load to the DocumentViewer control.</param>
/// <remarks>
/// Exception handling should be added if the xpsFilename may not be
/// valid or if the FixedDocumentSequence contained in the file is
/// incorrect. (In this sample the files are hardcoded.)</remarks>
private void LoadDocumentViewer(string xpsFilename)
{
// Save a reference to the currently open XPS package.
XpsDocument oldXpsPackage = _xpsPackage;
// Open the package for the new XPS document.
_xpsPackage = new XpsDocument(xpsFilename,
FileAccess.Read, CompressionOption.NotCompressed);
// Get the FixedDocumentSequence from the package.
FixedDocumentSequence fixedDocumentSequence =
_xpsPackage.GetFixedDocumentSequence();
// Set the new FixedDocumentSequence as
// the DocumentViewer's paginator source.
docViewer.Document =
fixedDocumentSequence as IDocumentPaginatorSource;
// If there was an old XPS package, close it now that
// DocumentViewer no longer needs to access it.
if (oldXpsPackage != null)
oldXpsPackage.Close();
// Leave the new _xpsPackage open for DocumentViewer
// to access additional required resources.
}// end:LoadDocumentViewer()
' ------------------------- LoadDocumentViewer -----------------------
''' <summary>
''' Loads content from a file to a DocumentViewer control.</summary>
''' <param name="xpsFilename">
''' The path and name of the XPS file to
''' load to the DocumentViewer control.</param>
''' <remarks>
''' Exception handling should be added if the xpsFilename may not be
''' valid or if the FixedDocumentSequence contained in the file is
''' incorrect. (In this sample the files are hardcoded.)</remarks>
Private Sub LoadDocumentViewer(ByVal xpsFilename As String)
' Save a reference to the currently open XPS package.
Dim oldXpsPackage As XpsDocument = _xpsPackage
' Open the package for the new XPS document.
_xpsPackage = New XpsDocument(xpsFilename, FileAccess.Read, CompressionOption.NotCompressed)
' Get the FixedDocumentSequence from the package.
Dim fixedDocumentSequence As FixedDocumentSequence = _xpsPackage.GetFixedDocumentSequence()
' Set the new FixedDocumentSequence as
' the DocumentViewer's paginator source.
docViewer.Document = TryCast(fixedDocumentSequence, IDocumentPaginatorSource)
' If there was an old XPS package, close it now that
' DocumentViewer no longer needs to access it.
If oldXpsPackage IsNot Nothing Then
oldXpsPackage.Close()
End If
' Leave the new _xpsPackage open for DocumentViewer
' to access additional required resources.
End Sub
プロパティ
DocumentPaginator |
派生クラスで実装された場合、コンテンツの改ページ位置の自動修正を実行するオブジェクトを取得します。 |
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET