Skip to main content

DocumentViewer Class

A control that allows you to preview, print, save, and export a document created with a PrintableLink or a report created with the DevExpress Reporting Suite.

Namespace: DevExpress.WinUI.DocumentViewer

Assembly: DevExpress.WinUI.DocumentViewer.v23.2.dll

NuGet Package: DevExpress.WinUI

Declaration

public class DocumentViewer :
    Control,
    IXamlRootProvider,
    INativeDocumentViewer,
    IUIDispatcher,
    IInteractiveBrickNavigator

Remarks

The following image shows a DocumentViewer control that displays a report:

DocumentViewer - GUI

The DocumentSource property specifies the object that can be converted to a document for display in the DocumentViewer control.

Visual Elements

The DocumentViewer contains the following UI elements:

DocumentViewer - GUI

Common Tasks

Preview a Document

Assign the following objects to the DocumentSource property:

Report
An object that implements the IReport interface: the XtraReport class descendants and CachedReportSource objects.
Print Link
An object that implements the ILink interface. You can use the DocumentViewer to preview, print, and export the GridControl‘s data. Refer to the following topic for more information on how to print a GridControl: Print and Export Data.
Data Stream
A Stream that contains a serialized Document.
URI
The URI of the file in PRNX format that contains the document.
String
A path to the file in PRNX format that contains the report document. If a string contains the “ms-appx:” prefix, the string is interpreted as a URI. Review the following topic for more information on report documents and PRNX files: Create, Save and Open Report Documents.

Note

The Reporting, DXperience, or Universal subscription is required to use an object that implements the IReport interface in your code. For pricing information, refer to the DevExpress Products matrix.

For more information on how to preview a report in the DocumentViewer, review the following topic: Get Started with WinUI Reporting.

Save a Document

Call the Save(String) method to save the document to a file in PRNX format.

You can run the ShowSaveDialogCommand or click Save As in the toolbar to open the Save As dialog.

Export a Document

Call the Export(ExportFormat, String) method to save the document in one of the following formats:

You can run the ShowExportDialogCommand or click Export in the toolbar to open the Export dialog:

Export Dialog

Call the ShowPrintDialogCommand or click Print in the toolbar to open the Print dialog window.

Show the Parameter Panel

You can run the ToggleReportParameterPanelCommand or click the Parameters button in the toolbar to show/hide the Parameters panel.

Review the following topic for more information on report parameters: Specify Parameter Values.

Customize the Toolbar

To create a DocumentViewer‘s custom command bar items, hide the built-in toolbar and define a new command bar in XAML. For an example of a custom toolbar, review the following help topic: Customize the Document Viewer Toolbar in the WinUI Application.

See Also