Red de conocimiento informático - Material del sitio web - Cómo usar Java para escribir datos en Excel especificado

Cómo usar Java para escribir datos en Excel especificado

jxl, se puede implementar, hay muchos paquetes jar de código abierto, actualmente estoy usando jxl

SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

String id =req .getParameter("id" );

String fileName =req.getParameter("fileName");

Archivo f = new File(req.getSession().getServletContext (). getRealPath("/ printTemplateExcel/" fileName));

WritableWorkbook wwb=null

WritableSheet wws=null;

Etiqueta etiqueta = nulo

Libro de trabajo wb=null;

prueba {

FesOrders fesOrders =new FesOrders(); > fesOrders.out.println(a.getId());

}

WritableFont headerFont =new WritableFont(WritableFont.createFont("Nueva canción"), 10, WritableFont.BOLD , false, UnderlineStyle.NO_UNDERLINE, Colour.getWorkbook(f);

out = new FileOutputStream(new File(req.getSession().getServletContext().getRealPath("/printExcel/" fileName));

wwb = Workbook.createWorkbook(out, wb);

wws = wwb.getSheet("Hoja de envío");

String date=sdf.format (nueva fecha ());

for(int i=0; ilt; wws.getRows(); i ){

for(int j=0; jlt; wws. getColumns() ; j ){

Celda celda = wws.getCell(j, i);