Progress® Telerik® Reporting R2 2017

extensions Element

Extensions XML element specifies a collection of extension types, for which configuration is applied.

Attributes and Elements

<extensions> element

Attributes

No attributes are defined for this element

Child elements

render – specifies a collection of render extensions, for which the configuration settings are applied.

Parent element

Telerik.Reporting - specifies the root element of the Telerik Reporting configuration settings. Only one Extensions element can be used in the Telerik.Reporting element.

<render> element

Render XML element specifies a collection of extensions, for which configuration is applied.

Attributes

No attributes are defined for this element

Child elements

extension – specifies an extension, for which the configuration settings are applied. Multiple Extension elements can be applied in the Render element

Parent element

extensions - specifies a collection of extension types, for which configuration is applied. Only one Render element can be used in the Extensions element.

<extension> element

Extension XML element specifies an extension, for which the configuration settings are applied.

Attributes

name – required string attribute. Name is the key attribute that determines on which extension the configuration is to be applied. The name for every extension is defined in the class definition of the extension, in the ExtensionNameAttribute attribute. The list of all available extension names can be found in Rendering Extensions help article.

  • type – optional string attribute. It is used when new extension is added or a core extension is overridden with a new one. Specifies the name of the extension class to be used when an extension with the name specified in the name attribute is needed. Use the following format:

    type="Fully qualified class name, assembly file name, version, culture, public key token "

    For example : type="MyAssembly.MyExtension, MyAssembly, Version=1.0.0.0, Culture=neutral,PublicKeyToken=null"

  • description - optional string attribute. Defines a description for the extension.It is used to override the default description of the extension. The reporting engine uses the description in places where the extensions are listed. For example in the Win and Web ReportViewer controls descriptions are used as labels in the dropdownwith available export formats. The default value of the description of every extension is defined in the class definition of the extension, by the ExtansionDescriptionAttribute attribute.
  • visible – Optional boolean attribute(the valid values are visible=”true” or visible=”false”). The value is used to determine if the extension must be populated in the lists of available extensions. The default value is true. You can use it to hide the export format from the list of the available render extensions.
  • order – Optional integer attribute. The value is used to order the extensions in the available extensions list. You can use it to order the extensions in the viewers formats dropdown. For example if you set the DOCX rendering extension an order value of 1, it will be listed first in the rendering extensions list. If two extensions have the same order number, they are ordered by their description (ascending). By default all extensions have order value of int.MaxValue.

Child elements

parameters – specifies a collection of parameters for the extension in the extension element. Only one parameters element can be used in the extension element.

Parent element

render - specifies a collection of extensions, for which the configuration is applied. Multiple Extension elements can be applied in the Render element.

<parameters> element

Parameters XML element specifies a collection of parameters for the extension defined in the parent extension element.

Attributes

No attributes are defined for this element

Child elements

parameter – specifies a parameter for the extension in the Extension element. Multiple Parameter elements can be used in the Parameters element.

Parent element

  • extension - specifies an extension, for which the configuration is applied. Only one Parameters element can be applied in the Extension element. The default value is true. You can use it to hide the export format from the list of the available render extensions.
  • provider - specifies a cache provider to register for use in the application.

<parameter> element

Parameter XML element specifies a parameter for the extension defined in the ancestor Extension element. The parameter is supplied as name/value pairs. The list of all parameters available for each extension can be found in Device Information Settings section.

Attributes

  • name – the name of the parameter that is supplied. Required attribute.
  • value – the value of the parameter with the name specified. As the value can be only a string, the parameter Type must have an associatedTypeConverter that handles conversions from string. Built-in .NET value types and enums have type converters defined.

Child elements

No child elements are defined for this element.

Parent element

parameters - specifies a collection of parameters for the extension defined in the parent extension element. Multiple parameter elements can be used in the parameters element.

Example

<configuration>
  <Telerik.Reporting>
    <extensions>
      <render>
        <extension name="PDF" description="PDF Description">
          <parameters>
            <parameter name="DocumentAuthor" value="John Doe"/>
          </parameters>
        </extension>
      </render>
    </extensions>
  </Telerik.Reporting>
</configuration>

Configuring Multiple Entries for a Rendering Extension

You can specify multiple instances of a single rendering extension to vary rendering behavior. If you configure multiple instances, make sure that each extension name is unique. Then you can use the rendering extension programmatically by using the extension name to identify which particular instance to use for a particular rendering operation.

You should also specify the description attribute of the Extension element. The string you specify for description will be visible to users in the list of export options for the report. If you are configuring multiple versions of the same extension, be sure to provide a value for the description. Otherwise, all versions of the extension will have the same export option name.

The following example illustrates how to use the default Image rendering extension (which produces TIFF output) alongside a second instance that outputs reports in EMF. Notice that the extension name distinguishes one instance from the other:

<Telerik.Reporting>
  <extensions>
    <render>
      <extension name="TIFF_CCITT4"
                 type="Telerik.Reporting.ImageRendering.ImageReport, Telerik.Reporting, Version=x.x.x.x, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
                 description="TIFF file (CCITT Group 4)">
        <parameters>
          <parameter name="TiffCompression" value="ccitt4" />
        </parameters>
      </extension> 
    </render>
  </extensions>   
</Telerik.Reporting>
Caution note Caution

The code samples have the version listed as Version=x.x.x.x, and you should change that with the exact assembly version you use before proceeding.

Set rendering parameters programmatically

To define device rendering parameters programmatically, we need a key/value pair, and what better than a HashTable which represents collection of key/value pairs. If the collection contains rendering parameters that are not supported by the specified rendering extension, they would be ignored.

Telerik.Reporting.Processing.ReportProcessor reportProcessor =
    new Telerik.Reporting.Processing.ReportProcessor();

System.Collections.Hashtable deviceInfo =
    new System.Collections.Hashtable();

deviceInfo.Add("DocumentAuthor", "John Doe");
deviceInfo.Add("DocumentTitle", "My Doc title");

Telerik.Reporting.TypeReportSource typeReportSource =
             new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

Telerik.Reporting.Processing.RenderingResult result =
    reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo);