SetHAlign

SetHAlign(sType) → { boolean }

Sets the horizontal alignment to the table.

Parameters:

Name Type Description
sType String

Horizontal alignment type: may be "left" or "center" or "right".

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(3, 3);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
oTable.SetHAlign("center");
builder.SaveFile("docx", "SetHAlign.docx");
builder.CloseFile();

Resulting document