Hi,
I want to delete blank pages in a document but all these blank pages have footer information.
Can some one help me with this issue.
Thankyou...
Hi,
I want to delete blank pages in a document but all these blank pages have footer information.
Can some one help me with this issue.
Thankyou...
Hi,
Thanks for your reply. PFA the input and expected documents.
Here the requirement is to delete blank pages present in a section . And these blank pages are having footer text and watermark as well.
For instance the attatched input document has blank pages in section1, section 2, section 3 and all blank pages in all the three sections needed to be deleted.
Thank you.
Hi,
foreach (Section sec in doc.Sections)
{
NodeCollection bodyParas = sec.Body.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph para in bodyParas)
if (!para.HasChildNodes)
para.Remove();
}
doc.Save(@"C:\Temp\out.docx");
Hi,
Thanks for your reply.
I tried the code suggested by you but it is not working. It is not deleting empty paragraphs and so not deleting empty pages also.
It will be helpful if there is any other way to delete empty pages alone with out deleting empty paragraphs.
Kindly help me with this.
Hi,
SankarGanesh M:
I tried the code suggested by you but it is not working. It is not deleting empty paragraphs and so not deleting empty pages also.