The BeforeReportSaved method is called just before a report is saved. It allows you to change something about the report before it’s written to an SFX file.


public void BeforeReportSaved(IReportBase report)


report The report being saved.


This example, an excerpt from SampleReportEnginePlugin.cs of the Samples\SamplePlugins\SamplePlugins folder, ensures the report uses a tag with the user’s name in it. If such a tag doesn’t exist, it’s created.

/// <summary>
/// Executes just before the specified report is saved. In this case,
/// we'll make sure the report uses a tag with the user's name in it.
/// </summary>
/// <param name="report">
/// The report being saved.
/// </param>
public void BeforeReportSaved(IReportBase report)
    // First see if the report already has the desired tag.
    string tagName = Application.Security.CurrentUser.Name + "'s Reports";
    bool gotIt = report.Tags.Any(t => t.Name == tagName);
    if (!gotIt)
        // It doesn't so see if the tag exists and add it if not.
        ITag tag = Application.ReportEngine.Tags[tagName];
        if (tag == null)
            tag = Application.ReportEngine.Tags.New(tagName);

        // Add the tag to the report.