larenmark的gravatar头像
larenmark2017-06-22 09:15:13

java web项目基于poi导入Excel和文件压缩

做了一个java web项目,其中用到了poi下载数据到Excel中,和文件的压缩。需要的可以参考一下,因为是测试用的,代码写的可能不规范,请见谅。

运行后生生成Excel文件和压缩包文件如图。

java web项目基于poi导入Excel和文件压缩java web项目基于poi导入Excel和文件压缩

package com.pract.poi;

import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress;

/**
 * Created by DELL on 2017/6/12.
 */
public class POIUtil {

    //第一 设置head的属性

    /**
     * @param sheet
     * @param headers  传入表格的表头文件
     * @param mergeValue  sheet表格的标题合并行列的值,默认值依次为起始行(firstRow),结束行(lastRow),起始列(firstCol),结束列(lastCol)
     * @param sheetTitle  sheet的标题
     * @return
     */
    public HSSFSheet setHeaderStyle(HSSFWorkbook wb, HSSFSheet sheet, HSSFRow row, String[] headers, int[] mergeValue, String sheetTitle){
        //设置head的属性
        if (null == mergeValue ){//合并单元格默认为前两行,和header的长度。
            int[] mergeTemp = {0, 2, 0, headers.length};
            mergeValue = mergeTemp;
        }
        sheet.addMergedRegion(new CellRangeAddress(mergeValue[0], mergeValue[1], mergeValue[2] , mergeValue[3]));//设置合并的行列

        // 生成一个sheet表头的样式
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中
        HSSFFont font = wb.createFont();
        font.setFontHeightInPoints((short) 14);//字号
        font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);//加粗
        style.setFont(font);

        HSSFRow row0 = sheet.createRow((int) 0);
        HSSFCell cell0 = row0.createCell((short) 0);
        cell0.setCellValue(sheetTitle);
        cell0.setCellStyle(style);

        row = sheet.createRow((mergeValue[1] + 1));//从合并列的下一行还是创建标题行
        HSSFCell headerCell = row.createCell((short) 0);
        for (int j = 0; j < headers.length; j++){
            HSSFCell cell = row.createCell(j);
            cell.setCellStyle(new POIUtil().setCellStyle(wb, sheet));
            HSSFRichTextString text = new HSSFRichTextString(headers[j]);
            cell.setCellValue(text);
        }
        return sheet;
    }

    /**
     * @param wb
     * @param sheet
     * @return
     */
    public HSSFCellStyle setCellStyle( HSSFWorkbook wb, HSSFSheet sheet){
        //生成Excel表格的cell的样式
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 设置表格默认列宽度为15个字节
        sheet.setDefaultColumnWidth((short) 15);
        // 设置这些样式
        cellStyle.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
        cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        // 生成一个字体
        HSSFFont cellFont = wb.createFont();
        cellFont.setColor(HSSFColor.VIOLET.index);
        cellFont.setFontHeightInPoints((short) 12);
        cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        cellStyle.setFont(cellFont);
        return cellStyle;
    }

    /**
     * 设置备注信息
     * @param sheet
     * @param commentStr  备注信息
     * @param author  作者
     * @param mergeValue  备注栏大小设置,默认值依次为起始行(firstRow),结束行(lastRow),起始列(firstCol),结束列(lastCol)
     * @return
     */
    public HSSFComment setCommit(HSSFSheet sheet, String commentStr, String author, int[] mergeValue ){
        if (null == mergeValue ){//合并单元格默认为前两行,和header的长度。
            int[] mergeTemp = {0, 0, 0, 0};
            mergeValue = mergeTemp;
        }
        // 声明一个画图的顶级管理器
        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
        // 定义注释的大小和位置,详见文档
        HSSFComment comment = patriarch.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short) mergeValue[0], mergeValue[1], (short)mergeValue[2] , mergeValue[3]));
        // 设置注释内容
        comment.setString(new HSSFRichTextString(commentStr));
        // 设置注释作者,当鼠标移动到单元格上是可以在状态栏中看到该内容.
        if( null != author ){
            comment.setAuthor(author);
        }

        return comment;
    }

}

组合将数据写入到Excel中

package com.pract.poi;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.JOptionPane;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFComment;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;

import com.pract.pojo.Book;
import com.pract.pojo.Student;
import com.pract.constant.poiConstant;

public class ExportExcel<T> {

      /**
       * 这是一个通用的方法,利用了JAVA的反射机制,可以将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上
       * @param title
       *            表格标题名
       * @param headers
       *            表格属性列名数组
       * @param dataset
       *            需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象。此方法支持的
       *            javabean属性的数据类型有基本数据类型及String,Date,byte[](图片数据)
       * @param filePath  输出的文件路径
       *            //与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
       * @param pattern
       *            如果有时间数据,设定输出格式。默认为"yyy-MM-dd"
       */
      @SuppressWarnings("unchecked")
      public void exportExcel(String title, String[] headers,
            Collection<T> dataset, String filePath, String pattern, int[] mergeValue ) {
         HSSFWorkbook wb = new HSSFWorkbook();
         Integer total = dataset.size();
         int sheetNum = (total/6000 + 1);
         //遍历集合数据,产生数据行
         Iterator<T> it = dataset.iterator();
         for(int j=0; j < sheetNum; j++ ){
            // 生成一个表格
             title = (sheetNum > 1) ?  (title + "_" + 1) : title;
            HSSFSheet sheet = wb.createSheet(title);
            HSSFRow row = null;// 根据具体的需要在创建行;
            POIUtil poi = new POIUtil();
            // 设置Excel的header的格式
            sheet = poi.setHeaderStyle(wb, sheet, row, headers, mergeValue,  title);

            //生成Excel表格的cell的样式
            HSSFCellStyle cellStyle = poi.setCellStyle(wb, sheet);

            Integer index = 0;//读取dataList数据的行数
            int rowNum = (null != mergeValue) ? (mergeValue[1] + 1) : 1;
            while (it.hasNext() && index < 6000) {
               index++;
               rowNum++;
               System.out.println("****:" + rowNum);
               row = sheet.createRow(rowNum);
               T t = (T) it.next();
               //利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
               Field[] fields = t.getClass().getDeclaredFields();
               for (short i = 0; i < fields.length; i++) {
                  HSSFCell cell = row.createCell(i);
                  cell.setCellStyle(cellStyle);
                  Field field = fields[i];
                  String fieldName = field.getName();
                  String getMethodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
                  try {
                     Class tCls = t.getClass();
                     Method getMethod = tCls.getMethod(getMethodName,
                           new Class[] {});
                     Object value = getMethod.invoke(t, new Object[] {});
                     //判断值的类型后进行强制类型转换
                     String textValue = null;

                     if (value instanceof Boolean) {
                        boolean bValue = (Boolean) value;
                        textValue = "男";
                        if (!bValue) {
                           textValue ="女";
                        }
                     } else if (value instanceof Date) {
                        Date date = (Date) value;
                        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
                        textValue = sdf.format(date);
                     }  else if (value instanceof byte[]) {
                        // 有图片时,设置行高为60px;
                        row.setHeightInPoints(30);
                        // 设置图片所在列宽度为80px,注意这里单位的一个换算
                        sheet.setColumnWidth(i, (short) (35.7 * 40));
                        // sheet.autoSizeColumn(i);
                        byte[] bsValue = (byte[]) value;
                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0,
                              1023, 255, (short) i, index, (short) i, index);
                        anchor.setAnchorType(2);
                        // 声明一个画图的顶级管理器
                        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
                        patriarch.createPicture(anchor, wb.addPicture(
                              bsValue, HSSFWorkbook.PICTURE_TYPE_JPEG));
                     } else{
                        //其它数据类型都当作字符串简单处理
                        textValue = value.toString();
                     }
                     //如果不是图片数据,就利用正则表达式判断textValue是否全部由数字组成
                     if(textValue!=null){
                        Pattern p = Pattern.compile("^//d+(//.//d+)?$");
                        Matcher matcher = p.matcher(textValue);
                        if(matcher.matches()){
                           //是数字当作double处理
                           cell.setCellValue(Double.parseDouble(textValue));
                        }else{
                           HSSFRichTextString richString = new HSSFRichTextString(textValue);
                           HSSFFont font3 = wb.createFont();
                           font3.setColor(HSSFColor.BLUE.index);
                           richString.applyFont(font3);
                           cell.setCellValue(richString);
                        }
                     }
                  } catch (SecurityException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                  } catch (NoSuchMethodException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                  } catch (IllegalArgumentException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                  } catch (IllegalAccessException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                  } catch (InvocationTargetException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                  } finally {
                     //清理资源
                  }
               }
            }
         }
         if(null == filePath || filePath.equals("")){
            filePath = poiConstant.filePath;
         }
         try {
            FileOutputStream out = new FileOutputStream( filePath + title + ".xls");
            wb.write(out);
            out.close();
         } catch (Exception e) {
            e.printStackTrace();
         }
    
      }
    
      public static void main(String[] args) {
         // 测试学生
         ExportExcel<Student> ex = new ExportExcel<Student>();
         String[] headers = { "学号", "姓名", "年龄", "性别", "出生日期" };
         List<Student> dataset = new ArrayList<Student>();
         dataset.add(new Student(1, "张三", 20, true, new Date()));
         dataset.add(new Student(2, "李四", 24, false, new Date()));
         dataset.add(new Student(3, "王五", 22, true,new Date()));
         // 测试图书
         ExportExcel<Book> ex2 = new ExportExcel<Book>();
         String[] headers2 = { "图书编号", "图书名称", "图书作者", "图书价格", "图书ISBN",
               "图书出版社", "封面图片" };
         List<Book> dataset2 = new ArrayList<Book>();
         try {
            BufferedInputStream bis = new BufferedInputStream(
                   new FileInputStream("d:\\book.jpg"));
            byte[] buf = new byte[bis.available()];
            while ((bis.read(buf)) != -1) {
               //
            }
            dataset2.add(new Book(1, "jsp", "leno", 300.33f, "1234567",
                   "清华出版社", buf));
            dataset2.add(new Book(2, "java编程思想", "brucl", 300.33f, "1234567",
                   "阳光出版社", buf));
            dataset2.add(new Book(3, "DOM艺术", "lenotang", 300.33f, "1234567",
                   "清华出版社", buf));
            dataset2.add(new Book(4, "c++经典", "leno", 400.33f, "1234567",
                   "清华出版社", buf));
            dataset2.add(new Book(5, "c#入门", "leno", 300.33f, "1234567",
                   "汤春秀出版社", buf));

           int[] mergeVaule = new int[]{0, 2, 0, 5};
           String filePath="";
            ex.exportExcel("title_abc", headers, dataset, filePath, "yyyy-mmm-dd",mergeVaule);
            ex2.exportExcel("title_abc",headers2, dataset2, filePath,"yyyy-mmm-dd",mergeVaule);
            System.out.println("开始Excel文件导出!-----EceptionExcel");
            JOptionPane.showMessageDialog(null, "导出成功!");
            System.out.println("excel导出成功!");
         } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      }
   }

压缩文件

package com.pract.poi;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class CompressedFileUtil {
    private static Logger logger =  LoggerFactory.getLogger(CompressedFileUtil.class);
	/** 
     * 默认构造函数 
     */  
    public CompressedFileUtil(){  
          
    }  
  
    /** 
     * @desc 将源文件/文件夹生成指定格式的压缩文件,格式zip 
     * @param resourePath 源文件/文件夹 
     * @param targetPath  目的压缩文件保存路径 
     * @return void 
     * @throws Exception  
     */  
    public void compressedFile(String resourePath,String targetPath) throws Exception{
        File resourcesFile = new File(resourePath);     //源文件
        File targetFile = new File(targetPath);           //目的  
        //如果目的路径不存在,则新建  
        if(!targetFile.exists()){       
            targetFile.mkdirs();    
        }

        String targetName = resourcesFile.getName()+".zip";   //目的压缩文件名  
        FileOutputStream outputStream = new FileOutputStream(targetPath+"\\"+targetName);  
        ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(outputStream));  

        createCompressedFile(out, resourcesFile, "");
        out.close();    
    }  
      
    /** 
     * @desc 生成压缩文件。 
     *               如果是文件夹,则使用递归,进行文件遍历、压缩 
     *       如果是文件,直接压缩 
     * @param out  输出流 
     * @param file  目标文件 
     * @return void 
     * @throws Exception  
     */  
    public void createCompressedFile(ZipOutputStream out, File file, String dir) throws Exception{
        //如果当前的是文件夹,则进行进一步处理  
        if(file.isDirectory()){  
            //得到文件列表信息  
            File[] files = file.listFiles();  
            //将文件夹添加到下一级打包目录  
            out.putNextEntry(new ZipEntry(dir+"/"));  
              
            dir = dir.length() == 0 ? "" : dir +"/";  
              
            //循环将文件夹中的文件打包  
            for(int i = 0 ; i < files.length ; i++){  
                createCompressedFile(out, files[i], dir + files[i].getName());         //递归处理  
            }  
        }  
        else{   //当前的是文件,打包处理  
            //文件输入流  
            FileInputStream fis = new FileInputStream(file);  
              
            out.putNextEntry(new ZipEntry(dir));  
            //进行写操作  
            int j =  0;  
            byte[] buffer = new byte[1024];  
            while((j = fis.read(buffer)) > 0){  
                out.write(buffer,0,j);  
            }  
            //关闭输入流  
            fis.close();  
        }  
    }  
      
    public static void main(String[] args){  
        CompressedFileUtil compressedFileUtil = new CompressedFileUtil();  
          
        try {  
            compressedFileUtil.compressedFile("E:\\test", "E:\\");
            logger.info("压缩文件已经生成...");
        } catch (Exception e) {  
            System.out.println("压缩文件生成失败...");  
            e.printStackTrace();  
        }  
    }  
}  

 

通过Junit 测试

package com.test;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.swing.JOptionPane;

import com.pract.constant.poiConstant;
import com.pract.poi.POIUtil;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.junit.Test;

import com.pract.poi.CompressedFileUtil;
import com.pract.poi.ExportExcel;
import com.pract.pojo.Book;
import com.pract.pojo.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class practTest {
   final  static Logger logger = LoggerFactory.getLogger(practTest.class);

   @Test
   public void test() throws Exception {
      // 第一步,创建一个webbook,对应一个Excel文件
      HSSFWorkbook wb = new HSSFWorkbook();
      //根据数据条数设置sheet表数,每个sheet表存放最多65536条数据

      // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
      HSSFSheet sheet = wb.createSheet("学生表一");

      /*sheet.addMergedRegion(new Region(0,(short)3,3,(short)9));*/
      sheet.addMergedRegion(new CellRangeAddress(0, 3, 0 , 9));

      // 第四步,创建单元格,并设置值表头 设置表头居中
      HSSFCellStyle style = wb.createCellStyle();
      style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
      style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中
      HSSFFont font = wb.createFont();
      font.setFontHeightInPoints((short) 14);//字号
      font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);//加粗
      style.setFont(font);

      // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
      HSSFRow row0 = sheet.createRow(0);
      HSSFCell cell0 = row0.createCell((short) 0);
      cell0.setCellValue("添加标题测试环境值");
      cell0.setCellStyle(style);
      HSSFRow row = sheet.createRow(5);

      HSSFCell cell = row.createCell((short) 0);
      cell.setCellValue("学号");
      cell.setCellStyle(style);
      cell = row.createCell((short) 1);
      cell.setCellValue("姓名");
      cell.setCellStyle(style);
      cell = row.createCell((short) 2);
      cell.setCellValue("年龄");
      cell.setCellStyle(style);
      cell = row.createCell((short) 3);

      cell = row.createCell(5);

      cell.setCellValue("生日");
      cell.setCellStyle(style);

      // 第五步,写入实体数据 实际应用中这些数据从数据库得到,
      //List list = CreateSimpleExcelToDisk.getStudent();

      /*for (int i = 0; i < list.size(); i++) {
         row = sheet.createRow((int) i + 6);
         Student stu = (Student) list.get(i);
         // 第四步,创建单元格,并设置值
         row.createCell((short) 0).setCellValue((double) stu.getId());
         row.createCell((short) 1).setCellValue(stu.getName());
         row.createCell((short) 2).setCellValue((double) stu.getAge());
         cell = row.createCell((short) 3);
         cell.setCellValue(new SimpleDateFormat("yyyy-mm-dd").format(stu.getBirth()));
      }*/

      // 第六步,将文件存到指定位置
      try {
         FileOutputStream fout = new FileOutputStream("D://test//students.xls");
         wb.write(fout);
         fout.close();
         System.out.println("输出结果!");
      } catch (Exception e) {
         e.printStackTrace();
      }
   }

   @Test
   public void test2() {
      // 测试学生
      ExportExcel<Student> ex = new ExportExcel<Student>();
      String[] headers = { "学号", "姓名", "年龄", "性别", "出生日期" };
      List<Student> dataset = new ArrayList<Student>();
      dataset.add(new Student(1, "张三", 20,true, new Date()));
      dataset.add(new Student(2, "李四", 24, true, new Date()));
      dataset.add(new Student(3, "王五", 22, false, new Date()));
      // 测试图书
      ExportExcel<Book> ex2 = new ExportExcel<Book>();
      String[] headers2 = { "图书编号", "图书名称", "图书作者", "图书价格", "图书ISBN", "图书出版社", "封面图片" };
      List<Book> dataset2 = new ArrayList<Book>();
      try {
         BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:\\book.jpg"));
         byte[] buf = new byte[bis.available()];
         while ((bis.read(buf)) != -1) {
            //
         }
         dataset2.add(new Book(1, "jsp", "leno", 300.33f, "1234567", "清华出版社", buf));
         dataset2.add(new Book(2, "java编程思想", "brucl", 300.33f, "1234567", "阳光出版社", buf));
         dataset2.add(new Book(3, "DOM艺术", "lenotang", 300.33f, "1234567", "清华出版社", buf));
         dataset2.add(new Book(4, "c++经典", "leno", 400.33f, "1234567", "清华出版社", buf));
         dataset2.add(new Book(5, "c#入门", "leno", 300.33f, "1234567", "汤春秀出版社", buf));

         OutputStream out = new FileOutputStream("d://test//a.xls");
         OutputStream out2 = new FileOutputStream("D://test//b.xls");
         ex.exportExcel("title——A",headers, dataset, "", "yyyy-mmm-dd", null);
         ex2.exportExcel("title——A",headers2, dataset2, "", "yyyy-mmm-dd", null);
         out.close();
         JOptionPane.showMessageDialog(null, "导出成功!");
         System.out.println("excel导出成功!");
      } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }

   @Test
   public void test3(){
      CompressedFileUtil compressedFileUtil = new CompressedFileUtil();

        try {
            compressedFileUtil.compressedFile(poiConstant.filePath, poiConstant.compressedFilePath);
         logger.info("压缩文件已经生成...");
        } catch (Exception e) {
         logger.info("压缩文件生成失败...");
            e.printStackTrace();
        }
   }

   @Test
   public void test4(){
      POIUtil poi = new POIUtil();
      String sheetTitle = "测试图标";
      int[] mergeVaule = new int[]{0, 2, 0, 5};
      String[] headers = { "学号", "姓名", "年龄", "性别", "出生日期" };
      List<Student> dataList = new ArrayList<Student>();
      dataList.add(new Student(1, "张三", 20,false, new Date()));
      dataList.add(new Student(2, "李四", 24, true, new Date()));
      dataList.add(new Student(3, "王五", 22, true, new Date()));

      ExportExcel ep = new ExportExcel();
      ep.exportExcel("title_abc", headers, dataList, "D:\\test\\", "yyyy-mmm-dd",mergeVaule);
      System.out.println("导出数据到Excel中");
            //.exportExcel(sheetTitle, mergeVaule, headers, dataList, "yyyy-mm-dd");
   }
}

打赏

文件名:poi_excel_compress.rar,文件大小:15.795K下载
  • /
      • /pratice
        • /pratice/.classpath
        • /pratice/.project
          • /pratice/.settings
            • /pratice/.settings/.jsdtscope
            • /pratice/.settings/org.eclipse.jdt.core.prefs
            • /pratice/.settings/org.eclipse.m2e.core.prefs
            • /pratice/.settings/org.eclipse.wst.common.component
            • /pratice/.settings/org.eclipse.wst.common.project.facet.core.xml
            • /pratice/.settings/org.eclipse.wst.jsdt.ui.superType.container
            • /pratice/.settings/org.eclipse.wst.jsdt.ui.superType.name
        • /pratice/com.test.pra.iml
顶部客服微信二维码底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友