How to remove blank pages when compare document using aspose

how to remove blank pages when compare document using aspose

@sree79 Could you please attach the document you are comparing and the expected result? We will check and provide you more information.
You should also note that Word documents are not fixed page formats, they are flow, more like HTML, pages are generated on the fly during layout process. Blank pages in MS Word document can be caused explicitly, by inserting page break or section break or implicitly, by moving empty paragraph to the next page.

Hi alexey,

thanks for ur responce,
ATLAS.docx (246.0 KB)
in the above document have some blank pages, how can i remove that pages when compare this document using aspose

@sree79 Part of blank pages in your document is a result of column breaks. You can easily remove them using code like the following:

Document doc = new Document(@"C:\Temp\ATLAS.docx");
doc.Range.Replace(ControlChar.ColumnBreak, "");
doc.Save(@"C:\Temp\out.docx");

Also there is one blank page, which is filled with empty paragraphs, you can try removing sequential empty paragraphs to avoid this blank page. See the code below:

NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph para in paragraphs)
{
    if (!para.HasChildNodes)
    {
        Paragraph nextParagraph = para.NextSibling as Paragraph;
        if (nextParagraph != null && !nextParagraph.HasChildNodes)
            para.Remove();
    }
}