我正在尝试使用 apcahe poi xssf 工作簿在同一单元格中插入 iamge 和一些数据。我已经尝试过类似下面的东西
Workbook wb = new XSSFWorkbook();
XSSFSheet sheet = (XSSFSheet)wb.createSheet();
Row row = sheet.createRow(rowNum++);
row.setHeight((short) 1000);
String logoPath = confBean.getFacilityLogoByfacilityId(usersession);
/* Read input PNG / JPG Image into FileInputStream Object*/
InputStream logo = new FileInputStream(logoPath);
/* Convert picture to be added into a byte array */
byte[] bytes = IOUtils.toByteArray(logo);
/* Add Picture to Workbook, Specify picture type as PNG and Get an Index */
int my_picture_id = wb.addPicture(bytes, Workbook.PICTURE_TYPE_PNG);
/* Close the InputStream. We are ready to attach the image to workbook now */
logo.close();
/* Create the drawing container */
XSSFDrawing drawing = (XSSFDrawing) sheet.createDrawingPatriarch();
/* Create an anchor point */
//============= Inserting image - END
//========adding image START
XSSFClientAnchor my_anchor = new XSSFClientAnchor();
/* Define top left corner, and we can resize picture suitable from there */
my_anchor.setCol1(1);
my_anchor.setRow1(1);
my_anchor.setCol2(2);
my_anchor.setRow2(4);
/* Invoke createPicture and pass the anchor point and ID */
XSSFPicture my_picture = drawing.createPicture(my_anchor, my_picture_id);
Row row1=sheet.createRow(1);
row1.setHeight((short) 1000);
row1.createCell(1).setCellValue(proxy.getAddress()+","+proxy.getCity()+","+proxy.getState()+","+proxy.getCountry()+"-"+proxy.getZip()+".\n Phone:"+proxy.getPhone()+"EMAIL:"+proxy.getEmail());
我不确定我会得到如下所示的输出,有人可以帮忙吗?