Share via


How to: Create a Report Wizard Template

To create a report wizard template, your extension must:

  • Reference the Microsoft.PerformancePoint.Scorecards.ModelerPlugins DLL.

  • Reference the Microsoft.PerformancePoint.Scorecards.Client DLL.

  • Inherit from the TemplateFactory or ReportViewTemplateFactory class; both are in the ModelerPlugins DLL.

  • Override the GetTemplateTypeId, GetTemplateType, GetTemplateItems, and CreateTemplateItem methods.

The example in this topic inherits from the TemplateFactory class.

Implementing ReportViewTemplateFactory

The following code example creates a wizard template for a report that is linked to a custom Ribbon button. When a user selects the report in PerformancePoint Dashboard Designer, the button is enabled on the Ribbon.

using System;
using System.Collections.Generic;
using CustomPlugin.Properties;
using Microsoft.PerformancePoint.Scorecards;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.ReportViews;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.Templates;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.Utilities;

namespace CustomPlugin
{
    public class CustomPluginTemplateFactory : TemplateFactory
    {

        // Get the identifier for the TemplateFactory class.
        public override string GetTemplateTypeId()
        {
            return "CustomPluginTemplate";
        }

        // Get the type of TemplateFactory.
        public override Type GetTemplateType()
        {
            return typeof (ReportViewTemplateFactory);
        }

        // Get the available template items for the template
        // creation wizard.
        public override List<TemplateItem> GetTemplateItems()
        {
            List<TemplateItem> templateItems = new List<TemplateItem>();

            // Create a template item.
            TemplateItem templateItem = new TemplateItem();

            // The image for the custom report template.
            // Change the image name to reference your custom image.
            templateItem.Image = Resources.CustomPlugin; 

            // Set properties for the item.
            templateItem.Name = "Custom Plugin";
            templateItem.TemplateId = "CustomPlugin";
            templateItem.TemplateTypeId = GetTemplateTypeId();
            templateItems.Add(templateItem); 
            return templateItems;
        }

        // Create a new template item (report) using the template 
        // specified in the "item" parameter.
        public override void CreateTemplateItem(TemplateItem item)
        {
            ReportView reportView = new ReportView();
            reportView.TypeName = CustomPluginFactory.CustomReportName; 
            reportView.Guid = Guid.NewGuid();
            reportView.Name.Text = "Custom Plugin";
            GeneralUtilities.AddToWorkspace(reportView, true);
        }
    }
}

See Also

Tasks

How to: Install a Ribbon Extension

Concepts

How to: Create a Ribbon Panel and Button
How to: Create a Ribbon Tab

Other Resources

Wizard Templates
Ribbon Items