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 "Customers" datasource
DataSourceBase customers = Report.GetDataSource("Customers");
// init it
customers.Init();
// number of columns in the datasource
int colCount = customers.Columns.Count;
// print the table header which contains column titles. It's a row with index = 0.
Table1.PrintRow(0);
for (int i = 0; i < colCount; i++)
{
// fill the cell with column title
Cell1.Text = customers.Columns[i].Alias;
// print it
Table1.PrintColumn(0);
}
// now print a datasource content
while (customers.HasMoreRows)
{
// print the table body. It's a row with index = 1.
Table1.PrintRow(1);
for (int i = 0; i < colCount; i++)
{
// fill the cell with datasource column's data
Cell2.Text = customers[customers.Columns[i]].ToString();
// print it
Table1.PrintColumn(0);
}
// move to the next row
customers.Next();
}
}
}
}