Deleting First and/or last page of a document template before merging data into it

Hi,
I am using Aspose.Words v 4.1.1. I need to be able to conditionally delete the first and/or the last page of my document when I merge the data into it. Can I do this with 4.1.1? If so, can someone point me to an example? If not with 4.1.1, can it be done with a newer version?
Thanks,
Brad

Hi

Thanks for your inquiry. MS Word documents are flow documents and do not contain any information about its layout into lines and pages. Currently, there is no public API, which allows you to determine where page starts or ends. So there is no way to remove the particular page from the document.
Maybe, in your case, you can use sections.
https://docs.aspose.com/words/net/working-with-sections/
If the first and the late pages in your document are separate sections, then you can just remove these sections.
Best regards.