AutoFit

function AutoFit(bRows: bool = null, bCols: bool = null): void

Description

Changes the width of the columns or the height of the rows in the range to achieve the best fit.

Parameters

bRowsbooldefault: null

Specifies if the width of the columns will be autofit.

bColsbooldefault: null

Specifies if the height of the rows will be autofit.

Returns

void

Try It

var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("A1");
oRange.SetValue("This is an example of the column width autofit.");
oRange.AutoFit(false, true);

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).