Get Started
Usage API
More information

SetColumnWidth

SetColumnWidth(nColumn, nWidth)

Set the width of the specified columns. 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.

Parameters:

Name Type Description
nColumn number

The number of the column to set the width to.

nWidth number

The width of the column divided by 7 pixels.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oWorksheet.SetColumnWidth(0, 10);
oWorksheet.SetColumnWidth(1, 20);
builder.SaveFile("xlsx", "SetColumnWidth.xlsx");
builder.CloseFile();

Resulting document