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:
- Create a new ReportGalleryDirectoryExtension class instance and pass the full file path as the constructor parameter.
- 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
Online Example: How to implement a custom Report Gallery storage
Do the following to store templates in any location (database, cloud, XPO object, etc.) and share them between multiple users:
Create a descendant from the abstract ReportGalleryExtension class.
Set the EnableSynchronization property to true to synchronize items in local Report Gallery instances with items from a shared storage.
Implement the TryLoadGallery method to load the Report Gallery from the storage.
Implement one of the following methods:
Create a storage instance and pass it to the static ReportGalleryExtension.RegisterExtensionGlobal method.
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.