int cellNum = 0; JSONObject temp = new JSONObjectdataoptStringi; forcellNum=0;cellNumdisplayKeyslength+2;cellNum++ String value = tempoptStringdataKeyscellNum; Systemoutprintlnvalue=
int cellNum = 0; JSONObject temp = new JSONObject(data.optString(i)); for(cellNum=0;cellNum<displayKeys.length+2;cellNum++) { String value = temp.optString(dataKeys[cellNum]); System.out.println("value============" + value);
if(dataKeys[cellNum].equals("images"))
{
JSONArray images = temp.optJSONArray("images");
if(images != null)
{
for(int j=0; j<images.length(); j++)
{
String imageUrl = images.optString(j);
URL imageUrlObj = new URL(imageUrl);
InputStream imageStream = imageUrlObj.openStream();
byte[] byteArray = IOUtils.toByteArray(imageStream);
int pictureIndex = wb.addPicture(byteArray, Workbook.PICTURE_TYPE_JPEG);
XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cellNum, i+rowcount, (short) (cellNum+1), i+rowcount+1);
XSSFPicture picture = patriarch.createPicture(anchor, pictureIndex);
picture.resize();
}
}
}
else
{
CellUtil.createCell(r, cellNum, value);
}
原文地址: http://www.cveoy.top/t/topic/iXcx 著作权归作者所有。请勿转载和采集!