Words Curl Image Tag Must Be Located Within Image Container

Hello Aspose Team,

I am using Words. Curl to populate a document template. My Word document template requires an image to be inserted. I used this tag in the Word document:

<<image [Site_Image] -keepRatio>>

The PUT endpoint I am using is:
https://api.aspose.cloud/v4.0/words/buildReport

When I called the endpoint I received this error message.

{
  "Error": {
    "Code": "ErrorInvalidInputData",
    "Message": "Error while build report",
    "Description": "Operation Failed. The input data is not valid.",
    "InnerError": {
      "Message": "Tag 'image' is not well-formed. Tag 'image' must be located within an image container."
    }
  },
  "RequestId": "06c8f26d903c849444b8312ba21397de"
}

What is the correct tag syntax to use in my Word document to resolve the error for images?

@mdevaney

To resolve the error you are encountering with the image tag in your Word document template, you need to ensure that the image tag is placed within a textbox. The correct approach is as follows:

  1. Add a Textbox: Insert a textbox in your Word document at the location where you want the image to appear.

  2. Set Image Attributes: Configure the textbox with the necessary image attributes such as frame and size, making it look like a blank image placeholder.

  3. Use the Image Tag: Inside the textbox, use the image tag with the following syntax:

    <<image [Site_Image] -keepRatio>>
    

By following these steps, you should be able to insert images dynamically without encountering the “Tag ‘image’ is not well-formed” error. This method ensures that the image tag is correctly recognized within the context of an image container, which is required for proper processing.

If you have any further questions or need additional assistance, feel free to ask!

@mdevaney As it is mentioned in the error message image tag should be placed in the textbox placeholder. Please see our documentation for more information:
https://docs.aspose.com/words/net/inserting-images-dynamically/