Is there any method to remove Blank page in word document using aspose.words.....
Thanks for your inquiry. There is no page concept in MS Word documents. Pages are created by MS Word on the fly and unfortunately there is no method you can use to remove a Blank page.
Could you please attach your Word document, you want to remove blank pages from, here for testing? I will try to find out some way to achieve this and provide you more information.
I have a similar query. I have attached a sample document. As you can notice we have 3rd page blank. similarly, we might have multiple blank pages in between of document. Is there any way to identify these blank pages and then remove it using aspose.words?
Thanks for your inquiry. I think, you can implement the following workflow to achieve this:
- Find a paragraph that contains a page break.
- Get page number of the that paragraph using LayoutCollector.GetEndPageIndex Method.
- Get next and previous siblings of this paragraph and check their page numbers they are contained in.
- If page index of siblings differ from the paragraph’s page index, it means the paragraph with page break is alone on that page.
- In this case, you can simply remove that paragraph
I hope, this helps.