Hi Oleksandr Kovalenko,
We
cannot delete a page only based on selecting the page number. Since Word
documents are flow-type documents in which the positions of each elements are
not fixed rather if any other elements are inserted or removed it changes its
position relatively according to it.
To achieve this we can use an alternative approach. We can use the goToPage API in Selection module
to move the
selection to the start of the specified page number. We can then obtain the
hierarchical index position based on the cursor point and navigate to the end
of the page by moving to the next page and obtaining the position of its previous element. This
allows us to delete the contents between the start and end points.
Disclaimer : There
may be a chance of data loss when using the above logic. Since it is a
selection-based approach, any element inside the selection could be affected.
As it’s a flow document, if any elements like tables are split between pages,
there is a possibility of data loss. So Use this logic at your own risk.
Regards,
Suresh I