The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

Column.WidthInCharacters Property

Gets or sets the column width in characters of the default font specified by the built-in Normal style.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.2.Core.dll

Declaration

double WidthInCharacters { get; set; }
Property WidthInCharacters As Double
double WidthInCharacters { get; set; }
Property WidthInCharacters As Double
double WidthInCharacters { get; set; }
Property WidthInCharacters As Double

Property Value

Type Description
Double

A Double value that is the number of characters that can be accommodated into the column width when the column is formatted with the built-in Normal style.

Property Value

Type Description
Double

A Double value that is the number of characters that can be accommodated into the column width when the column is formatted with the built-in Normal style.

Property Value

Type Description
Double

A Double value that is the number of characters that can be accommodated into the column width when the column is formatted with the built-in Normal style.

Remarks

To automatically fit the column width to the content, call the Column.AutoFit method.

Examples

This example demonstrates how to control the column width on a worksheet.

// Set the "B" column width to 30 characters of the default font that is specified by the Normal style.
worksheet.Columns["B"].WidthInCharacters = 30;

// Set the "C" column width to 15 millimeters.
workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter;
worksheet.Columns["C"].Width = 15;

// Set the width of the column that contains the "E15" cell to 100 points.
workbook.Unit = DevExpress.Office.DocumentUnit.Point;
worksheet.Cells["E15"].ColumnWidth = 100;

// Set the width of all columns that contain the "F4:H7" cell range (the "F", "G" and "H" columns) to 70 points.
worksheet.Range["F4:H7"].ColumnWidth = 70;

// Set the "J" column width to the "B" column width value.
worksheet.Columns["J"].Width = worksheet.Columns["B"].Width;

// Copy the "C" column width value and assign it to the "K" column width.
worksheet.Columns["K"].CopyFrom(worksheet.Columns["C"], PasteSpecial.ColumnWidths);

// Set the default column width to 40 pixels.
worksheet.DefaultColumnWidthInPixels = 40;
See Also