In a current application under development at my work I am implementing a report I made in ActiveReports Report Designer. The report itself is expecting JSON and has a schema imbedded in it. I have gone through their documentation and it seems very vague and I also reached out to them on the public forums to no avail. Coworkers of mine have gotten it working albeit an older version but using MVC instead of .NET Blazor Web Assembly (Hosted). My current architecture is API Server and a Client in one solution deployed to one pool on IIS. I have tried many different ways to implement this after looking through their documentation and I don't think I have even gotten close. The current way I have been trying is:
@page "/print"
@inject ForgeStateContainer forgeStateContainer
@using ForgeRedCalculator.Client.Utility
@using System.Text.Json
@using GrapeCity
<div id="viewerContainer" style="height:800px;width:100%;">
<button @onclick=@printPDF>Print</button>
</div>
@code {
private ReportModel reportModel;
protected override void OnInitialized()
{
base.OnInitialized();
reportModel = forgeStateContainer.reportData;
}
public void printPDF()
{
string reportName = "ForgeReductionReport.rdlx";
GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new FileInfo("~/Reports/"+ reportName));
report.Report.DataElementName = JsonSerializer.Serialize<ReportModel>(reportModel);
GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
DirectoryInfo outputDirectory = new DirectoryInfo("/Reports/");
outputDirectory.Create();
GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = pdfSetting;
GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, "ForgeRedReport");
reportDocument.Render(pdfRenderingExtension, outputProvider, pdfSetting);
}
}
}
Any guidance on how you could implement this report to be viewed/printed would be greatly appreciated as I am new to reports in general.