2
This is the method I use to put images in Excel:
public void insertIcons(String URL, Sheet sheet, int colBegin, int colEnd, int rowBegin, int rowEnd) {
try {
InputStream iconInput = new FileInputStream(URL);
byte[] byteTransf = IOUtils.toByteArray(iconInput);
int pictureIdx = workbook.addPicture(byteTransf, org.apache.poi.ss.usermodel.Workbook.PICTURE_TYPE_PNG);
iconInput.close();
CreationHelper helper = workbook.getCreationHelper();
Drawing drawingIcon = sheet.createDrawingPatriarch();
ClientAnchor anchorIcon = helper.createClientAnchor();
anchorIcon.setCol1(colBegin);
anchorIcon.setCol2(colEnd);
anchorIcon.setRow1(rowBegin);
anchorIcon.setRow2(rowEnd);
Picture iconReady = drawingIcon.createPicture(anchorIcon, pictureIdx);
iconReady.resize(1);
} catch (Exception e) {
e.printStackTrace();
}
}
So I use the method:
insertIcons(".idea/Icons/table.png", sheetName, 4, 4, 6, 9);
Would it be possible to put a Hyperlink in this image to go to another Sheet in the same spreadsheet? Or to a website?
I read that apparently apache does not offer support to do this, but it would have as using the lowerLevel API. But I could not use it successfully
Algum Seguestão?
This is the stack in English. Translate your question here.
– user28595