Docx from dynamic template Image

Certified Senior Developer

Hello guys, So I was trying to add image to the document (both dynamic and static) . I included the required image doc as constant in my XML. I got the id of the document in the generated document. Some discussions explain about bookmarks. I have tried that but still the same. It gets a bracket outside of the doc Id. So Any other possible solutions. Also I want some notes or any references or other new things in this plugin for my seminar. Thanks in Advance.

First image is the template. Second one is the xml code. Third one is the one I got so far.

  Discussion posts and replies are publicly visible

Parents
  • Hi there,

    The way that you have configured your template it is not correct, and there are few things that you will need to change in order to add an image in your DOCX, I'll try to add some steps here:

    • You don't need to have the document ID in your XML, as the document will be passed in a different parameter of the smart service (Images), check the screenshot below.
    • Inside your template you must to have an image as a place holder, it is to this image that you will add the link that contains the bookmark that you created
    • If you need the image to be conditional you can add a normal validation before the image, to check if the bookmark has content or not. Please check the screenshot below

    Regards,

    Acacio B

  • 0
    Certified Senior Developer
    in reply to Acacio Barrado

    Hi Acacio,

    Thanks for the response. I tried your suggestion and I got image at the document. But it was the same template image which I used Not the one I gave in the process model.

    So for testing , I have used this template for image alone and that was my template image.

    In this constant it holds four variety of crop image documents.

    This is what I got as my output.

    Is my template image wrong? Could you please help with the issue. Thanks in Advance.

  • Hey there,

    I would try few other things.

    • You should not have a list of images been passed in the same input, so ideally if you want to have 4 different images you would have something like the code below:

    {
      logo: pv!document1,
      image2: pv!document2,
      image3: pv!document3,
      image4: pv!document4,
    }

    • Don’t forget to create a different bookmark for image.

    • If you need the same image to be different, apply the condition in the process model and then send to the input parameter just the correct document in the correct bookmark

    • Last, I would not use directly constant in the input parameter, I would rather create a PV type of document in the process model, and in one script task I would pass the constant to the PV, than use the PV in the input parameter. I know that this sound a bit silly and redundant, but I faced issues before, when directly using the constant, so it is worth to try.

    I hope that helps

    Acacio B.

  • 0
    Certified Senior Developer
    in reply to Acacio Barrado

    Hi,

    Thanks for the response, I tried to add a single document by saving it in a process variable , But still I am getting my template image as output image in document. Is that the template image has any problem?

    Kavya

  • Well there is a possibility that your template is wrong.

    Im attaching a template here, in it I have created a bookmark called signature, as in the screenshot in my first

    answer. Please change it in your process model and try to use this template.

    Community Test.docx

    Acacio B.

Reply Children