1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Workbook wb = new HSSFWorkbook(); //Workbook wb = new XSSFWorkbook(); CreationHelper createHelper = wb.getCreationHelper(); Sheet sheet = wb.createSheet( "new sheet" ); // Create a row and put some cells in it. Rows are 0 based. Row row = sheet.createRow(( short )0); // Create a cell and put a value in it. Cell cell = row.createCell(0); cell.setCellValue(1); // Or do it on one line. row.createCell(1).setCellValue(1.2); row.createCell(2).setCellValue( createHelper.createRichTextString( "This is a string" )); row.createCell(3).setCellValue( true ); // Write the output to a file FileOutputStream fileOut = new FileOutputStream( "workbook.xls" ); wb.write(fileOut); fileOut.close(); |
'Study > JAVA' 카테고리의 다른 글
POI를 이용하여 word, excel 텍스트 추출 (0) | 2013.06.26 |
---|---|
엑셀파일 읽어와서 수정하기 (0) | 2013.06.04 |
Apache POI (0) | 2013.05.30 |
코딩시에 꼭 알아야 할 용어들의 이해 (0) | 2013.05.13 |
자바 환경설정 (0) | 2013.05.10 |