Free Support Forum - aspose.com

Removing all back ground images in Word document

Hi,

We are using the aspose for adding the water mark in Word document. In our business process, at one state adding the water mark(backgroud image) and another state removing the water mark. Here issue is, if any Document contains the screen shot( Picture image), it is also removing. How can we remove only attached image , not other images(screen shot) .

Code using for the attaching the watermark(Image):

Shape shape = builder.insertImage("d:\\image.jpg");
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);
shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setHorizontalAlignment(HorizontalAlignment.CENTER);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
shape.setVerticalAlignment(VerticalAlignment.CENTER);

Code using for the removing the image:

NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true, false);
shapes.clear();

Please let me know, how to romove only attached image not other images in the word document.

Regards,

Dheeraj

Hi

Thanks for your inquiry. You can use shape name to identify Watermarks in Word documents. I think information provided in the following thread could be useful for you: <A href="https://forum.aspose.com/t/87687</FONT></A> <BR><BR>Hope this helps.<BR><BR>Best regards,</SPAN></P>

Hi,

I'm using the JDK1.4 aspose jar file(Aspose_jdk14_v202.jar) and setting the background text as an Image ( .jpg file). In this version jar , no Methods for setteing the Image Name and getting the name ( Shape.Name).

How can we identify the attached images and how to delete the corresponding Image in the word document.

Regards,

Dheeraj

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Please try using the latest version of Aspose.Words for Java (4.0.2) and shape.setName() method.

The latest version of Aspose.Words for Java you can download here:

http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/category1378.aspx

Best regards,