We are trying to delete consecutive page breaks with in document so that blank pages can be removed. But they are not deleted. Please suggest on whether we are going in right way. Attached is sample document and code
static void Main(string[] args)
{
string FileIn = @"C:\Users\raja_c\Downloads\blankpage.docx";
string FileOut = @"C:\Users\raja_c\Downloads\blankpage_cp.docx";
License license = new License();
license.SetLicense("Aspose.Total.lic");
Document doc = new Document(FileIn);
foreach (Section sct in doc.Sections)
{
NodeCollection nc = sct.Body.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph p in nc)
{
if (p.GetText().EndsWith("\f\f"))
{
p.Remove();
}
}
}
doc.Save(FileOut);
}
blankpage.zip (9.5 KB)