packagePOI;importorg.apache.poi.hssf.usermodel.HSSFSheet;importorg.apache.poi.hssf.usermodel.HSSFRow;importorg.apache.poi.hssf.usermodel.HSSFCell;importorg.apache.poi.hssf.usermodel.HSSFWorkbook;importjava.io.FileNotFoundException;importjava.io.FileOutputStream;importjava.text.DecimalFormat;publicclassExpExcel...{publicstaticvoidmain(String[]args)throwsException...{HSSFWorkbookwb=newHSSFWorkbook();HSSFSheetsheet=wb.createSheet();for(inti=0;i<100;i++)...{HSSFRowrow=sheet.createRow((short)i);HSSFCellcell0=row.createCell((short)0);HSSFCellcell1=row.createCell((short)1);HSSFCellcell2=row.createCell((short)2);HSSFCellcell3=row.createCell((short)3);HSSFCellcell4=row.createCell((short)4);cell0.setCellValue(i*1);cell1.setCellValue("test");cell2.setEncoding(HSSFCell.ENCODING_UTF_16);//设置cell编码解决中文高位字节截断cell2.setCellType(1);cell2.setCellValue("你好_hello");//设置中西文结合字符串cell3.setCellValue(i*4);cell4.setCellValue(i*5);}FileOutputStreamfileout=newFileOutputStream("c:/workbook.xls");wb.write(fileout);fileout.close();System.out.println("exportover!");}}