Get Started
Documentation

ApiTablePr

new ApiTablePr()

Class representing table properties.

Methods

Name Description
GetClassType Get the type of this class.
SetCellSpacing Specify the default table cell spacing (the spacing between adjacent cells and the edges of the table).
SetJc Specify the alignment of the current table with respect to the text margins in the current section.
SetShd Specify the shading which is applied to the extents of the current table.
SetStyleColBandSize Specify the number of columns which will comprise each table column band for this table style.
SetStyleRowBandSize Specify the number of rows which will comprise each table row band for this table style.
SetTableBorderBottom Set the border which will be displayed at the bottom of the current table.
SetTableBorderInsideH Specify the border which will be displayed on all horizontal table cell borders which are not on an outmost edge of the parent table (all horizontal borders which are not the topmost or bottommost border).
SetTableBorderInsideV Specify the border which will be displayed on all vertical table cell borders which are not on an outmost edge of the parent table (all vertical borders which are not the leftmost or rightmost border).
SetTableBorderLeft Set the border which will be displayed on the left of the current table.
SetTableBorderRight Set the border which will be displayed on the right of the current table.
SetTableBorderTop Set the border which will be displayed at the top of the current table.
SetTableCellMarginBottom Specify the amount of space which will be left between the bottom extent of the cell contents and the border of all table cells within the parent table (or table row).
SetTableCellMarginLeft Specify the amount of space which will be present between the left extent of the cell contents and the left border of all table cells within the parent table (or table row).
SetTableCellMarginRight Specify the amount of space which will be present between the right extent of the cell contents and the right border of all table cells within the parent table (or table row).
SetTableCellMarginTop Specify the amount of space which will be present between the top extent of the cell contents and the top border of all table cells within the parent table (or table row).
SetTableInd Specify the indentation which will be added before the leading edge of the current table in the document (the left edge in a left-to-right table, and the right edge in a right-to-left table).
SetTableLayout Specify the algorithm which will be used to lay out the contents of this table within the document.
SetWidth Set the preferred width for this table.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oTablePr;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("The table is aligned at the center of the page horizontally:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTablePr = oTableStyle.GetTablePr();
oTablePr.SetJc("center");
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 50);
oTable.SetTableLook(true, true, true, true, false, false);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetJc.docx");
builder.CloseFile();

Resulting document