1. 代码
package com.base.pf.common.util;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import com.base.pf.base.util.StringUtils;
/**
* 通用导出EXCEL类
*
* @author ZHEN.L
* @date 2014.09.04
*
*/
public class ExcelUtils {
/**
* EXCEL导出标记
*/
public static final String EXCEL_EXP_TAG = "Excel.exp";
/**
* Excel导出标记值
*/
public static final String EXCEL_EXP_TAG_VALUE = "excel";
/**
* 导出EXCLE名称
*/
public static final String EXCEL_FILE_NAME = "Excel.fileName";
/**
* 导出excle模板名称
*/
public static final String EXCEL_TEMPLATE_NAME = "Excel.templateName";
/**
* 导出字段:有顺序,以逗号隔开(注:字段名称要和dto属性名称或者map中的key值相同)
*/
public static final String EXCEL_FIELD = "Excel.field";
/**
* 在EXCEL中,开始写记录的行号;从0开始计数
*/
public static final String EXCEL_START_ROW_NAME = "Excel.startRow";
// 导出excel模板的相对路径
protected static final String EXCEL_TEMPLATE_PATH = "\\page\\project\\template_excel\\";
/**
* 导出EXCEL
*
* @param re