我根据生成报告的参数将一个名为“CustomerId”的参数传递给水晶报告('.rpt')文件。当我将此报告('.rpt')加载到水晶报告查看器时,它工作正常......
但我有不同的“CustomerId”。我需要根据参数生成报告并将它们加载到单个报告查看器中。即,我不想逐页查看它们,而是希望将它们全部查看到单个报表查看器中。
谁能告诉我如何解决这个问题......
我根据生成报告的参数将一个名为“CustomerId”的参数传递给水晶报告('.rpt')文件。当我将此报告('.rpt')加载到水晶报告查看器时,它工作正常......
但我有不同的“CustomerId”。我需要根据参数生成报告并将它们加载到单个报告查看器中。即,我不想逐页查看它们,而是希望将它们全部查看到单个报表查看器中。
谁能告诉我如何解决这个问题......
您需要将 CustomerID 参数设置为接受多个值。还按客户创建一个组,并为组中的最后一个部分设置开始新页面
为每个报告创建一个报告查看器。然后报表查看器在选项卡控件上添加选项卡页。
private void FormCrystalRepotViewer_Shown(object sender, EventArgs e)
{
ReportDocument crReport = crArrReport[0];
crystalReportViewer.ReportSource = crReport;
crystalReportViewer.Zoom(100);
crystalReportViewer.PrintMode = CrystalDecisions.Windows.Forms.PrintMode.PrintToPrinter;
tcTabControl.TabPages[0].Text = arrRaporlar.Get(0).sReportName;
for (int i = 1; i < crArrReport.Count; i++)
{
crReport = crArrReport[i];
CrystalDecisions.Windows.Forms.CrystalReportViewer crview = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
crview.ReportSource = crReport;
crview.Zoom(100);
crview.PrintMode = crystalReportViewer.PrintMode;
crview.ActiveViewIndex = -1;
crview.BorderStyle = crystalReportViewer.BorderStyle;
crview.Cursor = crystalReportViewer.Cursor;
crview.Dock = crystalReportViewer.Dock;
crview.Location = crystalReportViewer.Location;
crview.Size = crystalReportViewer.Size;
crview.TabIndex = 0;
crview.ToolPanelView = crystalReportViewer.ToolPanelView;
crview.ShowParameterPanelButton = crystalReportViewer.ShowParameterPanelButton;
crview.ShowLogo = crystalReportViewer.ShowLogo;
crview.ReportRefresh += new CrystalDecisions.Windows.Forms.RefreshEventHandler(this.crystalReportViewer_ReportRefresh);
TabPage page = new TabPage(arrRaporlar.Get(i).sReportName);
tcTabControl.TabPages.Add(page);
page.Controls.Add(crview);
page.AutoScroll = true;
}
}
private void crystalReportViewer_ReportRefresh(object source, CrystalDecisions.Windows.Forms.ViewerEventArgs e)
{
e.Handled = true;
ParametreleriKontrolEt();
crystalReportViewer.ReportSource = crArrReport[0];
for (int i = 1; i < crArrReport.Count; i++)
{
CrystalDecisions.Windows.Forms.CrystalReportViewer crview = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
crview = tcTabControl.TabPages[i].Controls[0] as CrystalDecisions.Windows.Forms.CrystalReportViewer;
crview.ReportSource = crArrReport[i];
}
}