excel - Add a hyperlink to an image in a cell that references another worksheet in the document using EPPlus -
excel - Add a hyperlink to an image in a cell that references another worksheet in the document using EPPlus -
need little help on epplus , i've insert image , image hyperlink different sheet ( table of content ). addimage function accepts uri object hyperlink property not take cell value.
here's code
private static void addimage(excelworksheet ws, int columnindex, int rowindex, string filepath,int offset,string optionalhyperlinkurl = "") { bitmap image = new bitmap(filepath); excelpicture image = null; if (image != null) { if (optionalhyperlinkurl != ""){ // it's crashing here because can't pass in [xxxxx.xlsx]'toc!a1' hyperlink since it's not valid url image = ws.drawings.addpicture("pic00", image, new uri(optionalhyperlinkurl)); } else { image = ws.drawings.addpicture("pic00", image); } picture.from.column = columnindex; picture.from.row = rowindex; picture.from.columnoff = pixel2mtu(offset); //two pixel space improve alignment picture.from.rowoff = pixel2mtu(2);//two pixel space improve alignment picture.setsize(386, 138); } }
image excel hyperlink epplus
Comments
Post a Comment