It's all about the answers!

Ask a question

DXL Scripting import image from Excel Cell if exists automation


niyathi p (111) | asked Nov 11 '21, 11:42 a.m.
edited Nov 11 '21, 12:10 p.m.

 Hello all,

I have seen this question asked often. (for Example : link1link2link3) But unfortunately did not find any answer or lead anywhere. I have written a code to export data from Excel into Doors by accessing each and every cell. But I am unable to access images in excel. Is there any way how to extract/upload image incase if an Image in a cell exists?

I am aware of the importPicture function but I do not want to import from local drive. I want to read the images from Excel. I can also change incase if it easier to access images referrenced in a cell like a hyperlink linked to the local drive. 

Can anyone please show some way how I could access images in excel? Much appreciated help. Thank you very much for sharing your knowledge if you know.

I tried the following as DXL is little similar to VBA. But no success: If anyone has a solution or a link, please help

string getCellContent(OleAutoObj objSheet, int cols, int rows)
{
  OleAutoArgs objArgBlock = create;
  OleAutoObj objCell;   
  string zellenInhalt;  
  string val;
  bool pic;
  OleAutoObj objShape;
  string shap;
  string typ;
  string cellvalue;
  string toprange;
  OleAutoObj pics;
  clear( objArgBlock );   
  put( objArgBlock, rows );  
  put( objArgBlock, cols );  
  oleGet(objSheet, "Cells", objArgBlock,objCell); 
  oleGet(objSheet, "Shapes", objShape);
  oleGet(objSheet, "Pictures", toprange);
  oleGet(objCell, "TopLeftCell", cellvalue);
  oleGet(objShape, "Type", typ);
  //print "TopLeftCell is: " toprange "\n"
  OleAutoObj p;
  string x
  string cnt
  if (!null objCell)
  {
    
        oleGet(objCell,"FormulaR1C1",zellenInhalt);
        oleGet(objCell, "Value", val);
oleGet(objCell, "Hyperlinks", objlin);
oleGet(objlin, "Count", cnt);
print cnt "\n";
oleGet(objCell, "Picture", objArgBlock,pic);
//string s = richTextWithOle(objCell."Object Text");
//print s "\n"
oleGet(objSheet, "Picture", pics);
oleGet(objCell, "TopLeftCell", toprange);
oleGet(objSheet, "Shapes", objshapes);
oleGet(objshapes, "Type", objType);
oleGet(objType, "TopLeftCell", objtpleft);
oleGet(objtpleft, "Address", objAdd);
//print objAdd "\n"
        //oleGet(objShape, "Type", typ);
//print "Shape is: " typ "\n"
print "TopLeftCell is: " toprange "\n"
//for p in pics do{
   //oleGet(p, "TopLeftCell", x);
   //print x "\n"
//}
  }
  return zellenInhalt "";
}


Comments
niyathi p commented Nov 15 '21, 8:02 a.m.

Could someone who knows this, please help me understand where am I going wrong? 


Ralph Schoon commented Nov 15 '21, 8:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I think most of the experts in this forum are Doors Next experts and not DXL experts. Asking for code examples is OK, but there is no guarantee to get an answer. 

Be the first one to answer this question!


Register or to post your answer.