using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Drawing; using System.Data; using FastReport; using FastReport.Data; using FastReport.Dialog; using FastReport.Barcode; using FastReport.Table; using FastReport.Utils; namespace FastReport { public class ReportScript { private void Table1_ManualBuild(object sender, EventArgs e) { // get the master data source DataSourceBase masterData = Report.GetDataSource("Categories"); // get the detail data source DataSourceBase detailData = Report.GetDataSource("Products"); // init the master data source masterData.Init(); while (masterData.HasMoreRows) { // print first 3 rows that contains data from master data source Table1.PrintRow(0); Table1.PrintColumns(); Table1.PrintRow(1); Table1.PrintColumns(); Table1.PrintRow(2); Table1.PrintColumns(); // init the detail data source. Pass masterData to allow master-detail relation detailData.Init(masterData); // print detail header Table1.PrintRow(3); Table1.PrintColumns(); // print detail rows while (detailData.HasMoreRows) { // print the detail row Table1.PrintRow(4); Table1.PrintColumns(); // go next data source row detailData.Next(); } // print the detail footer row Table1.PrintRow(5); Table1.PrintColumns(); Table1.PrintRow(6); Table1.PrintColumns(); // go next data source row masterData.Next(); } } } }