This example demonstrates the differences in runtime table creation between the newest XtraReports version and its prior versions.
Please note that it is always required to call the XRTable.BeginInit and XRTable.EndInit methods if you modify XRTable.Rows and XRTableRow.Cells collections at runtime.
As for the height of a table, explicitly specify it only if cells' content is not expected to stretch the cells (e.g. this may happen when their CanGrow property is enabled).
Question Comments
Added By: DXScorpion at: 10/14/2013 3:12:53 AM
Your sample is too simple.
In case datasource has many columns and total width of columns greater than (Report.PageWidth - Report.Margins.Left - Report.Margins.Right) How can we show all of it on report?
The example works fine. However,
(1) It's better to use gridColumn's width, caption and fieldName
(2) When dataset has more than 1 table, the cells show empty. Below line fixes it:
cell2.DataBindings.Add("Text", null, tableName + "." + columns[i].FieldName);
(3) Could you please show example of sumary row/column as well?
E.g., lastcol = col5 + col6 + col7,
lastRow(col5) = sum(col5), etc.