- 3 minutes to read
This topic describes the DocumentPreviewControl that is used to display an interactive document preview in WPF applications.
The topic consists of the following sections.
The Document Preview displays document data provided by a document source of one of the following supported document source types.
- An object implementing the IReport interface.
- An object implementing the ILink interface.
- A Stream containing report document data.
- A string containing a path to a file that stores report document data (a PRNX file).
When a document is created, it is shown in the Document Preview.
Invoke the Document Preview
To show a document in a Document Preview, use one of the following approaches.
- Call the corresponding methods of the PrintHelper class or create a DocumentPreviewWindow instance. In these cases, only the default Document Preview is shown.
Add the DocumentPreviewControl to your application and associate it with the required document.
In this case, you can fully customize the Document Preview, which is demonstrated in the following tutorial: Customizing the Document Preview Toolbar.
For more details, see Document Preview.
The Document Preview can include a toolbar and menu that contain buttons used to view, navigate, edit, print and export a document. The following two toolbar types are supported.
Each toolbar button triggers a specific command. For example, clicking the Page Setup... button triggers the DocumentPreviewControl.PageSetupCommand and invokes the Page Setup dialog, which is shown in the following image.
Document Map Panel
If a document contains bookmarks, the Document Map panel becomes available and allows you to quickly navigate through the document.
If a report has visible parameters, the corresponding button that defines the visibility of the Parameters panel becomes available. The Parameters user interface allows you to modify parameter values and update the document accordingly.
The Thumbnails toolbar button changes the visibility of report thumbnails used to quickly navigate between document pages.
To search for a specific text throughout a document, invoke the dedicated Search panel by clicking the Search toolbar button.
If content editing is enabled for document elements, it is possible to customize the corresponding field values in the Document Preview (clicking a field will invoke an appropriate editor). To highlight all editing fields available in a document, click the Editing Fields toolbar button.
You can add the drill-down functionality to a report to display data partially. Hidden data can be accessed in the Document Preview by clicking the designated element.
Document Preview Mouse Events
For code samples, see the following examples online.
To learn how to customize the Document Preview, see the following tutorials:
- Customizing the Document Preview Toolbar
- Overriding Document Preview Commands
- Providing Custom Editors for Report Parameters