4,819
社区成员




private void printRebills(Guid printGuid)
{
ReportViewEmail_form r_f = new ReportViewEmail_form();//Email
ds = (new ReBillManager()).Get_dataset_(printGuid);
if (ds.Tables[0].Rows.Count == 0)
{
return;
}
r_f.rptv.Clear();
r_f.rptv.LocalReport.DataSources.Clear();
r_f.rptv.LocalReport.ReportEmbeddedResource = "SunNet.TEI_Form.Reports.Billing.rebill01.rdlc";
ReportDataSource rds = new ReportDataSource("DataSet1", ds.Tables[0]);
r_f.rptv.LocalReport.DataSources.Add(rds);
r_f.rptv.LocalReport.Refresh();
r_f.rptv.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
r_f.rptv.RefreshReport();
m_streams = new List<Stream>();
Warning[] warnings;
r_f.rptv.LocalReport.Render("Image", "<DeviceInfo><OutputFormat>EMF</OutputFormat><PageWidth>11in</PageWidth><PageHeight>8.5in</PageHeight><MarginTop>0in</MarginTop><MarginLeft>0in</MarginLeft><MarginRight>0in</MarginRight><MarginBottom>0in</MarginBottom></DeviceInfo>", CreateStream, out warnings);
m_currentPageIndex = 0;
if (m_streams == null || m_streams.Count == 0)
{
return;
}
PrintDocument printDoc = new PrintDocument();
if (!printDoc.PrinterSettings.IsValid)
{
MessageBox.Show("Can't find printer");
return;
}
printDoc.DefaultPageSettings.Landscape = true;
printDoc.PrinterSettings.Copies = 2;
printDoc.PrinterSettings.Collate = false;
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
(new ReBillManager()).DeleteALL(printGuid);
}
private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
switch (e.Parameters["type"].Values[0])
{
case "print0":
e.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[1]));
break;
case "print1":
e.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[2]));
break;
case "print2":
e.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[3]));
break;
}
}
1 显示标头 标尾《传给2参数a》
1 2 数据行 《接收1传的参数a》
1 2 3 数据行《接收2传的参数b》
这样的层级结构明白?