Free Support Forum -

Removing watermarks

Aspose put functionality in Aspose.Word to remove watermarks ( DeleteHeaderFooterShapes ) , I have been testing this for single page docs and it was working fine, but just discovered if there are multiple pages, this only works on the first page, the watermark ( inserted using Format|Background|Printed Watermark - Text ) stays on the second and subsequent pages - I need it removed from all pages.
Antony Day

Each Section in a document can have its own header, footer, which could be different for first, even and odd pages.

Section.DeleteHeaderFooterShapes deletes all shapes from all headers and footers from one section.

In your case you probably have more than one section in the document and therefore need to loop through all of them:

foreach (Section section in Document.Sections)

Thanks Roman
foreach seems to object to this however since it claims that object has no enumerator - I will use the count and iterate that way.

Thanks, I’ve added the enumerator, it will go out in the next hotfix.