|
@@ -60,12 +60,10 @@ public class Report2xls {
|
|
thead.createCell(i).setCellValue(theads[i]);
|
|
thead.createCell(i).setCellValue(theads[i]);
|
|
}
|
|
}
|
|
// sheet1.setDefaultRowHeight((short)(30*256));
|
|
// sheet1.setDefaultRowHeight((short)(30*256));
|
|
- for (int rowNum = 0; rowNum < data.size()&&rowNum<588; rowNum++) {
|
|
|
|
|
|
+ for (int rowNum = 0; rowNum < data.size(); rowNum++) {
|
|
Row row = sheet1.createRow(rowNum+1);
|
|
Row row = sheet1.createRow(rowNum+1);
|
|
//row.setHeight((short)(30*256));
|
|
//row.setHeight((short)(30*256));
|
|
- if(rowNum<580){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
FinalReportDTO dto = data.get(rowNum);
|
|
FinalReportDTO dto = data.get(rowNum);
|
|
cell0 = row.createCell(0);
|
|
cell0 = row.createCell(0);
|
|
cell0.setCellValue(rowNum+1);
|
|
cell0.setCellValue(rowNum+1);
|
|
@@ -92,10 +90,10 @@ public class Report2xls {
|
|
tempWidth = bufferImg.getWidth();
|
|
tempWidth = bufferImg.getWidth();
|
|
tempHeight = bufferImg.getHeight();
|
|
tempHeight = bufferImg.getHeight();
|
|
fitSize = getFitHeightAndWidth(tempHeight,tempWidth);
|
|
fitSize = getFitHeightAndWidth(tempHeight,tempWidth);
|
|
- ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
|
|
|
|
|
+ ImageIO.write(bufferImg, getPictureType(bufferImg.getType()), byteArrayOut);
|
|
anchor = new HSSFClientAnchor(fitSize[1]*4, fitSize[0], 0, 0,(short) (5+photoIndex), (rowNum+1), (short) (6+photoIndex), rowNum+2);
|
|
anchor = new HSSFClientAnchor(fitSize[1]*4, fitSize[0], 0, 0,(short) (5+photoIndex), (rowNum+1), (short) (6+photoIndex), rowNum+2);
|
|
//插入图片 1
|
|
//插入图片 1
|
|
- patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));
|
|
|
|
|
|
+ patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(),bufferImg.getType()));
|
|
bufferImg = null;
|
|
bufferImg = null;
|
|
byteArrayOut = new ByteArrayOutputStream();
|
|
byteArrayOut = new ByteArrayOutputStream();
|
|
}
|
|
}
|
|
@@ -122,10 +120,19 @@ public class Report2xls {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
private static int max(int a, int b) {
|
|
private static int max(int a, int b) {
|
|
return a>b?a:b;
|
|
return a>b?a:b;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static String getPictureType(int type){
|
|
|
|
+ if(type==6){
|
|
|
|
+ return "png";
|
|
|
|
+ }
|
|
|
|
+ return "jpg";
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 0 is Height and 1 is width
|
|
* 0 is Height and 1 is width
|
|
* @param height
|
|
* @param height
|