while(rs.next()){HSSFCellStylecellStyle=wb.createCellStyle();HSSFDataFormatformat=wb.createDataFormat();cellStyle.setDataFormat(format.getFormat("@"));HSSFRowrow=sheet.cr...
while(rs.next()){
HSSFCellStyle cellStyle = wb.createCellStyle();
HSSFDataFormat format = wb.createDataFormat();
cellStyle.setDataFormat(format.getFormat("@"));
HSSFRow row = sheet.createRow(i+2);
HSSFCell policyNoCell = row.createCell((short) 0);
policyNoCell.setCellStyle(cellStyle);
policyNoCell.setCellValue(new HSSFRichTextString(rs.getString(3)));
row.createCell((short) 0).setCellValue(new HSSFRichTextString(rs.getString(1)));
row.createCell((short) 1).setCellValue(new HSSFRichTextString(rs.getString(2)));
row.createCell((short) 2).setCellValue(new HSSFRichTextString(rs.getString(3)));
row.createCell((short) 3).setCellValue(new HSSFRichTextString(rs.getString(4)));
row.createCell((short) 4).setCellValue(new HSSFRichTextString(rs.getString(5)));
row.createCell((short) 5).setCellValue(new HSSFRichTextString(rs.getString(6)));
row.createCell((short) 6).setCellValue(new HSSFRichTextString(rs.getString(7)));
row.createCell((short) 7).setCellValue(new HSSFRichTextString(rs.getString(8).substring(0,9)));
row.createCell((short) 8).setCellValue(new HSSFRichTextString(rs.getString(9).substring(0,9)));
ExcelWrite.autoSetWidth(sheet,i);
i++;
}
展开