Show only PDF in download list of angular report viewer

1 Answer 124 Views
.NET Core Report Viewer - Angular
son
Top achievements
Rank 1
Iron
son asked on 22 Aug 2023, 03:10 AM

Hi every one,

I have to, only show PDF in download list in angular report viewer, I found this list returned from this api

https://docs.telerik.com/reporting/embedding-reports/host-the-report-engine-remotely/rest-api-reference/general-api/get-available-document-formats

I also found answer in

https://www.telerik.com/forums/180100-export-only-in-pdf-format-possible

and to setup Telerik configurations

https://docs.telerik.com/reporting/doc-output/configure-the-report-engine/overview

My question is, I follow above link to setting up Telerik configuration in appsetting.json but still unable to show only PDF as my purpose, does any one have any example of json file or I missed something else.

Thanks and appreciate.

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 24 Aug 2023, 02:19 PM

Hello Son,

A sample snippet is provided in the Hide Export Formats in the Report Viewer Dropdown Knowledge Base article as well.

In any case, here is an example of what the appsettings.json file can look like.

{
  "telerikReporting": {
    "extensions": [
      {
        "name": "PDF",
        "visible": "true"
      },
      {
        "name": "XLS",
        "visible": "false"
      },
      {
        "name": "CSV",
        "visible": "false"
      },
      {
        "name": "RTF",
        "visible": "false"
      },
      {
        "name": "XPS",
        "visible": "false"
      },
      {
        "name": "DOCX",
        "visible": "false"
      },
      {
        "name": "XLSX",
        "visible": "false"
      },
      {
        "name": "PPTX",
        "visible": "false"
      },
      {
        "name": "MHTML",
        "visible": "false"
      },
      {
        "name": "IMAGE",
        "visible": "false"
      }
    ]
  }
}

Also, it is worth checking whether your Reporting REST Service is using a different configuration file for the reporting engine configuration.

builder.Services.TryAddSingleton<IReportServiceConfiguration>(sp =>
    new ReportServiceConfiguration
    {
        // The default ReportingEngineConfiguration will be initialized from appsettings.json or appsettings.{EnvironmentName}.json:
        // ReportingEngineConfiguration = sp.GetService<IConfiguration>(),

        // In case the ReportingEngineConfiguration needs to be loaded from a specific configuration file, use the approach below:
        ReportingEngineConfiguration = ResolveSpecificReportingConfiguration(sp.GetService<IWebHostEnvironment>()),
        ...
    });
	
...

static IConfiguration ResolveSpecificReportingConfiguration(IWebHostEnvironment environment)
{
    // If a specific configuration needs to be passed to the reporting engine, add it through a new IConfiguration instance.
    var reportingConfigFileName = Path.Combine(environment.ContentRootPath, "reportingAppSettings.json");
    return new ConfigurationBuilder()
        .AddJsonFile(reportingConfigFileName, true)
        .Build();
}

Last but not least, I would like to mention that since version R2 2021, you can apply these settings per report. See the Set Report-Specific Run Time Configuration article for more information.

I hope this helps.

Best Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
son
Top achievements
Rank 1
Iron
commented on 31 Aug 2023, 10:33 AM

Thank you so much, it worked. Thanks :D
Tags
.NET Core Report Viewer - Angular
Asked by
son
Top achievements
Rank 1
Iron
Answers by
Momchil
Telerik team
Share this question
or