Excel로 데이터 내보내기
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell = row.createCell((short) 0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 2);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 4);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" 4 ");
cell = row.createCell((short) 6);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
cell = row.createCell((short) 7);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(" ");
jnlsList = this.getBill2Service().getJnlsListByCriteria(
detachedCriteria);
Iterator itr = jnlsList.iterator();
WtPepJnls wtj;
short rowNum = 1;
String temp = "";
while (itr.hasNext()) {
wtj = (WtPepJnls) itr.next();
row = sheet.createRow(rowNum);
cell = row.createCell((short) 0);
temp = wtj.getPepdate();
temp = temp.substring(0, 4) + "-"
+ temp.substring(4, 6) + "-"
+ temp.substring(6, 8);
cell.setCellValue(temp);
cell = row.createCell((short) 1);
cell.setCellValue(wtj.getIntcdno());
cell = row.createCell((short) 2);
temp = "¥" + Util.FormatSum(wtj.getTranamt());
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(temp);
cell = row.createCell((short) 3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue("¥0.00");
cell = row.createCell((short) 4);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
temp = wtj.getTrancde();
if (temp.equals("M22")) {
cell.setCellValue(" ");
} else if (temp.equals("M24")) {
cell.setCellValue(" ");
} else if (temp.equals("M26")) {
cell.setCellValue(" ");
} else if (temp.equals("M2H")) {
cell.setCellValue(" ");
}
cell = row.createCell((short) 5);
temp = wtj.getOutcdno();
cell.setCellValue(temp.substring(12, 16));
cell = row.createCell((short) 6);
cell.setCellValue(wtj.getTermid());
cell = row.createCell((short) 7);
cell.setCellValue(wtj.getId().getTrace());
rowNum++;
}
response.setContentType("octets/stream");
response.addHeader("Content-Disposition",
"attachment;filename=all.xls");
OutputStream fileOut = response.getOutputStream();
wb.write(fileOut);
fileOut.close();
return null;
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Excel Grep toolExcel Grep tool ■히나가타 ■ 시트 구성 ExcelGrep.cls...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.