We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Method to remove Blank page in word document using aspose.words?

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.

Best Regards,

Hi Team,

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?

Hi Aditya,

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.

Best regards,