Skip to main content

SetColumnWidth

Sets the width of all the columns in the current range. One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Syntax​

expression.SetColumnWidth(nWidth);

expression - A variable that represents a ApiRange class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
nWidthRequirednumberThe width of the column divided by 7 pixels.

Returns​

This method doesn't return any data.

Example​

Set the width of columns in a range in a spreadsheet.

// How do I make a column wider or narrower in a spreadsheet?

// Resize every column covered by a range to a specific width in a spreadsheet.

let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetColumnWidth(20);