Embed image in excel

Certified Senior Developer

Hi,

we have requirement where we need to embed image in excel.
We tried to use Embed Image into Excel smart service in 19.4 and getting below error:

Exception: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 43

following JSON string is passed as a input to smart service

{
"width":1000,
"padding":3,
"imageAnchors":{
"col1":2,
"row1":2,
"col2":3,
"row2":3
},
"imageDocument":{
"imageDocumentID":311790,
"sizePercentage":80
}
}

Has any one used Embed Image into Excel smart service or any other smart service to achieve this ?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Can you post the entire expression rule / expression function you're trying to use to call this smart service?  Including how you're forming your JSON string exactly, as well as how you're calling the embedImagesInExcel() function.  For pasting code here I recommend using a code box, by using the Insert -> Insert Code functionality in the comment menu here.

  • 0
    Certified Senior Developer

    Hi Mike,

    We initially tried to use Embed Image into Excel smart service in process model as well checked in expression rule using embedImagesInExcel() function but , still getting same error.

    embedimagesinexcel(
      excelDocument : cons!document,
      excelSaveFolder : cons!folder,
      excelName : "excel1",
      sheetName :"Sheet1",
      anchorsAndImagesJson :rule!APP_FormJsonTextInput()
    )
    
    --------------------------------------------------------------------
    APP_FormJsonTextInput
    
    a!toJson(
     {
        "width": 1000,
        "padding": 3,
        imageAnchors: {
          "col1": 2,
          "row1": 2,
          "col2": 3,
          "row2": 3
        },
        "imageDocument": {
          "imageDocumentID": 311790,
          "sizePercentage": 80
        }
      }
    )

  • 0
    Certified Lead Developer
    in reply to Varsha Pawar

    Thanks for confirming - I've also tried something very similar in one of my testing environments and I'm getting a nearly identical error as yours.  I don't see anything that is incorrect as per the documentation, either.  I think your options from here may be limited to just attempting to contact the creator of the plug-in (which I see you've already done at its page).  Apart from that, I'm not sure - you could try contacting Appian, but in general they're not responsible for errors within out-of-date plug-ins.  Someone who's more adept at Java than I am could potentially download the plug-in's source code and attempt to debug, but I'm not sure how effective that would be overall.