Skip to main content
A newer version of this page is available. .

XRTable.DeleteColumn(XRTableCell, Boolean) Method

Deletes the column that contains the specified cell from the current table.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public void DeleteColumn(
    XRTableCell baseCell,
    bool autoShrinkTable
)

Parameters

Name Type Description
baseCell XRTableCell

An XRTableCell object representing a table cell belonging to the column to be deleted.

autoShrinkTable Boolean

true, to shrink the table by the width of the deleted column; otherwise, false.

Remarks

Rows of an XRTable can have a different number of cells. It is possible that a row may not have any cells for a particular column. Individual cells can differ from each other by their width, and may not be aligned. This method deletes a column only from those table rows that contain cells whose left side is aligned with that of the cell passed as the parameter.

If the autoShrinkTable parameter is set to true, the table will be automatically shrunk by the width of the deleted column. Otherwise, the cells located to the left of the deleted column will occupy the freed space.

Example

The following method deletes columns adjacent to the column containing the base cell. Access to the cells adjacent to the base cell is implemented via the XRTableCell.PreviousCell and XRTableCell.NextCell properties.

using DevExpress.XtraReports.UI;
// ...

public void DeleteAdjacentColumns(XRTable table, XRTableCell baseCell) {

   if(baseCell.PreviousCell != null)
      // Delete a column containing the cell that is previous to the base cell.
      table.DeleteColumn(baseCell.PreviousCell);

   if(baseCell.NextCell != null)
      // Delete a column containing the cell that is next to the base cell.
      table.DeleteColumn(baseCell.NextCell); 
}
See Also