Get Started
Usage API
More information

SetVAlign

SetVAlign(sType) → { bool }

Set vertical alignment for a table.

Parameters:

Name Type Description
sType String

Vertical alignment type: may be "top" or "center" or "bottom".

Returns:

Type
bool

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("The table was added to the bottom of the page. Scroll down to see it."); 
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
oTable.SetWrappingStyle(false);
oTable.SetTableBorderTop("single", 4, 0, 0, 0, 255);
oTable.SetTableBorderBottom("single", 4, 0, 0, 0, 255);
oTable.SetTableBorderLeft("single", 32, 0, 0, 0, 255);
oTable.SetTableBorderRight("single", 4, 0, 0, 0, 255);
oTable.SetTableBorderInsideV("single", 4, 0, 255, 0, 0);
oTable.SetTableBorderInsideH("single", 4, 0, 255, 0, 0);
oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
oTable.SetVAlign("bottom");
builder.SaveFile("docx", "SetVAlign.docx");
builder.CloseFile();

Resulting document