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

Implement a Custom Report Gallery Storage

  • 2 minutes to read

The Report Gallery stores templates in the %localappdata%\Developer Express Inc\XtraReports Suite\ReportGallery.xml file. This document describes how to implement a custom Report Gallery storage.

Specify Another File

Do the following to store the Report Gallery’s templates in another file:

  1. Create a new ReportGalleryDirectoryExtension class instance and pass the full file path as the constructor parameter.
  2. Pass this instance to the static ReportGalleryExtension.RegisterExtensionGlobal method.

The code below demonstrates how to store templates in the directory that contains the application’s executable file.

using System.IO;
using DevExpress.XtraReports.Extensions;

// ...
string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ReportGallery.xml");
ReportGalleryExtension.RegisterExtensionGlobal(new ReportGalleryDirectoryExtension(path));

Provide a Custom Shared Storage

Do the following to store templates in any location (database, cloud, XPO object, etc.) and share them between multiple users:

  1. Create a descendant from the abstract ReportGalleryExtension class.

    using DevExpress.XtraReports.Extensions;
    //... 
    
    public class MyGalleryStorage : ReportGalleryExtension {
         // ...
    }
    
  2. Set the EnableSynchronization property to true to synchronize items in local Report Gallery instances with items from a shared storage.

  3. Implement the TryLoadGallery method to load the Report Gallery from the storage.

  4. Implement one of the following methods:

  5. Create a storage instance and pass it to the static ReportGalleryExtension.RegisterExtensionGlobal method.

    using DevExpress.XtraReports.Extensions;
    
    // ...
    ReportGalleryExtension.RegisterExtensionGlobal(new MyGalleryStorage());
    

If you enable gallery synchronization, the Refresh button becomes available in the Report Gallery toolbar. Click this button to explicitly synchronize gallery items with the storage.

The following dialog appears when you try to move or rename an item that another user removed:

Click OK to restore this item and add it to the Restored folder.