Skip to main content

WebDocumentViewerClientSideEventsBuilder.CustomizeExportOptions(String) Method

Sets the name of the JavaScript function or the entire code that will handle the Web Document Viewer‘s CustomizeExportOptions client-side event.

Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

Assembly: DevExpress.AspNetCore.Reporting.v24.1.dll

NuGet Package: DevExpress.AspNetCore.Reporting

Declaration

public WebDocumentViewerClientSideEventsBuilder CustomizeExportOptions(
    string callback
)

Parameters

Name Type Description
callback String

The name of a JavaScript function or the JavaScript function code used to handle the CustomizeExportOptions event.

Returns

Type Description
WebDocumentViewerClientSideEventsBuilder

A WebDocumentViewerClientSideEventsBuilder that can be used to configure the Document Viewer’s client-side events.

Remarks

The CustomizeExportOptions event allows you to hide export formats and specify the default export options in the Web Document Viewer.

The following code specifies customizeExportOptions handler function for the CustomizeExportOptions event:

@{
    var documentViewer = Html.DevExpress().WebDocumentViewer("webDocumentViewer1")
        .Height("1000px")
        .ClientSideEvents(configure => {
        configure.CustomizeExportOptions("customizeExportOptions");
        })
        .Bind("TestReport");
}
@documentViewer

The handler function receives two parameters - the first parameter is the client-side DocumentViewer object, the second parameter is the ASPxClientCustomizeExportOptionsEventArgs object with the following methods:

  • HideExportOptionsPanel - Hides the Export Options panel.

    function customizeExportOptions(s, e) {
        e.HideExportOptionsPanel();
    }
    
  • HideFormat - Hides the specified export format from the Export To drop-down list and also hides the related category from the Export Options panel.

    function customizeExportOptions(s, e) {
        e.HideFormat(DevExpress.Reporting.Viewer.ExportFormatID.XLS); 
    }
    
  • HideProperties - Hides the specified options for the export format in the Export Options panel. To remove all options for a particular export format, specify only the first method parameter.

    function customizeExportOptions(s, e) {            
        e.HideProperties(DevExpress.Reporting.Viewer.ExportFormatID.XLS, "ExportMode", "PageRange");
        e.HideProperties(DevExpress.Reporting.Viewer.ExportFormatID.XLSX);
    }
    
  • GetExportOptionsModel - Returns the export options model for the specified export format. Use this model to change the option’s default value.

    function customizeExportOptions(s, e) {     
        var model = e.GetExportOptionsModel(DevExpress.Reporting.Viewer.ExportFormatID.XLS);
        model.exportHyperlinks(false);
    }
    

To specify a document format in the method’s parameter, use the ExportFormatID enumeration value.

See Also