ActiveReports 9
Custom Resource Locator
Show AllShow All
Hide AllHide All

Page reports and RDL reports can resolve resources from your file system using file paths, but sometimes resources are preserved in very specific sources, such as a database. With RDL report, you can create a custom resource locator to read any resources that might be required by your reports from any type of location. You can use it for resources such as images and theme files, or for reports to use in drillthrough links, subreports, or master reports.

API

You can implement a custom resource locator by deriving from the ResourceLocator Class and overriding the GetResource method.

The GetResource method returns ParentUri and Value properties. The Value property contains the located resource as a memory stream. The ParentUri property contains the string URI of the parent of the resource within the resource hierarchy.

Here is the GetResource method used in the sample.

C# MyPicturesLocator.cs code showing usage of the GetResource Method from the Sample

Visual Basic MyPicturesLocator.vb code showing usage of the GetResource Method from the Sample

Sample

In the Samples folder installed with the product, there is a Custom Resource Locator sample in a path like:

C:\Users\MyUserName\Documents\GrapeCity Samples\ActiveReports 9\Page Reports\RDL\API\C#\CustomResourceLocator 

This sample contains a custom resource locator that looks for files in the current user’s My Pictures folder. It does this by looking for special MyPictures protocol.

See Also

Walkthroughs

 

 


Copyright © 2016 GrapeCity, inc. All rights reserved

Support Forum