How to change the Shape Title and description using Java

Hi,
Using Aspose.Words API with Version 14.7.

When calling DrawingML.setScreenTip(java.lang.String) - it not setting “title” attribute on Drawing ML object. Due to this, we are not able to set “title” attribute on DrawingML objects such as image, smart art and chart.

Following the sample XML… we are able to set “descr” attribute… but we can’t set “title” attribute inside wp:docPr tag for DrawingML object such as image, smart art and chart objects.

<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
…
<wp:docPr id="1" name="Picture 1" descr="sample test"/>
…
<w:drawing>

“title” attribute is defined for “wp:docPr” tag in Open XML:
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/cc797242(v=office.14)

This seem like an bug.

Can you please let me know if any workaround for this… or can you consider fixing this.

-Satya

Hi Satya,

You are using an older version of Aspose.Words. DrawingML has been deprecated from latest versions and you can use Shape class to access all types of shapes including DrawingML.

As far as Title is concerned, it is not supported at the moment; you can set descr attribute through Shape.setAlternativeText. A new feature request to support setting shape title has been logged into our issue tracking system as WORDSNET-11865. We will keep you updated on this issue in this thread.

Best Regards,

Hi,
Thanks for the update.
Currently we are able to set “title” attribute on <v:shape> objects…
But what we are looking is - the API fix - with which we can be able to update “title” attribute on wp:docPr for drawing objects such as image, chart etc… I hope the issue# WORDSNET-11865 addresses this. Please clarify.
-Satya

Hi Satya,

Yes, it will address your mentioned issue.

Best Regards,

The issues you have found earlier (filed as WORDSNET-11865) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for .NET 18.12 update and this Aspose.Words for Java 18.12 update.

@oraspose

MS Words supports both title and description properties of Shape. Starting from Aspose.Words 16.3, you can set the title of shape using Shape.Title. Following code example shows how to set title of shape object.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create test shape
Shape shape = new Shape(doc, ShapeType.Cube);
shape.Width = 431.5;
shape.Height = 346.35;
shape.Title = "Alt Text Title";
builder.InsertNode(shape);