Get Started
Documentation

SetHeight

SetHeight(sHRule, [nValue])

Set the height of the current table row within the current table.

Parameters:

Name Type Default Description
sHRule "auto" | "atLeast"

The rule to either apply or ignore the height value to the current table row. Use the "atLeast" value to enable the SetHeight method use.

nValue twips null

The height for the current table row measured in twentieths of a point (1/1440 of an inch). This value will be ignored if sHRule="auto".

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oCell, oTableRowPr;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 3x3 table and set the height of half an inch to all the rows:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetTableLook(true, true, true, true, false, false);
oTableRowPr = oTableStyle.GetTableRowPr();
oTableRowPr.SetHeight("atLeast", 720);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetHeight.docx");
builder.CloseFile();

Resulting document