Adding Image into a excel cell and adding a hyperlink to the image

saravananiyyanar

New member
Joined
May 5, 2011
Messages
2
Reaction score
0
Points
0
I have a requirement to create an excel and add an image into a cell and add hyperlink (url ) to the image. I am trying with Apache POI HSSF to achieve the functionality.

The image to be placed in the cell will be a thumbnail image (small one). Hyperlink to the image will be an url that take you to the full size image.

When I add an image into the cell with anchor option, the image is floating and didn’t reside within the cell. The suggestion was to have an idea of the image dimension and provide the row and cell width accordingly. But could not add a hyperlink to the image though.

Please provide your inputs on whether this is feasible with Apache POI HSSF.


Thanks
Saravanan
 
I guess the really simply way is this
Code:
'select a cell to locate picture at
Range("G1").Select
'get the picture
ActiveSheet.Pictures.Insert("C:\Users\YOUR NAME\Pictures\mypic.jpg").Select
'select the action with the cell
Selection.Placement = xlMoveAndSize
'optional "Alt Text" you don't need this line
Selection.ShapeRange.Title = Range("A1").Value
'add the hyperlink to the currently selected cell
ActiveSheet.Hyperlinks.Add Anchor:=Selection.ShapeRange.Item(1), Address:= _
[URL]http://www.yoursite.com/google.jpg[/URL]
 
Thanks Simon Lloyd. I am creating excel file using java and require the functionality using any Java API. I am using Apache POI HSSF, but could not add hyperlink to the image.
 
Back
Top