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

Free Support Forum - aspose.com

Converting Word to HTML- using the image description as "alt" attribute

The attached document contains an image with a Word image description (Abbildung 1 - The
Google Logo).


Converting the word document to HTML, correctly displays the text below the image.
I was wondering if there is an option or feature that also uses this text as “alt” attribute of the “img” tag?

Code I use:
Document contentDocument = new Document(base + “data.docx”);
contentDocument.save(base + “output.html”, SaveFormat.HTML);
Hi there,

Thanks for your inquiry. Please use Shape.AlternativeText property to define alternative text to be displayed instead of a graphic. Following code example shows how to set this property for first Shape node in the document. Hope this helps you. Please let us know if you have any more queries.

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

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

shape.setAlternativeText("Alternative Text");

doc.save(MyDir + "Out.html");