Free Support Forum - aspose.com

Remove All Images from a Word Document

Hi

We want to removal all images from a word document, how can this be achieved

Thanks

@david.hancock.imagef,

Please try using the following code:

Document doc = new Document(MyDir + @"input.docx");
doc.GetChildNodes(NodeType.Shape, true).Clear();
doc.Save(MyDir + @"18.3.docx");

Thanks

How do I also

Remove All Headers
Remove All Footers

Thanks

@david.hancock.imagef,

You can remove headers/footers from Word document by using the following code:

foreach (Section sec in doc.Sections)
    sec.ClearHeadersFooters();