SetAlignHorizontal

function SetAlignHorizontal(sAlignment: left | right | center | justify = null): boolean

Description

Sets the horizontal alignment of the text in the current cell range.

Parameters

sAlignmentleft | right | center | justifydefault: null

The horizontal alignment that will be applied to the cell contents.

Returns

boolean

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A2").SetValue("2");
var oRange = oWorksheet.GetRange("A1:D5");
oRange.SetAlignHorizontal("center");

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