Cells type for entire column

Set cells type for column by programming

To specify a cells type for an entire column.

var header = worksheet.ColumnHeaders["A"];

// ColumnHeaders property returns an instance of column header
// it accepts a number of index or an address code as string to locate a column
header.DefaultCellBody = typeof(unvell.ReoGrid.CellTypes.CheckBoxCell);

// set horizontal alignment for all cells on this column to center
header.Style.HorizontalAlign = ReoGridHorAlign.Center;

// give check box a small padding (2 pixels)
header.Style.Padding = new System.Windows.Forms.Padding(2);

Only set the cells type will not cause any cells appear, cells body will be displayed if cells data is filled. 110

grid["A1:A5"] = new object[] { false, true, false, false, true };

Check box cell can accept a data as bool value, the grid shows as below: 111

Set column type in Editor

Select the entire column and right-click on header, select "Properties..." 127

Select "Progress", and press "OK" 128

On the "C" column, input some numbers, such as 30: 129

Press enter, the cell will be changed to progress type. 130

Was the content of the page helpful?