Clear document content

Hi Team,

How to clear document content?

I tried

doc.RemoveAllChildren();

It removes content and header footer section as well.

I just want a blank document with header footer intact.

Thanks and Regards,
Nakul

Hi Nakul,

Thanks for your inquiry. Please try run the following code to be able to remove all the child nodes of document Body inside each Section:

foreach(Section sec in doc.Sections)
{
    sec.Body.RemoveAllChildren();
    sec.Body.EnsureMinimum();
}

I hope, this helps.

Best regards,