ApiTableCellPr

new ApiTableCellPr()

Class representing the table cell properties.

Methods

Name Description
GetClassType

Returns a type of the ApiTableCellPr class.

SetCellBorderBottom

Sets the border which will be displayed at the bottom of the current table cell.

SetCellBorderLeft

Sets the border which will be displayed to the left of the current table cell.

SetCellBorderRight

Sets the border which will be displayed to the right of the current table cell.

SetCellBorderTop

Sets the border which will be displayed at the top of the current table cell.

SetCellMarginBottom

Specifies an amount of space which will be left between the bottom extent of the cell contents and the border of a specific table cell within a table.

SetCellMarginLeft

Specifies an amount of space which will be left between the left extent of the cell contents and the border of a specific table cell within a table.

SetCellMarginRight

Specifies an amount of space which will be left between the right extent of the cell contents and the border of a specific table cell within a table.

SetCellMarginTop

Specifies an amount of space which will be left between the upper extent of the cell contents and the border of a specific table cell within a table.

SetNoWrap

Specifies how the current table cell is laid out when the parent table is displayed in a document. This setting only affects the behavior of the cell when the ApiTablePr#SetTableLayout table layout for this table is set to use the "autofit" algorithm.

SetShd

Specifies the shading applied to the contents of the table cell.

SetTextDirection

Specifies the direction of the text flow for this table cell.

SetVerticalAlign

Specifies the vertical alignment for the text contents within the current table cell.

SetWidth

Sets the preferred width to the current table cell.

ToJSON

Converts the ApiTableCellPr object into the JSON object.

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.SetWidth("percent", 100);
var oTableRow = oTable.GetRow(0);
oTableRow.SetHeight("atLeast", 1440);
var oTableCellPr = oTableStyle.GetTableCellPr();
oTableCellPr.SetVerticalAlign("bottom");
oTableCellPr.SetCellBorderRight("single", 32, 0, 51, 51, 51);
oTableCellPr.SetCellBorderTop("single", 32, 0, 51, 51, 51);
oTableCellPr.SetShd("clear", 255, 111, 61, false);
var oCell = oTable.GetRow(0).GetCell(0);
var oParagraph = oCell.GetContent().GetElement(0);
oParagraph.AddText("Align bottom");
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
var sClassType = oTableCellPr.GetClassType();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Class Type = " + sClassType);
builder.SaveFile("docx", "ApiTableCellPr.docx");
builder.CloseFile();

Resulting document