We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Find and replace an image


May I ask how to find and replace an image…

I needed to replace the image with a text “Your Logo Here”.


Hi Joebet,

Thanks for your inquiry. Please use the following code to achieve this:

Document doc = new
Document(MyDir + @“CoverPage.docx”);

DrawingML dml = (DrawingML)doc.GetChildNodes(NodeType.DrawingML, true)[0];

dml.ImageData.SetImage(Image.FromFile(MyDir + "Aspose.Words.jpg"));

doc.Save(MyDir + @“out.docx”);

I hope, this helps.

Best regards,

Thanks you for the fast support dude!