Document Preview
- 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:
Overview
The Document Preview displays document data provided by a document source of one of the following supported document source types:
- An object that implements the IReport interface.
- An object that implements the ILink interface.
- A Stream that contains report document data.
- A string that contains a path to a file that stores report document data (a PRNX file).
When a document is created, it is displayed in the Document Preview.
Invoke the Document Preview
You can display a document in a Document Preview as follows:
Call the corresponding method of the PrintHelper class or create a DocumentPreviewWindow instance. Note that only the default Document Preview is displayed.
Add the DocumentPreviewControl to your application and associate it with the required document.
You can fully customize the Document Preview, which is demonstrated in the following tutorial: Customizing the Document Preview Toolbar.
Refer to the following section for more information: Document Preview.
Main Features
Toolbar
The Document Preview can include a toolbar and menu that contain buttons used to view, navigate, edit, print and export a document. The control supports the following toolbar types:
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 illustrated in the following image:
Use the CommandBarStyle property to specify the toolbar type.
Document Map Panel
If a document contains bookmarks, the Document Map panel becomes available and allows you to quickly navigate through the document.
Parameters Panel
If a report has visible parameters, a corresponding button that toggles the visibility of the Parameters panel appears. The Parameters panel UI allows you to modify parameter values and regenerates the document accordingly.
Thumbnails Panel
The Thumbnails toolbar button changes the visibility of report thumbnails used to quickly navigate between document pages.
Search Panel
To search for specific text throughout a document, click the Search toolbar button to invoke the dedicated Search panel.
Interactivity
Content Editing
If content editing is enabled for document elements, you can customize the corresponding field values in the Document Preview (clicking a field will invoke a corresponding editor). To highlight all editable fields available in a document, click the Editing Fields toolbar button.
Drill-Down Reports
You can add drill-down functionality to a report to display data partially. Users can click the Show Details / Hide Details element to access the hidden detail data.
Document Preview Mouse Events
You can add interactivity to reports displayed in a Document Preview using the following Print Preview mouse events (for example, to create drill-through reports or enable data sorting directly in the preview):
- DocumentPreviewControl.DocumentPreviewMouseClick
- DocumentPreviewControl.DocumentPreviewMouseDoubleClick
- DocumentPreviewControl.DocumentPreviewMouseMove
Refer to the following example for more information: How to create a drill-through report in WPF.
Customization
To learn how to customize the Document Preview, refer to the following tutorials:
- Customizing the Document Preview Toolbar
- Overriding Document Preview Commands
- Providing Custom Editors for Report Parameters