extensions Element Overview
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.
|
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 |
|
<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 |
|
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
XML-based configuration file:
<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>
JSON-based configuration file:
"telerikReporting": {
"extensions": [
{
"name": "PDF",
"description": "PDF Description",
"parameters": [
{
"Name": "DocumentAuthor",
"Value": "John Doe"
}
]
}
]
}
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 edit 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:
XML-based configuration file:
<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>
JSON-based configuration file:
"telerikReporting": {
"extensions": [
{
"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": [
{
"Name": "TiffCompression",
"Value": "ccitt4"
}
]
}
]
}
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);
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
Dim deviceInfo As New System.Collections.Hashtable()
deviceInfo.Add("DocumentAuthor", "John Doe")
deviceInfo.Add("DocumentTitle", "My Doc title")
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()
' reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName
Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo)