poiによる複数のexcel sheetの生成

1475 ワード

	//   sheet
	@SuppressWarnings("unchecked")
	public void createExcelSheet(List list, String fileRealPath)
			throws Exception {
		HSSFWorkbook workBook = new HSSFWorkbook();
		int page = 3;
		if(page > list.size() || list.size() <100){
			page = 1;
		}
		for(int m=0;m list2 = (List) list.get(i);
				HSSFRow row = sheet.createRow(rowIndex);
				for (int q = 0; q < list2.size(); q++) {
					//    i    
					HSSFCell cell = row.createCell(q);
					cell.setCellValue(list2.get(q).replace("  ", ""));
					sheet.setColumnWidth(q, (80 * 50));
				}
				rowIndex++;
			}
			FileOutputStream fos = new FileOutputStream(fileRealPath);
			sheet.setGridsPrinted(true);
			HSSFFooter footer = sheet.getFooter();
			footer.setRight("Page " + HSSFFooter.page() + " of "
					+ HSSFFooter.numPages());
			workBook.write(fos);
			fos.close();
		}
	}