文件名称:swing导出Excel
文件大小:25KB
文件格式:DOC
更新时间:2013-10-07 09:40:48
jxl
在table中导出Excel详细过程OutputStream os = response.getOutputStream(); response.setContentType("application/msexcel"); response.setHeader("Content-disposition","attachment; filename=clerkAddress.xls"); WritableWorkbook workbook = Workbook.createWorkbook(os); WritableSheet sheet = workbook.createSheet("TestCreateExcel", 0); //一些临时变量,用于写到excel中 jxl.write.Label l = null; //预定义的一些字体和格式,同一个Excel中最好不要有太多格式 WritableFont headerFont = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLUE); WritableCellFormat headerFormat = new WritableCellFormat(headerFont);