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

Free Support Forum - aspose.com

How to add Id attribute when converting word to HTML

In my word there is image, when i’m converting to HTML, I need to add id attribute of image in html.


Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. Aspose.Words does not provide API to set the shape ID. The image is imported as Shape node in Aspose.Words’ DOM. In your case, we suggest you please use Shape.AlternativeText property to set the alternative text as image id.

Thank you @tahir.manzoor. I will appreciate if you will provide some sample code.


Thanks for your inquiry. Following code example shows how to set the alternative text of Shape. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
shape.AlternativeText = "123";
doc.Save(MyDir + "output.html");

@tahir.manzoor Thank you!!

A post was split to a new topic: Alternative text for paragaph as html