Hi,
for( int x = 1; x <= rowcount ; x++ ){
String stcell = cellsw.get(x,13).getStringValue();
File imgin = new File(dataDir + “large_pictures\”+ COU + “\” +stcell);
if (!imgin.exists()){
logger.warn(" Image " + stcell + “doesn’t exists!”);
Cell cellw = cellsw.get(x,13);
cellw.setValue(“PICTURE NOT FOUND”);
Style style = cellw.getStyle();
Font font = style.getFont();
font.setColor(Color.getRed());
style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.LEFT_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.RIGHT_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.TOP_BORDER, CellBorderType.THICK, Color.getLightGray());
cellw.setStyle(style);
}
else{
BufferedImage in = ImageIO.read(imgin);
File imgot = new File(dataDir + “small_pictures\”+ COU + “\” +stcell);
BufferedImage ot = Scalr.resize(in,Method.QUALITY,150,150,Scalr.OP_ANTIALIAS);
ImageIO.write(ot, “jpg”, imgot);
//Set the row height
sheet2.getCells().setRowHeight(x,150 );
//Set the column width
sheet2.getCells().setColumnWidth(13,40);
//Add a picture to the cell
int index = sheet2.getPictures().add(x,13,x+1,14,dataDir + “small_pictures\”+ COU + “\” +stcell);//,he,wd);
//Get the picture object
Picture pic = sheet2.getPictures().get(index);
//Set the placement type
pic.setPlacement(PlacementType.MOVE_AND_SIZE);
//Add border
Cell cellw = cellsw.get(x,13);
cellw.setValue(cellsw.get(x,5).getValue());
Style style = cellw.getStyle();
style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.LEFT_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.RIGHT_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setBorder(BorderType.TOP_BORDER, CellBorderType.THICK, Color.getLightGray());
style.setCustom(";;;");
cellw.setStyle(style);
}
}