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.

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++)
// Save output document"C:\\Temp\\out.doc");

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