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 |
Tags
- netsh
- Eclipse
- lsof
- Mac
- tomcat
- context
- Windows
- web.xml
- 줄바꿈 문자
- IntelliJ
- vscode
- port
- bash
- find
- VirtualBox
- grep
- GIT
- JavaScript
- ssh
- profile
- Windows 10
- plugin
- 네트워크
- Source
- xargs
- import
- 단축키
- maVen
- Quartz
- resource
Archives
- Today
- Total
develog
poi 대용량 엑셀 write 본문
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
public class TestMain {
public static void main(String[] args) throws Throwable {
Workbook wb = new SXSSFWorkbook(1000); // keep 100 rows in memory, exceeding rows will be flushed to disk
Sheet sheet = wb.createSheet();
for (int i = 0; i < 1048576; i++) {
System.out.print(i + " => ");
Row row = sheet.createRow(i);
for (int j = 0; j < 50; j++) {
System.out.print(j + "\t");
Cell cell = row.createCell(j);
String address = new CellReference(cell).formatAsString();
cell.setCellValue(address);
}
System.out.println();
}
FileOutputStream out = new FileOutputStream("largeExcel.xlsx");
wb.write(out);
out.close();
}
}
'Dev > Java' 카테고리의 다른 글
XML DOM (0) | 2013.01.27 |
---|---|
AES (0) | 2013.01.27 |
Quartz job fire manually (0) | 2012.12.18 |
Quartz - Defining a Job (0) | 2012.12.14 |
java get ip (0) | 2012.12.14 |
Comments