下了个POI3.8
里面有几个jar包 都是干嘛的,
poi-3.8-20120326.jar
poi-examples-3.8-20120326.jar
poi-excelant-3.8-20120326.jar
poi-ooxml-3.8-20120326.jar
poi-ooxml-schemas-3.8-20120326.jar
poi-scratchpad-3.8-20120326.jar
读取Excel2003 2007 2010希望都能兼容的话 该怎么做

解决方案 »

  1.   

    poi-excelant-3.8-20120326.jarxmlbeans-2.3.0.jarstax-api-1.0.1.jardom4j-1.6.1.jarpoi-3.8-20120326.jarpoi-ooxml-3.8-20120326.jarpoi-ooxml-schemas-3.8-20120326.jar  import java.io.FileOutputStream;
    import java.io.IOException;import org.apache.poi.ss.usermodel.Cell;
    import org.apache.poi.ss.usermodel.Row;
    import org.apache.poi.ss.usermodel.Sheet;
    import org.apache.poi.ss.usermodel.Workbook;
    import org.apache.poi.xssf.usermodel.XSSFWorkbook;/**
     * 用于生产excel文件xlsx
     *
     * @author
     */
    public class TestExcel
    {
        public void createExcel()
        {
            Workbook workBook = null;
            FileOutputStream output = null;
            Row row = null;
            Cell cell = null;
            try
            {
                output = new FileOutputStream(
                        "C:/Documents and Settings/kou/桌面/导出.xlsx");
                // 创建一个工作簿           //生成xlsx
                workBook = new XSSFWorkbook();           //生成xls           //  workBook = new XSSFWorkbook();
                //创建工作表
                Sheet sheet = workBook.createSheet("haha");
                int rowNum=10;
                //循环创建行数
                for (int i = 0; i < rowNum; i++)
                {   //创建一行
                    row = sheet.createRow(i);
                    int cellNum=10;
                    //循环创建单元格
                    for (int j = 0; j < cellNum; j++)
                    {
                        cell = row.createCell(j);
                        //给单元格设值
                        cell.setCellValue(i+""+j);
                    }
                }
                //将内容写入Excel
                workBook.write(output);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
            finally
            {
                try
                {
                    output.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }    }    public static void main(String[] args)
        {
            new TestExcel().createExcel();
        }}
      

  2.   

    不知道在哪下啊?poi-examples-3.8-beta.jar
                    poi-excelant-3.8-beta3.jar
                    poi-scratchpad-3.8-beta3.jar