Skip to main content

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.

document-preview-wpf

Invoke the Document Preview

You can display a document in a Document Preview as follows:

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:

page-setup-dialog-wpf

Use the CommandBarStyle property to specify the toolbar type.

wpf-document-viewer-generate-ribbon-layout

Document Map Panel

If a document contains bookmarks, the Document Map panel becomes available and allows you to quickly navigate through the document.

document-map-panel-wpf

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.

parameters-panel-wpf

Thumbnails Panel

The Thumbnails toolbar button changes the visibility of report thumbnails used to quickly navigate between document pages.

report-thumbnails-wpf

Search Panel

To search for specific text throughout a document, click the Search toolbar button to invoke the dedicated Search panel.

search-panel-wpf

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.

content-editing-wpf

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.

drill-down-report

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):

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:

See Also