豆芽菜菜菜豆芽 发表于 2020-7-9 17:01:12

HTML5Viewer 批量套打怎么实现

本帖最后由 豆芽菜菜菜豆芽 于 2020-7-9 17:16 编辑

关于套打,我知道怎么打印一个,预览的时候也只出现一个,但是我希望能够选择多条数据的时候,批量套打多条记录,也就是一条记录是一个页面。这个怎么实现啊下面是我的前端方法。

$(function () {
    var reportId = request('reportId');
    reportId = decodeURI(reportId);
    var viewer = GrapeCity.ActiveReports.Viewer(
      {
            element: '#viewerContainer',
            report: {
                id: 'Modules/ActiveReports/HCtotalbyCategory.rdlx?id='11111'',
            },
            reportService: {
                url: '/ActiveReports.ReportService.asmx'
            },
            uiType: 'desktop'
      });
});


后台是这样

protected override object OnCreateReportHandler(string id)
      {
            string[] report = reportPath.Split('|');
            if (report.Length > 1)
            {
                reportPath = report;
                id = report;
            }
            definition1 = (PageReport)base.OnCreateReportHandler(reportPath);
            _pageDocument = new PageDocument(definition1);

                definition1.Document.LocateDataSource += new LocateDataSourceEventHandler(DataSource1);

            return definition1;
      }
      private void DataSource1(object sender, LocateDataSourceEventArgs args)
      {

            if (args.DataSet.Query.DataSourceName == "DataSource1")
            {
                if (args.DataSet.Name == "DataSet1")
                {

                  args.Data = GetDataSource(id);
                }

            }

      }


private DataTable GetDataSource(int id)
      {
            string connStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", Server.MapPath("/NWind_CHS.mdb"));
            string productSql = string.Format("SELECT * From 入库单 where 入库单ID = '" + id + "' order by ID ");
            DataLayer dl = new DataLayer(connStr, productSql);
            return dl.DataSetData.Tables["Products"];
      }


这样只能获得一个,我想要打印多张怎么改,求教

KearneyKang 发表于 2020-7-9 17:01:13

使用页面报表,然后根据那个唯一值字段进行一个分组,然后你选择多少行数据就会自动展示多少页,打印的时候就可以进行批量打印

豆芽菜菜菜豆芽 发表于 2020-7-9 18:42:21

KearneyKang 发表于 2020-7-9 17:01
使用页面报表,然后根据那个唯一值字段进行一个分组,然后你选择多少行数据就会自动展示多少页,打印的时候 ...

谢谢,成功了

KearneyKang 发表于 2020-7-10 09:18:31

好的,问题解决了就好
页: [1]
查看完整版本: HTML5Viewer 批量套打怎么实现