CustomResolver with RenderReport

1 Answer 148 Views
General Discussions
Mateusz
Top achievements
Rank 1
Mateusz asked on 26 Jun 2023, 12:12 PM

This is my scenerio.
i have report in xml stored in database, report has subreports as uri            
<UriReportSource Uri="sub_report1.trdx">

i have rest api service that consume xml , render it as pdf and returns it as byte[].
And everything works fine but my custom resolver dosnt fire.

It seems to be that when I DO NOT use telerik_ReportViewer,  resolve event doesnt invoke, am i right? My rest api service does not even inherits from Telerik ReportsControllerBase

 

my desire is when i call renderReport customResolver is invoked, i download xml for subreport (based on uri trdx) and i put them together with main report and return "As complete"

Can i configure it to achieve what i want ?

my server side code

//xDoc represents report in xml

using var tr = new StringReader(xDoc.Root.ToString());
var xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
var report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(tr);

ReportProcessor reportProcessor = new ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = report;

RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);

return result.DocumentBytes;

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 28 Jun 2023, 01:35 PM

Hi Mateusz,

The custom resolver's  Resolve method cannot be called from the reporting service because it uses it only internally, there is no endpoint that you may access to get its return value.

Instead, you may initialize your custom resolver in the code where you use the ReportProcessor to call the Resolve method there, or you may take the code that you have in your custom resolver and execute it there. Both are the same thing really.

Alternatively, you may export the report purely from the service without a report viewer as shown in the Rendering Reports through the Reporting REST Service without Report Viewer - Telerik Reporting article.

Please let me know if you have any additional questions.

Regards,
Dimitar
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/.
Tags
General Discussions
Asked by
Mateusz
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or