Hello,
I have an WebAssembly blazor project and I am trying to display a report in a Telerik ReportViewer. I am not even sure if what i'm trying to accomplish can be done. I would like some help / idea on how I can accomplish that.
Here how my project is setup. The client side, make a call to a controller, which does some logic (go to the database, get some data) then send that data into the report. The controller return a byte[] which contains the report (in PDF format for now)
Here an example of the code in the Server Side
[Route("api/[controller]")]
[ApiController]
public class ReportsController : Controller
{
[HttpPost("CreateReport")]
public ActionResult CreateReport(ReportCriteria criteria)
{
var datas = repo.GetData(criteria);
var myReport = new MyOwnReport(); // instance of type Telerik.Reporting.Report
myReport.objDataSource.DataSource = datas;
myReport.txtTitleValue = "My Report Title";
... // other manual operation on the report
ReportProcessor reportProcessor = new ReportProcessor();
InstanceReportSource instanceReportSource = new InstanceReportSource
{
ReportDocument = myReport
};
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
return Ok(result.DocumentBytes);
}
}
Is there any way that, on the client side, when I receive those bytes, I put those bytes directly on a Telerik Report Viewer ? Something like this, but using ur Telerik report? (where _report is the byte[])
<embed src="@_report" style="width: 100%; height: 100%;" />
Any idea how I can accomplish something like that? I feel like the Telerik reporting only work when all the logic is inside the "Telerik.Reporting.Report class" but its doesnt really work with the way our report are build.
Any help or tips or direction will be apreciated
Thank you
David