文檔首頁>>Stimulsoft Reports.WinForms教程-2019>>【Stimulsoft Reports.WinForms教程】Detalization實(shí)時(shí)報(bào)表
【Stimulsoft Reports.WinForms教程】Detalization實(shí)時(shí)報(bào)表
【下載Stimulsoft Reports.Ultimate最新版本】
此示例項(xiàng)目顯示如何在單獨(dú)的預(yù)覽窗口中進(jìn)行報(bào)表分離。該報(bào)告可能包含外部報(bào)表中的詳細(xì)數(shù)據(jù)。例如,主要和詳細(xì)報(bào)表顯示在單獨(dú)的預(yù)覽窗口中。加載主報(bào)表,為click事件添加事件偵聽器,并在查看器中顯示此報(bào)表:
private void button2_Click(object sender, System.EventArgs e) { StiReport report = new StiReport(); report.RegData(dataSet1); report.Load("..\\LiveReports.mrt"); report.Compile(); report.CompiledReport.Click += new EventHandler(click); report.Show(); }
在click事件中,您可以使用主報(bào)表中的參數(shù)加載包含數(shù)據(jù)過濾的詳細(xì)報(bào)表:
private void click(object sender, EventArgs e) { StiComponent comp = sender as StiComponent; string customerID = (string)comp.BookmarkValue; if (customerID != null) { StiReport report = new StiReport(); report.RegData(dataSet1); report.Load("..\\Details.mrt"); StiDataBand dataBand = (StiDataBand)report.Pages["Page1"].Components["DataBand1"]; StiFilter filter = new StiFilter("{Orders.CustomerID==\"" + customerID + "\"}"); dataBand.Filters.Add(filter); report.Show(); } }
示例代碼的結(jié)果如下圖所示:
購買Stimulsoft正版授權(quán),請點(diǎn)擊“咨詢在線客服”喲!