Hi,
Hi,
Hi,
Hi,
Thanks for the template file.
Please see the following sample code that shows how to add multiple images (hyperlinked to a cell and reposition them a bit in the cell. I have also attached the output file for your reference.
e.g
Sample code:
//Instantiating an Workbook object
Workbook workbook = new Workbook(“VideoLinks.xls”);
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(0);
//Adding a picture to B3 cell.
int pictureIndex = worksheet.getPictures().add(2, 1, “e:\test\school.jpg”, 40, 40);
//Accessing the newly added picture
Picture picture = worksheet.getPictures().get(pictureIndex);
//Positioning the picture accordingly
picture.setUpperDeltaX(200);
picture.setUpperDeltaY(10);
//Adding an hyperlink.
picture.addHyperlink(“http://www.google.com/”);
//Adding another picture at the location of the cell
pictureIndex = worksheet.getPictures().add(2, 1, “e:\test\school.jpg”, 40, 40);
//Accessing the newly added picture
Picture picture1 = worksheet.getPictures().get(pictureIndex);
//Positioning the picture accordingly
picture1.setUpperDeltaX(200);
picture1.setUpperDeltaY(120);
//Adding an hyperlink.
picture1.addHyperlink(“http://www.yahoo.com/”);
//Extend the column width a bit.
worksheet.getCells().setColumnWidth(1,14);
//Saving the Excel file
workbook.save(“out1.xlsx”);
Hope, this helps a bit.
Thank you.