Free Support Forum - aspose.com

How to add Id attribute when converting word to HTML


#1

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


#2

@himansubhoi,

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.


#3

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


#4

@himansubhoi,

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");

#5

@tahir.manzoor Thank you!!


#6

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