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

Free Support Forum - aspose.com

How to insert an image with the width set to the parent node?

Hi there,

I've got a Document that has a text box in it.

In code, I want to insert an image into that text box, but I want the image width/height to be the same as the text box width/height.

Is there any way I can do this?

The bigger picture is that inside that textbox is a merge field, I then:

- Perform a merge
- Go to that field that is within the textbox
- Insert an image

Right now I'm manually specifying the width and height for the image, but I really want the image to take on the dimensions of the text box it is in.

Thanks!

You can ignore this, realized that in DocumentBuilder you can get the current paragraph, then the parent node.

I can then determine if that's a shape, if it is, I can get the width and height from the shape.

Sorry to bother you guys, all good! :-)

Hi Tim,

Thanks for your inquiry. It is nice to hear from you that you have found the solution of your query. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.