Getting information from a text watermark

Hi. I would like to know if it is possible to retrieve text contained in a watermark. I have a word document with a text watermark and I need to manipulate it before printing the document. Is it possible with Aspose.Words for Java?

Thanks in advance!

Hi
Thanks for your inquiry. Watermark in MS Word is a simple shape inserted into the header. However, you can indentify this shape in order to get/set its properties. You can use Shape.Name to achieve this because when you insert a watermark in MS Word, it sets name of shape like this – “PowerPlusWaterMarkObject357476642”. So if the name of shape contains “WaterMark” substring, you can suppose that this shape is a watermark.
So you can use code like the following to get a watermark shape:

// Open document.
Document doc = new Document("C:\\Temp\\watermark.docx");
// Get all shapes formthe document.
NodeCollection <Shape> shapes = doc.getChildNodes(NodeType.SHAPE, true);
// Look for watermark shape.
for (Shape shape: shapes)
{
    if (shape.getName().contains("WaterMark"))
    {
        // Here you can access watermark shape properties.
        // ..............................................
        // For exampel printe text of the watermark.
        System.out.println(shape.getTextPath().getText());
    }
}

Hope this helps.
Best regards.