Hi,
I'm trying out Telerik Reporting for .NET Core and I'm having an issue configuring the export device settings for CSV I've added the app.config file specified at the bottom of: http://docs.telerik.com/reporting/html5-report-viewer-asp-net-core
This app.config is being picked up by the program because it allowed me to input the connection string and run up the report.
After this I tried adding in extension settings as detailed in your support blog: http://www.telerik.com/support/kb/reporting/details/configuring-the-csv-rendering-extension
My implementation is below:
<
configuration
>
<
configSections
>
<
section
name
=
"Telerik.Reporting"
type
=
"Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=10.2.16.914, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
allowLocation
=
"true"
allowDefinition
=
"Everywhere"
/>
</
configSections
>
<
Telerik.Reporting
>
<
Extensions
>
<
Render
>
<
Extension
name
=
"CSV"
>
<
Parameters
>
<
Parameter
name
=
"NoHeader"
value
=
"true"
/>
<
Parameter
name
=
"NoStaticText"
value
=
"true"
/>
</
Parameters
>
</
Extension
>
</
Render
>
</
Extensions
>
</
Telerik.Reporting
>
<
connectionStrings
>
<
add
name
=
"XXX"
connectionString
=
"XXX security=True;MultipleActiveResultSets=True;App=EntityFramework;Asynchronous Processing=true"
providerName
=
"System.Data.SqlClient"
/>
</
connectionStrings
>
</
configuration
>
I'm wondering if:
- This implementation still works for .NET Core (I assume it does because the connection string does.)
- If you can see any issues with my above code.
- Where do these settings actually get pushed in to the report viewer template, I've searched through all the related code I can find and can't find any references to the export settings.
Thanks,
Josh
10 Answers, 1 is accepted
The usage of an app.config is a hack allowing the ConfigurationManager in the reporting engine to find the connection string. Yet custom Telerik.Reporting section cannot be read from the old config files.
We can suggest you to hide the default export options via CSS on the page, and to use custom UI to export. The UI can be loaded with export options you want per report. the viewer's API is exposed and the UI can be bound to it - commands and data attributes.
I hope this helps.
Regards,
Stef
Telerik by Progress

Hi Stef,
Does that mean that the configuration settings for using user functions under the guide: http://docs.telerik.com/reporting/standalone-report-designer-extending-configuration
do not work? Is there currently a workaround for .Net Core to allow user functions?
The custom Telerik.Reporting section cannot be read, and all settings like external assemblies, extensions settings will not be taken into consideration.
The workarounds:
- For export options:
Modify the viewer's HTML template or use CSS and Javascript to hide the default export options. Then use the HTML5 Viewers commands and data attributes via custom UI; - For external assemblies:
- If the report is configured to use an external assembly to access data, you can create a custom resolver for the Reporting REST service and change the Data items' DataSource properties at run-time. Consider the example of a custom resolver here.
- If the report uses custom functions, you can use a custom resolver to find the items and update their properties with already calculated values.
Or you can bind the report to a custom data object. Add properties to the data object which return the required values (previously set via user functions). A plus of using data models is the access to the raw type and its methods as well - Work with raw data type's methods and properties.
In order to provide you more accurate suggestions, please let us know more details about the usage of custom functions in the report
Regards,
Stef
Telerik by Progress

Hi Stef,
Generally in the past we have used custom report functions to do a few things, mainly changing the displayed values on the report (ie. a boolean to a string depending on the value) and formatting values (which is partly fixed by Teleriks formatting options, but we have some odd formats we need to use on reports which will require custom functionality.
Though, we will be updating all of our reports and therefore look to using more varied custom functions as the need arises.
Please check if the built-in functions help you to replace the custom code:
- Text functions, including the Format function;
- You can use the ToString method of each field, parameter and pass a formatting string;
- Conditional operators and functions;
- You can use a data model and add methods and properties getting the formatted/calculated value directly - Work with raw data type's methods and properties.
Regards,
Stef
Telerik by Progress

Hi Stef,
I have the same requirement as Joshua - I am using the HTML5 report viewer with the ASP.NET Core REST service and need a way to set CSV device info settings. Specifically, I need to set NoStaticText to true as I do not want text labels being output to the CSV data.
I have investigated the options you have suggested, but so far I have not found a solution to the problem.
Using the HTML5 viewers export command could be an option, but from what I can determine the only parameter this accepts is the format (ie 'CSV').
I can see on the documents API call that device info settings are passed back to the REST service, but I have not found any way to override this data.
Is there a way to pass custom CSV device info settings from the HTML5 viewer via the export command?
Or failing this is there any way to override these setting on the REST service aside from rendering the report manually?
I am ready utilizing a custom resolver, but I cannot see how to set the device info settings within this.
Thank you
Andrew

If it assists anyone else, I have found one way to set device info settings globally by overriding the CreateDocument action on the report controller as follows:
public override IActionResult CreateDocument(string clientID, string instanceID, [FromBody] CreateDocumentArgs args)
{
if (args.Format == "CSV")
{
args.DeviceInfo.Add("NoStaticText", true);
}
return base.CreateDocument(clientID, instanceID, args);
}

If it assists anyone else, I have found one way to set device info settings globally by overriding the CreateDocument action on the report controller as follows:
public override IActionResult CreateDocument(string clientID, string instanceID, [FromBody] CreateDocumentArgs args)
{
if (args.Format == "CSV")
{
args.DeviceInfo.Add("NoStaticText", true);
}
return base.CreateDocument(clientID, instanceID, args);
}

I have found one workaround to set CSV settings globally by adding the following code to the report controller:
public
override
IActionResult CreateDocument(
string
clientID,
string
instanceID, [FromBody] CreateDocumentArgs args)
{
if
(args.Format ==
"CSV"
)
{
args.DeviceInfo.Add(
"NoStaticText"
,
true
);
}
return
base
.CreateDocument(clientID, instanceID, args);
}
Thank you for sharing this approach with the rest of the community.
Regards,
Nasko
Progress Telerik