GetAllTablesOnPage

GetAllTablesOnPage() → { Array.<ApiTable> }

Returns a collection of tables on a given absolute page. This method can be a little bit slow, because it runs the document calculation process to arrange tables on the specified page.

Parameters:

This method doesn't have any parameters.

Returns:

Type
Array.<ApiTable>

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable1 = Api.CreateTable(3, 3);
oTable1.SetWidth("percent", 100);
oTable1.SetStyle(oTableStyle);
oBlockLvlSdt.AddElement(oTable1, 0);
var oTable2 = Api.CreateTable(2, 2);
oTable2.SetWidth("percent", 100);
oTable2.SetStyle(oTableStyle);
oBlockLvlSdt.AddElement(oTable2, 1);
oDocument.AddElement(0, oBlockLvlSdt);
var aTables = oBlockLvlSdt.GetAllTablesOnPage(0);
var oCell = aTables[0].GetRow(1).GetCell(0);
aTables[0].RemoveRow(oCell);
builder.SaveFile("docx", "GetAllTablesOnPage.docx");
builder.CloseFile();

Resulting document