XRTable.InsertColumnToLeft(XRTableCell) Method

Inserts a column into the table to the left of the column that contains the cell passed as the parameter.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v21.1.dll


public XRTableCell[] InsertColumnToLeft(
    XRTableCell baseCell


Name Type Description
baseCell XRTableCell

An object of the XRTableCell class. If the baseCell parameter is null (Nothing in Visual Basic), the new column is added to the left from the first table column.


Type Description

An array of XRTableCell objects representing the inserted column.


Rows of an XRTable can have a varying 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 inserts a column only into those table rows that contain cells aligned by their left side with the cell passed as the parameter.

When a column is inserted into a table, the cells that have their left side aligned with the cell passed as the parameter will have their width decreased to accommodate the new column. Their width will be decreased by an amount equal to half the width of their narrowest cell, and this width will be occupied by the new column’s cells.


The following code demonstrates different ways of inserting cells and columns into an XRTable control. The original table contains one column. The second column is created by adding two individual cells using the XRTableRow.InsertCell method. The third and fourth columns are added by the XRTable.InsertColumnToRight and XRTable.InsertColumnToLeft methods, correspondingly.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public XRTable CreateTable() {
// Create an XRTable object containing two rows and one column.
    XRTable tab = XRTable.CreateTable(new Rectangle(200, 10, 200, 120), 2, 1);

    // Set the visible borders and their width for each table cell.
    tab.Borders = DevExpress.XtraPrinting.BorderSide.All;
    tab.BorderWidth = 2;

    // Create new cells.
    XRTableCell cell0 = new XRTableCell();
    XRTableCell cell1 = new XRTableCell();

    // Insert the new cells into the appropriate rows.
    tab.Rows.FirstRow.InsertCell(cell0, 0);
    tab.Rows.LastRow.InsertCell(cell1, 0);
    // The table has two columns now.

    // Insert a column to the right of the first row cell.
    // The table has three columns now.

    // Insert a column to the left of the second row cell.
    // The table has four columns now.

    return tab;
See Also