Remove Header-Footer & Watermark

I have a Word document which already was edited by Aspose.jar to contain a Header & Footer and a watermark.

How can i use Aspose.jar to remove these to get back the clean and original copy of document?

Please provide the code piece if possible.

Hi
Thanks for your inquiry. You can use the following code to remove all headers/footers from the document.

// Open the document
Document doc = new Document("C:\\Temp\\in.doc");
// Loop through all sections and remove headers.footers
for (int i = 0; i < doc.getSections().getCount(); i++)
{
    doc.getSections().get(i).getHeadersFooters().clear();
}
// Save output document
doc.save("C:\\Temp\\out.doc");

If this does not help you please attach your document for testing.
Best regards.