Using User Data in Reports
Our sample projects and report templates can help you learn the basics of working with our products.When data has no ready-made source, a
Register the user data. Tell the report how many rows to expect:
How it works. The report pulls values only as it renders, so a virtual data source of any size can be fed row-by-row without materializing it up front.
StiUserData component supplies values on demand through an event — useful for reflection results, computed rows or live objects.Register the user data. Tell the report how many rows to expect:
stiReport1.RegData("HatchStyleEnum", Enum.GetNames(typeof(HatchStyle)));
assemblys = typeof(Graphics).GetMethods();
stiUserData1.Count = assemblys.Length;
stiReport1.RegData("UserData", stiUserData1);Serve each cell. The engine raises GetData for every column and row position:private void stiUserData1_GetData(object sender, StiUserGetDataEventArgs e)
{
if (e.ColumnName == "Name") e.Data = assemblys[e.Position].Name;
if (e.ColumnName == "ReturnType") e.Data = assemblys[e.Position].ReturnType.Name;
if (e.ColumnName == "IsStatic") e.Data = assemblys[e.Position].IsStatic;
}StiUserData.Count— the number of rows the engine will request.GetDataevent — called withe.ColumnNameande.Position; assigne.Datato return the cell value.
How it works. The report pulls values only as it renders, so a virtual data source of any size can be fed row-by-row without materializing it up front.