Reporting — Enhancements, Documentation Updates, Tips & Tricks (October 2022)

Reporting Team Blog
17 October 2022

This post documents recent changes made to help topics, and links to a handful of support tickets that might be of value to those using and/or considering DevExpress Reports for an upcoming project.

New Examples and Documentation Updates

We also updated the following help topics:

The following topics now contain updated code examples:

Enhancements

Because of images used within a report, large reports on Linux OS consume more memory when compared to Windows. Even when images are duplicated, each image is stored in memory as a separate instance. To address this issue, we introduced a new PageCacheSize property for CachedReportSource and CachedDocumentSource classes. This property allows you to enlarge the image cache size and reduce memory consumption. Set this property to a small value (2-5) if your report page contains multiple images.

public class CustomViewerOperationLogger : WebDocumentViewerOperationLogger { 
  public override void CachedDocumentSourceSerializing(string documentId, CachedDocumentSource cachedDocumentSource, 
  GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage, 
  PrintingSystemBase printingSystemSource) { 
    cachedDocumentSource.PageCacheSize = 5; 
  } 

  public override void CachedDocumentSourceDeserialized(string documentId, CachedDocumentSource cachedDocumentSource, 
  GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage) { 
    cachedDocumentSource.PageCacheSize = 5; 
  } 
}

Interesting Support Tickets

All Platforms

  1. T1070290 - How to disable an extra character in a barcode string
    https://supportcenter.devexpress.com/ticket/details/T1070290
  2. T1070781 - How to specify the summary used for a TimeSpan column
    https://supportcenter.devexpress.com/ticket/details/T1070781
  3. T1066200 - How to use an Expression Editor to remove the first character from label text
    https://supportcenter.devexpress.com/ticket/details/T1066200

    You can use the `Remove(String, StartPosition, Length)` string function in a label's text expression as follows:

    Remove([ReportItems.label1].[Text], 0, 1)

Reporting for WinForms

  1. T1060687 - How to set an active report in a multi-tab report designer
    https://supportcenter.devexpress.com/ticket/details/T1060687

    Use the XRDesignMdiController.XtraTabbedMdiManager property to receive an XtraTabbedMdiManager instance, and call the ActivateDocument method to activate the opened pane, as shown below:

    XRTabbedMdiManager manager = _controller.XtraTabbedMdiManager as XRTabbedMdiManager; 
    
    // Activate first opened report 
    manager.View.ActivateDocument((Control)manager.View.Documents[0].Form); 
  2. T1060695 - How to register a custom parameter type for a new report
    https://supportcenter.devexpress.com/ticket/details/T1060695

Reporting for ASP.NET Core

  1. T1084780 - How to select the first item as the default value in a Parameter drop-down list
    https://supportcenter.devexpress.com/ticket/details/T1084780

    The ParametersInitialized event allows you to populate parameter editors with custom parameter values. In the event handler, obtain the first item from the list in the lookupValues collection, and pass this value to the ActualParametersInfo.value function.

    <script> 
        function onParameterInitialized(s,e){ 
            var p1 = e.ActualParametersInfo 
            .filter(x => x.parameterDescriptor.name == "parameter1")[0]; 
            p1.value(p1.lookUpValues()[0]); 
            p1 && e.Submit(); 
        } 
    </script> 
    
    @{ 
        var viewerRender = Html.DevExpress().WebDocumentViewer("DocumentViewer") 
            .Height("1000px") 
            .ClientSideEvents(c => c.ParametersInitialized("onParameterInitialized")) 
            .Bind("TestReport"); 
        @viewerRender.RenderHtml() 
            }
  2. T1058602 - How to build a Linux Alpine image for a DevExpress-powered reporting application
    https://supportcenter.devexpress.com/ticket/details/T1058602
  3. T1057147 - How to localize export option labels
    https://supportcenter.devexpress.com/ticket/details/T1057147
  4. T1065539 - How to auto-save a report after each change
    https://supportcenter.devexpress.com/ticket/details/T1065539

    To save a report each time it receives changes, handle the ReportOpened event and use the GetCurrentTab method to get the current designer tab. Subscribe to the current designer tab's isModified property to track when a report or its element are changed. When a function hits, call the client-side SaveReport method to save the current report. Call ResetIsModified to clear the current report tab's modification flag.

    function onReportOpened(s,e){ 
           var isSaving = false; 
           s.GetCurrentTab().isModified.subscribe(function(newVal){ 
               if(newVal && !isSaving){ 
                 console.log("Report was saved"); 
                 reportDesigner.SaveReport().done(() => {
                        isSaving = true; 
                        reportDesigner.ResetIsModified(); 
                    isSaving = false; 
                  }); 
               } 
           }); 
        }

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.