SetColumnWidth

function SetColumnWidth(
  nColumn: number = null,
  nWidth: number = null,
  bWithotPaddings: boolean = false,
): void

Description

Sets the width of the specified column. 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

nColumnnumberdefault: null

The number of the column to set the width to.

nWidthnumberdefault: null

The width of the column divided by 7 pixels.

bWithotPaddingsbooleandefault: false

Specifies whether nWidth will be set without standard paddings.

Returns

void

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.SetColumnWidth(0, 10);
oWorksheet.SetColumnWidth(1, 20);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).