GetAllTablesOnPage

function GetAllTablesOnPage(nPage: any = null): ApiTable[]

Description

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

nPageanydefault: null

Page number. If it is not specified, an empty array will be returned.

Returns

ApiTable[]

Try It

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);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).