Api.GetTables is not a function

Hello, I’m getting the following error when trying to call Api.GetTables

sdk-all.js:12625 TypeError: Api.GetTables is not a function
    at eval (eval at f (sdk-all.js:12625:270), <anonymous>:8:28)
    at eval (eval at f (sdk-all.js:12625:270), <anonymous>:10:11)
    at eval (eval at f (sdk-all.js:12625:270), <anonymous>:11:3)
    at f (sdk-all.js:12625:270)

Here’s the relevant code: (this is inside a plugin’s init() function`

  document
    .getElementById("buttonAddOptionalField")
    .addEventListener("click", function () {
      window.Asc.plugin.callCommand(
        function () {
          var oDocument = Api.GetDocument()
          var oParagraph = Api.CreateParagraph()
          var tables = Api.GetTables()
          console.log(tables)
        },
        false,
        true,
        (args) => {
          console.log(args)
        }
      )
    })

I found out that I was using Api.GetTables wrong and instead found the ApiDocument.GetAllTablesOnPage(pageNumber) function.
However, I’m now unable to find a way to get the amount of pages. Is there a way to do this? I can’t seem to be able to find one.

Hello @fr3fou

Sorry for the late reply.
Unfortunately, right now we do not have methods to get amount of pages via API. We have created enhancement suggestion number 60309 to add this method in future release.

Is there have a api or a sets of api to get range by specific page number

Hello @fengjue

Note that your question is not related to the main topic of this thread on the method that can be used to gather statistics in the document. Please create separate thread on your question to avoid mixing up topics in one thread.