文檔首頁(yè)>>Stimulsoft Reports.WinForms教程-2019>>【Stimulsoft Reports.WinForms教程】將渲染報(bào)表導(dǎo)出到PDF文件
【Stimulsoft Reports.WinForms教程】將渲染報(bào)表導(dǎo)出到PDF文件
【下載Stimulsoft Reports.Ultimate最新版本】
此示例項(xiàng)目演示了如何將一些不同的報(bào)表呈現(xiàn)和導(dǎo)出到一個(gè)PDF文件。例如,使用三個(gè)不同的報(bào)表——SimpleList.mrt,SimpleGroup.mrt和Master-Detail.mrt。創(chuàng)建新的報(bào)表對(duì)象并分配SimpleList.mrt,SimpleGroup.mrt和Master-Detail.mrt報(bào)表:
private void button7_Click(object sender, System.EventArgs e) { StiReport report1 = GetReport("SimpleList.mrt"); StiReport report2 = GetReport("SimpleGroup.mrt"); StiReport report3 = GetReport("Master-Detail.mrt"); ...
然后,創(chuàng)建一個(gè)新的摘要報(bào)表:
... StiReport report = new StiReport(); report.Render(false); report.RenderedPages.Clear(); ...
將SimpleList.mrt,SimpleGroup.mrt和Master-Detail.mrt中呈現(xiàn)的頁(yè)面添加到此報(bào)表中:
... foreach (StiPage page in report1.RenderedPages) { report.RenderedPages.Add(page); } foreach (StiPage page in report2.RenderedPages) { report.RenderedPages.Add(page); } foreach (StiPage page in report3.RenderedPages) { report.RenderedPages.Add(page); } ...
最后,導(dǎo)出報(bào)表并將結(jié)果保存到文件中:
... report.ExportDocument(StiExportFormat.Pdf, "d:\\file.pdf"); }
示例代碼的結(jié)果如下圖所示: