本帖最后由 豆芽菜菜菜豆芽 于 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[0];
id = report[1];
}
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"];
}
这样只能获得一个,我想要打印多张怎么改,求教
|