package ais.daochu.linshi;
import java.io.FileOutputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.poi.hssf.usermodel.*;
import ais.db.DBConnect;
import ais.dboperate.info.InfoStudentManager;
import ais.dboperate.param.ParamDepartmentManager;
import ais.dboperate.param.ParamSpecialManage;
import ais.dboperate.zizhu.ZizhuProjectGradingManager;
import ais.model.data.DataDemocracyEvaluation;
import ais.model.info.InfoStudent;
import ais.model.zizhu.ZizhuProjectGrading;
import ais.model.zizhu.ZizhuTostudent;
public class PoiTest {
/*
* 数据导出最简单的方法
*/
public static void main(String args[])throws Exception {
//数据库
FileOutputStream fos = new FileOutputStream("d:"+"8.xls");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
wb.setSheetName(0, "first sheet");
//一行
HSSFRow row = s.createRow(0);
//10列
HSSFCell cell1 = row.createCell((short) 0);
cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
cell1.setCellValue("字段1");
HSSFCell cell2 = row.createCell((short) 1);
cell2.setCellType(HSSFCell.CELL_TYPE_STRING);
cell2.setCellValue("字段2");
HSSFCell cell3 = row.createCell((short) 2);
cell3.setCellType(HSSFCell.CELL_TYPE_STRING);
cell3.setCellValue("字段3");
HSSFCell cell4 = row.createCell((short) 3);
cell4.setCellType(HSSFCell.CELL_TYPE_STRING);
cell4.setCellValue("字段4");
HSSFCell cell5 = row.createCell((short) 4);
cell5.setCellType(HSSFCell.CELL_TYPE_STRING);
cell5.setCellValue("字段5");
HSSFCell cell6 = row.createCell((short) 5);
cell6.setCellType(HSSFCell.CELL_TYPE_STRING);
cell6.setCellValue("字段6");
HSSFCell cell7 = row.createCell((short) 6);
cell7.setCellType(HSSFCell.CELL_TYPE_STRING);
cell7.setCellValue("字段7");
HSSFCell cell8 = row.createCell((short) 7);
cell8.setCellType(HSSFCell.CELL_TYPE_STRING);
cell8.setCellValue("字段8");
HSSFCell cell9 = row.createCell((short) 8);
cell9.setCellType(HSSFCell.CELL_TYPE_STRING);
cell9.setCellValue("字段9");
HSSFCell cell10 = row.createCell((short) 9);
cell10.setCellType(HSSFCell.CELL_TYPE_STRING);
cell10.setCellValue("字段10");
wb.write(fos);
fos.close();
}
}
有4个jar包需要下载