using DevExpress.Blazor.Reporting; using DevExpress.DataAccess; using DevExpress.DataAccess.Json; using DevExpress.Drawing.Internal.Fonts.Interop; using DevExpress.Security; using DevExpress.XtraPrinting.Native.Properties; using DevExpress.XtraReports; using DevExpress.XtraReports.Services; using DevExpress.XtraReports.UI; using DevExpress.XtraReports.Web.ReportDesigner.Native; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.WebUtilities; using System; using System.Web; using TestDevExpress.Components.Reports; public class TestMyReportProvider : IReportProvider { public XtraReport GetReport(string id, ReportProviderContext context) { // Parse the string with the report name and parameter values. string[] parts = id.Split('?'); string reportName = parts[0]; string parametersQueryString = parts.Length > 1 ? parts[2] : String.Empty; var par = parametersQueryString.Split('&'); List valueParList = new(); for (int i = 0; i < par.Length; i++) { valueParList.Add(par[i].Split('=')[1]); } //var parameters = HttpUtility.ParseQueryString(parametersQueryString); string urlImg = valueParList[1]; string url = parts[1].Split('=')[1] + "/" + valueParList[0]; // Create a report instance. XtraReport report = null; if (reportName == "TestReport1") report = new XtraReport1(); else { throw new DevExpress.XtraReports.Web.ClientControls.FaultException( string.Format("Could not find report '{0}'.", reportName) ); } string reportFolder = "Reports"; if (Directory.EnumerateFiles(reportFolder). Select(Path.GetFileNameWithoutExtension).Contains(reportName)) { byte[] reportBytes = File.ReadAllBytes(Path.Combine(reportFolder, reportName + ".repx")); using (MemoryStream ms = new MemoryStream(reportBytes)) report = XtraReport.FromXmlStream(ms); } //report.Parameters["pOfferId"].Value = valueParList[0]; //report.Parameters["pImgPath"].Value = valueParList[1]; //var jsonDataSource = report.DataSource as JsonDataSource; //if (jsonDataSource != null) //{ // jsonDataSource.JsonSource = new UriJsonSource(new Uri(url)); // jsonDataSource.ConnectionName = null; // //RequestParameters = false; //} return report; } }