This is a migrated thread and some comments may be shown as answers.

Report in .NET Core not inheriting export device information settings

10 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 08 Nov 2016, 01:04 AM

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:

  1. This implementation still works for .NET Core (I assume it does because the connection string does.)
  2. If you can see any issues with my above code.
  3. 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

Sort by
0
Stef
Telerik team
answered on 09 Nov 2016, 05:07 PM
Hello Josh,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Joshua
Top achievements
Rank 1
answered on 24 Nov 2016, 05:24 AM

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?

 

0
Stef
Telerik team
answered on 24 Nov 2016, 05:20 PM
Hi Joshua,

The custom Telerik.Reporting section cannot be read, and all settings like external assemblies, extensions settings will not be taken into consideration.

The workarounds:
  1. 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;
  2. For external assemblies:
    1. 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.
    2. 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Joshua
Top achievements
Rank 1
answered on 24 Nov 2016, 11:35 PM

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.

0
Stef
Telerik team
answered on 25 Nov 2016, 12:54 PM
Hi Joshua,

Please check if the built-in functions help you to replace the custom code:
Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andrew
Top achievements
Rank 1
answered on 11 Jun 2018, 12:15 AM

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

 

 

 

 

 

 

 

 

0
Andrew
Top achievements
Rank 1
answered on 11 Jun 2018, 01:03 AM

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);
        }

0
Andrew
Top achievements
Rank 1
answered on 11 Jun 2018, 01:03 AM

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);
        }

0
Accepted
Andrew
Top achievements
Rank 1
answered on 11 Jun 2018, 01:04 AM

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);
}

 

0
Nasko
Telerik team
answered on 13 Jun 2018, 12:02 PM
Hi Andrew,

Thank you for sharing this approach with the rest of the community.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Joshua
Top achievements
Rank 1
Answers by
Stef
Telerik team
Joshua
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or