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

Free Support Forum - aspose.com

Identify Table

Hi,
I need to identify each table in my document,
now use the Title property in Alt Text tab.

Is there any API for accessing "Title" & "Descriptions" in table properties "Alt Text" tab?

If not How can give a name to single tables ?

Thanks

Mark

Hi Mark,

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

In your case we suggest you following solution.

1) Insert bookmark in the first cell of table with unique name.
2) Get the table using the bookmark. Please check following code snippet.

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

//Your code...

//Your code...

Bookmark bm = doc.Range.Bookmarks["table1"];

Table table = (Table)bm.BookmarkStart.GetAncestor(NodeType.Table);

if (table != null)

{

//Your code...

}

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

@mtugnoli

Starting from Aspose.Words 18.6, you can access the table’s title and description properties. We added new properties Title and Description in Table class.

Following code example shows how to read the table title and description properties and set them with new values.

Document doc = new Document(MyDir + "input.docx");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
Console.WriteLine(table.Title);
Console.WriteLine(table.Description);

table.Title = "Aspose table title";
table.Description = "Aspose table description";
doc.Save(MyDir + "output.docx");