长春闻荫 发表于 2022-1-19 12:49:31

AR15 rep.Document.LocateDataSource 赋值后无法进入断点 不执行

// 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");
      }

Bella.Yuan 发表于 2022-1-19 15:15:21

本帖最后由 Bella.Yuan 于 2022-1-19 15:20 编辑

您好,Document_LocateDataSource()这个函数触发,需要报表数据源设置为 DataSetProvider 才可以。

长春闻荫 发表于 2022-1-19 15:22:39

本帖最后由 长春闻荫 于 2022-1-19 15:24 编辑


设置的就是 DataSetProvider
而且这个 Document_LocateDataSource实现 本身就是不运行的而不是 GetData方法不运行

James.Lv 发表于 2022-1-19 23:10:51

这块使用咱们的demo确实是有这个问题,这块明天我再跟研发沟通确认一下

wengMQ 发表于 2022-1-20 14:48:40

直接用settings.LocateDataSource = args =>这个方法就可以; rep.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);这个不用

wengMQ 发表于 2022-1-20 14:49:21

你有什么新想法可以QQ546962925联系我

Bella.Yuan 发表于 2022-1-20 17:46:02

wengMQ 发表于 2022-1-20 14:49
你有什么新想法可以QQ546962925联系我

非常感谢老铁帮忙回复,奖励您金币1000:hjyzw:
页: [1]
查看完整版本: AR15 rep.Document.LocateDataSource 赋值后无法进入断点 不执行