Get Started
Documentation

SetColumnWidth

SetColumnWidth(column, width)

Set the width to the selected column of the current active sheet. The width is equal to the set number multiplied by 7 pixels - so if you set the width to 10 it will be equal to 70 pixels.

Parameters:

Name Type Description
column number

The number of the column to set the width to.

width number

The width of the column divided by 7 pixels.

Example

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

Resulting document