Aspose Word : How to get picture\chart alt title

Hello,

We need to get the “Alt text title” from a picture\chart inserted in a word document.

We succeeded to obtain the alt text description using the following code :

var document = new Document("test.docx");
var firstSection = document.FirstSection;
var firstParagraph = firstSection.Body.FirstParagraph;
var picture = firstParagraph.ChildNodes.ToArray().OfType().FirstOrDefault();
var altTexDescription = picture.AlternativeText;

We have the same problem for a chart inserted in a word document.

Can you please advise ?

Adriana Minea
Software Developer
IBM Romania

Hi Adriana,

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-12918 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

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

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

Hi Adriana,

It is to update you that starting from 16.2.0 version, Aspose.Words supports Alt Text Title.

In case of older format conversion, MS Word formats follow string “Title: titleText - Description: descText”, if there is no description then “Title: titleText”, and if there is no title then just “descText”. Aspose.Words does the same now.

But also you can get/set shape title like this:

Node[] shapes = doc.GetChildNodes(NodeType.Shape, true).ToArray();
Shape shape0 = (Shape)shapes[0];
// Get shape title.
Console.WriteLine(shape0.Title);
// Set new shape title.
shape0.Title = "New Shape Title";

Hope, this helps.

Best regards,

Thank you! We will give it a try.