How to set Shape ID via title property using Java

Hi,


Please find the attached document. I am using Aspose words version 14.12.0

In that, I am trying to get the shape Ids of the shapes present under FootNote nodes using the code below. Instead of giving id “1055”, the code gives id “1036” as the shape present under FootNote which is wrong

-------------------------------------------------------------
Node[] footNoteArray = getAsposeDoc().getChildNodes(NodeType.FOOTNOTE, true).toArray();
for (Node node : footNoteArray)
{
if (node instanceof CompositeNode<?>){
CompositeNode footNote = (CompositeNode)node;
Node[] footNoteImages = footNote.getChildNodes(NodeType.SHAPE, true).toArray();
for (Node footNoteImageNode : footNoteImages)
{
if (node instanceof Shape)
{
Shape s = (Shape) node;
String footNoteImageKey = s.getShapeId_IShape();
wordConverter.addtoFootNoteImageKeys(footNoteImageKey);
}
}
}
}
----------------------------------------------------------------

Also, I tried to see if the latest aspose version 15.3.0 solves the above issue. But, I came to know that getShapeId_IShape() api itself is removed from Shape class. In our project, We use this api extensively and we need this to be in the latest updates.

Please look into this at the earliest

Hi there,

Thanks for your inquiry. Please note that there is no API which return the node ID. The getShapeId_IShape method is not public. This method is for internal use of Aspose.Words. I suggest you please read about Aspose.Words DOM from here:
http://www.aspose.com/docs/display/wordsjava/Object+Model+Overview

Hi,


If Shape Id is not available, How to identiy/Find a particular Shape. I could not find anything regarding this in the Aspose.Words DOM overview link that you sent.

Hi there,

Thanks for your inquiry. Aspose.Words supports the Shape. AlternativeText which get or set the alternative text ( description ) of shape. Please use Shape.AlternativeText. See the attached image for the detail of alternative text ( description ) of shape

Document doc =  **new**  Document( *MyDir*  + "in.docx");

Shape shape = (Shape)doc.getChild(NodeType. *SHAPE* , 0,  **true** );

shape.setAlternativeText("Shape 1");

doc.save( *MyDir*  + "Out.docx");

@Viswa53

Starting from Aspose.Words 16.3, you can set and get the title of shape using Shape.Title property. Following code example shows how to set the title of shape object.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create test shape
Shape shape = new Shape(doc, ShapeType.CUBE);
shape.setWidth(431.5);
shape.setHeight(346.35);
shape.setTitle("Alt Text Title");

builder.insertNode(shape);