Reputation: 2812
In Winform and C#, How can I show data in dataset in FastReport horizontally?
Example:
1 2 3 4 5 ...
Finally I want to show data in Matrix format with specific count of column.
Example:
+-----+-----+-----+-----+-----+
| 1 | 2 | 3 | 4 | 5 |
+-----+-----+-----+-----+-----+
| 6 | 7 | 8 | 9 | 10 |
+-----+-----+-----+-----+-----+
My effort:
Adding the FastReport.TextObject
controls manually.
in this case I can't find out when I pass the page.
Using the Table
control. But I have just one column in database and I can't handle this.
Upvotes: 0
Views: 3063
Reputation: 31
Using Table ManualBuild Event, you can show data horizontally,like this:
(I can't upload the .frx, so you can download the fast-report demo and view details)
private void Table1_ManualBuild(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase columnData = Report.GetDataSource("Employees");
// init the data source
columnData.Init();
// print the first table column - it is a header
Table1.PrintColumn(0);
// each PrintColumn call must be followed by either PrintRow or PrintRows call
// to print cells on the column
Table1.PrintRows();
// now enumerate the data source and print the table body
while (columnData.HasMoreRows)
{
// print the table body
Table1.PrintColumn(1);
Table1.PrintRows();
// go next data source row
columnData.Next();
}
// print the last table column - it is a footer
Table1.PrintColumn(2);
Table1.PrintRows();
}
Upvotes: 1
Reputation: 31
See FastReport Demo 【Table>Column DataSource】
Demo Download Link: https://【fast-report url】/en/download/fast-report-net/
private void Table1_ManualBuild(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase columnData = Report.GetDataSource("Employees");
// init the data source
columnData.Init();
// print the first table column - it is a header
Table1.PrintColumn(0);
// each PrintColumn call must be followed by either PrintRow or PrintRows call
// to print cells on the column
Table1.PrintRows();
// now enumerate the data source and print the table body
while (columnData.HasMoreRows)
{
// print the table body
Table1.PrintColumn(1);
Table1.PrintRows();
// go next data source row
columnData.Next();
}
// print the last table column - it is a footer
Table1.PrintColumn(2);
Table1.PrintRows();
}
Upvotes: 2