Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- java
- Spring
- junit
- CentOS
- curl
- Android
- File
- MySQL
- jquery
- NetBeans
- laravel
- SeLinux
- ajax
- tomcat
- 와일드카드
- php
- javascript
- larravel
- 리눅스
- 정규식
- 이클립스
- properties
- error
- Linux
- DB
- 톰캣
- input
- JSON
- 안드로이드
- html
Archives
- Today
- Total
합쭈기 programming
Excel 다운로드 본문
pom.xml
org.apache.poi poi 3.12-beta1 net.sourceforge.jexcelapi jxl 2.6.12
Use
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("Java Books");
sheet.setDefaultColumnWidth(30);
// create style for header cells
CellStyle style = getHeadStyle(workbook);
HSSFRow header = sheet.createRow(0);
header.createCell(0).setCellValue("Book Title");
header.getCell(0).setCellStyle(style);
header.createCell(1).setCellValue("Author");
header.getCell(1).setCellStyle(style);
header.createCell(2).setCellValue("ISBN");
header.getCell(2).setCellStyle(style);
header.createCell(3).setCellValue("Published Date");
header.getCell(3).setCellStyle(style);
header.createCell(4).setCellValue("Price");
header.getCell(4).setCellStyle(style);
/*response.setContentType(getContentType()); // http로 내보낼때
ServletOutputStream out = response.getOutputStream();*/
File file = new File("d:/excel.xls"); // file로 내보내기
FileOutputStream out = new FileOutputStream(file);
workbook.write(out);
out.flush();
'Java > Spring' 카테고리의 다른 글
| 이클립스 플러그인 - JVM explorer (0) | 2015.05.19 |
|---|---|
| 메모리 누수 확인 - TPTP (0) | 2015.05.19 |
| 자바 와일드 카드 (0) | 2015.05.15 |
| xml에서 properties 설정 사용하기 (0) | 2015.05.11 |
| JRebel - 재구동 없이 java & xml 변경 plugin (0) | 2015.05.11 |