Get Started
Documentation

SetAlignHorizontal

SetAlignHorizontal(value)

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

Parameters:

Name Type Description
value 'left' | 'right' | 'center' | 'justify'

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

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange('A2').SetValue('2');
var sRange = oWorksheet.GetRange("A1:D5");
sRange.SetAlignHorizontal("center");
builder.SaveFile("xlsx", "SetAlignHorizontal.xlsx");
builder.CloseFile();

Resulting document