Posted by a ceTe Software moderator
Hello,
It is not possible to create reports directly from the object's data however you can create reports using a DataTable without using any data base. You will have to create a DataTable using the data from the objects you have. You will have to create a dplx file and map the record boxes to the column names created in the DataTable. You can use this datatable in the OpeningRecordSet event of the Query object. Following is some sample code for this.
//Declare the table globally to use in the event
DataTable table = new DataTable();
//Create the table using the data from your objects
table.Columns.Add("FirstName");
table.Columns.Add("LastName");
for(int i=0; i<10; i++)
{
DataRow row = table.NewRow();
row["FirstName"] = someObject.FirstName;
row["LastName"] = someObject.LastName;
table.Rows.Add(row);
}
//Create report
DocumentLayout report = new DocumentLayout(@"C:\Temp\DataTable.dplx");
Query query = (Query)report.GetElementById("Query");
query.OpeningRecordSet +=new OpeningRecordSetEventHandler(query_OpeningRecordSet);
Document doc = report.Run();
doc.DrawToWeb();
This is the code for the OpeningRecordSet event.
private void query_OpeningRecordSet(object sender, OpeningRecordSetEventArgs e)
{
e.RecordSet = new DataTableRecordSet(table);
}
You can also use the Generator product to generate reports using the data from the objects where you will have more control on all the elements you are going to add to the PDF document.
Thanks,
ceTe Software Support Team.