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

Free Support Forum - aspose.com

Find image by id

Hi,

I’m using Aspose Words for Java 17.8.
Is it possible to find images by id?
I have only found a method to get the name of an image.

NodeCollection<Shape> shapes = (NodeCollection<Shape>) doc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : shapes){
  if (shape.getShapeType() == ShapeType.IMAGE) {
      String name = shape.getName();
   }
}

In the following example OOXML I would get the name “Bild 3”. But I want to get the ID “2”.

<w:p>
   <w:r>
      <w:drawing>
         ...
         <wp:docPr id="2" name="Bild 3" />
         ...
      <w:drawing>
   </w:r>
</w:p>

Is there a method to get the ID or the OOXML from a Shape object?
Regards

@gutzeit,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-15802 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@gutzeit,

Thanks for your patience. It is to update you that we have closed the issue (WORDSNET-15802) with ‘Won’t Fix’ resolution. Please note that this ID specifies a unique identifier for the current DrawingML object within the current document. This ID can be changed upon saving by Aspose.Words or MS Word (for example if you change document by adding new shape). So you cannot be sure that this ID is the same upon open/save.