Skip to main content
A newer version of this page is available. .

ReportPreview Class

Provides information about a report preview.

Declaration

export class ReportPreview extends Disposable

Properties

documentBuilding Property

Provides access to a value that specifies whether the document is currently building.

Declaration

documentBuilding: ko.Observable<boolean>

Property Value

Type Description
Observable<boolean>

A knockout observable object that specifies whether the document is building.

errorMessage Property

Declaration

errorMessage: ko.Observable<string>

Property Value

Type
Observable<string>

pageIndex Property

Provides access to the current document page’s index.

Declaration

pageIndex: ko.Observable<number>

Property Value

Type Description
Observable<number>

A knockout observable object that specifies the zero-based index of the current page.

pages Property

Provides access to document pages.

Declaration

pages: ko.ObservableArray<PreviewPage>

Property Value

Type Description
ObservableArray<PreviewPage>

An array of objects that specify document pages.

previewBrickKeyboardHelper Property

Declaration

previewBrickKeyboardHelper: PreviewBricksKeyboardHelper

Property Value

Type
PreviewBricksKeyboardHelper

reportOpening Property

Declaration

reportOpening: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

showMultipagePreview Property

Enables the Document Viewer’s multi-page mode.

Declaration

showMultipagePreview: ko.Observable<boolean>

Property Value

Type Description
Observable<boolean>

A knockout observable object that specifies whether the multi-page mode is enabled.

Remarks

The following code shows the BeforRender handler function that enables the MultiPage mode when the Document Viewer is initialized, and the CustomizeMenuActions event handler function that changes the toolbar icon when the MultiPage mode is toggled. Initially the Toggle Multipage Mode icon indicates the target mode; the code below changes the icon, so it indicates the current mode.

function onBeforeRender(s, e) {
     e.reportPreview.showMultipagePreview(true);
     s.GetPreviewModel().reportPreview.showMultipagePreview.subscribe(
          function (newValue) {
               s.myMultiPagePreview(newValue);
          }
     );
};

function onCustomizeMenuActions(s, e) {
     s.myMultiPagePreview = ko.observable(false);
     var multiPageToggle = e.GetById(DevExpress.Reporting.Viewer.ActionId.MultipageToggle);
     multiPageToggle.imageTemplateName = ko.pureComputed(
          function () {
               return s.myMultiPagePreview()
               ? 'dxrd-svg-preview-multi_page_preview'
               : 'dxrd-svg-preview-single_page';
          }
     );
};

The result is shown below. Note that the Toggle Multipage Mode button displays the single page icon when single page mode is enabled, and multipage icon when multipage mode is enabled.

Multipage = True Multipage = False
Multipage = True) Multipage = False)

zoom Property

Zooms the Document Viewer’s current document.

Declaration

zoom: ko.PureComputed<any>

Property Value

Type Description
PureComputed<any>

A knockout observable object that specifies the zoom factor.

Remarks

Call the zoom method to zoom a document by a specific zoom factor passed as a parameter.

You can also use the following values of the DevExpress.Reporting.Viewer.ZoomAutoBy object as a function parameter: None, WholePage and PageWidth.

<script>
    function Init(s, e) {
        s.GetReportPreview().zoom(0.9);
        //s.GetReportPreview().zoom(DevExpress.Reporting.Viewer.ZoomAutoBy.PageWidth);
    }
</script>

<dx:ASPxWebDocumentViewer ID="ASPxWebDocumentViewer1" runat="server" ReportSourceId="DXWebApplication1.XtraReport1">
    <ClientSideEvents Init="Init"/>
</dx:ASPxWebDocumentViewer>

Methods

delayedInit Method

Declaration

delayedInit(): void