Free Support Forum - aspose.com

Node and Image

Hello, I have a Node of type Shape in my document and I have a variable “bmp” in my program that contains a image. But as I can replace the node by a new node that is of type Shape too and it contains my image “bmp”?

The node is: Node nd=doc.GetChild(NodeType.Shape,0,true); (for example)


Thanks

Hi,

Thank you for considering Aspose.

Shape objects cannot be created programmatically at the moment. So instead of replacing node, you might use a workaround like following:

Shape oldShape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveTo(oldShape);
builder.InsertImage(bmp);
doc.ChildNodes.Remove(oldShape);