DevExpress:How to programmatically remove a column from XtraReport?
I have a Web application with XtraReport report. The report has several columns. Depending on a certain condition, in certain situations I do not need one of the column开发者_Python百科s to exist. What is a best way to programmatically remove it? I need not to ‘make the column invisible’, but remove it. The space that the column occupied before the removal should be distributed evenly between the other columns.
A proper solution is to temporary remove the unnecessary XRTableCell from the XRTableRow.Cells collection...
Review the http://www.devexpress.com/issue=Q216567 discussion in the DevExpress support center. Hope this helps.
The easiest way to achieve this is to remove the cell from the row (for example on the report BeforePrint event). You should also wrap it in the suspend-resume layout code for the table itself:
private void TableReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrTable1.SuspendLayout();
xrTableRow1.Cells.Remove(xrTableCell1);
xrTable1.PerformLayout();
}
you can use dispose the cell If CEHide.Checked = True Then XrTableCell2.Dispose()
精彩评论