Ticket Q446512
Visible to All Users

Load images only for current displayed report page in XtraReport.

created 12 years ago

Hello Devexpress,
I have an application that uses XtraReports Suite to generate reports. Report contains textual data as well as image data, Image size can be
between 2 MB – 5 MB and data set will contain thousands of records. Right now, we have used “Before Print” event for loading images dynamically from file system or from data base as per configuration and displaying it on PictureBox control on same event.

But with this approach, memory usage of application goes high and high which ends with “out of memory exception” which is inappropriate. Now, is there any way to load images for current displayed report page only? I mean loading images on scroll (or Next
Page and Previous Page clicked) and cleaning other images/resources from not visible report pages.

Answers

created 12 years ago (modified 12 years ago)

Thank you for contacting us. Please note that when a report document is being generated, it is not cached on a disk and completely stays in memory while being used. That is why the OutOfMemoryException is thrown. I am afraid there is no solution to this problem for the x86 platform, because an OS cannot allocate all necessary memory for the project. This is not an XtraReports Suite issue, but the 32-bit OS specifics.
In your case, I can only suggest you the following possible solutions:

  1. Publish your project only to x64 machines;
  2. Make a Report Server solution. In this case, reports will be generated on the x64 server, and the resultant documents will be send to the Clients if necessary.
  3. Create multiple reports with a small set of pages;
    Feel free to contact us if you need any further clarification on this issue.
    Show previous comments (1)
    DevExpress Support Team 12 years ago

      Hi Azilen,
      If you wish to merge a smaller document in a single document container, the OutOfMemory exception will still occur. To avoid this, use the filtering approach to display only a subset of data in the report document:
      How to: Filter Data at a Data Source's Level.

        Hi Devexpress ,
             I got your point of filtering approach but I would like to mention that the sole purpose of this discussion is to avoid OutOfMemory exception in normal case without filtering as user may not always like to generate report in filtering mode. Yes, I can reduce the memory usage using this filtering approach but as this is not possible for me in all scenarios, I need to follow any other approach. So, would you please give me some more explanation for the 3rd solution given by you (i.e. Create multiple reports with a small set of pages)?

        DevExpress Support Team 12 years ago

          Hi Azilen,
          I confirm that the 3rd approach mentioned by Sergi is about filtering the report datasource and generating smaller report documents. If you are experiencing the OutOfMemory error when generating a big report document, the same error will occur when creating smaller documents and joining them into a single document container. At present, there is no built-in support for the partial report document generation procedure. Should you need further clarification, feel free to ask. I will be glad to help you.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.