// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
APP = app;
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseReporting(settings =>
{
settings.UseCompression = true;
settings.UseFileStore(new DirectoryInfo(Environment.CurrentDirectory + "\\Reports"));
//settings.LocateDataSource = args =>
//{
// DataTable dt = new DataTable();
// //string name = ReportName;
// if (args.DataSet.Query.DataSourceName == "DataSource1")
// {
// if (args.DataSet.Name == "DataSet1")
// {
// dt.Columns.Add("产品编号");
// dt.Columns.Add("产品名称");
// dt.Columns.Add("单价");
// dt.Columns.Add("库存量");
// dt.Columns.Add("产地");
// dt.Rows.Add("A001", "苹果", 10, 300, "中国");
// dt.Rows.Add("A002", "葡萄", 20, 200, "中国");
// dt.Rows.Add("A003", "香蕉", 30, 400, "中国");
// dt.Rows.Add("A004", "甘蔗", 10, 300, "中国");
// dt.Rows.Add("A005", "荔枝", 20, 200, "中国");
// dt.Rows.Add("A006", "芒果", 30, 400, "中国");
// }
// }
// return dt;
//};
settings.UseCustomStore(GetReport);
});
// web设计器
app.UseDesigner(config => config.UseFileStore(new DirectoryInfo(Environment.CurrentDirectory + "\\Reports"), false));
app.UseMvc();
}
public object GetReport(string P)//获取报表名称
{
PageReport rep = new PageReport();
rep.Load(new FileInfo(Environment.CurrentDirectory + "\\Reports\\"+ "TestJsonData.rdlx"));//报表路径
rep.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);
return rep.Report;
}
void Document_LocateDataSource(object sender, GrapeCity.ActiveReports.LocateDataSourceEventArgs args)
{
Console.WriteLine("sdfsdf");
}
|
|