类 ExcelBigExport

java.lang.Object
com.sh.common.util.ExportBase
com.sh.common.util.ExcelBigExport

public class ExcelBigExport extends ExportBase

Description: Excel文件处理工具类,分页导出,防止内存溢出,同时导出速度较慢

Title:首亨软件

Company:首亨软件(重庆)有限公司

  • 字段详细资料

    • log4j

      protected org.apache.logging.log4j.Logger log4j
    • EXPORT_PAGE_ROWS

      public static int EXPORT_PAGE_ROWS
  • 构造器详细资料

    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, File file, String sql, String[] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, OutputStream outputStream, String sql, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String sql, String[] excelTitle, String[] excelCols)
      构造函数
      参数:
      dc - 数据中心
      request - HttpServletRequest
      response - HttpServletResponse
      sql - 导出SQL
      excelTitle - EXCEL中标题行
      excelCols - 每列对应DS中的列名
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, File file, String sql, String[][] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, OutputStream outputStream, String sql, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String sql, String[][] excelTitle, String[] excelCols)
      构造函数
      参数:
      dc - 数据中心
      request - HttpServletRequest
      response - HttpServletResponse
      sql - 导出SQL
      excelTitle - EXCEL中标题行
      excelCols - 每列对应DS中的列名
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, File file, String sql, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, OutputStream outputStream, String sql, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String sql, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols)
      构造函数
      参数:
      dc - 数据中心
      request - HttpServletRequest
      response - HttpServletResponse
      sql - 导出SQL
      colsType - 查询参数类型
      obj - 查询参数
      excelTitle - EXCEL中标题行
      excelCols - 每列对应DS中的列名
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, File file, String sql, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, OutputStream outputStream, String sql, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(DataCenter dc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String sql, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols)
      构造函数
      参数:
      dc - 数据中心
      request - HttpServletRequest
      response - HttpServletResponse
      sql - 导出SQL
      colsType - 查询参数类型
      obj - 查询参数
      excelTitle - EXCEL中标题行
      excelCols - 每列对应DS中的列名
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, File file, String[] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, OutputStream outputStream, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, File file, String[][] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, OutputStream outputStream, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, File file, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, OutputStream outputStream, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String[] colsType, Object[] obj, String[] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, File file, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols) throws Exception
      抛出:
      Exception
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, OutputStream outputStream, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(Datastore ds, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String[] colsType, Object[] obj, String[][] excelTitle, String[] excelCols)
    • ExcelBigExport

      public ExcelBigExport(OutputStream outputStream)
    • ExcelBigExport

      public ExcelBigExport(jakarta.servlet.http.HttpServletResponse response)
  • 方法详细资料

    • setCharset

      public void setCharset(String charset)
      设置编码
      参数:
      charset - String
    • setColumnWidth

      public void setColumnWidth(int col, int width)
      设置宽度
      参数:
      col - 列号 从0开始
      width - 宽度
    • createSheet

      public void createSheet(int rows)
      创建sheet
      参数:
      rows - int
    • doExport

      public void doExport() throws Exception
      抛出:
      Exception
    • doExport

      public void doExport(String fileName) throws Exception
      执行导出操作
      参数:
      fileName - 导出文件名
      抛出:
      Exception - Exception
    • mergeHeaderCells

      public void mergeHeaderCells(ExcelMerge mergeCell)
      合并表头单元格
      参数:
      mergeCell - ExcelMerge
    • mergeHeaderCells

      public void mergeHeaderCells(int col1, int row1, int col2, int row2)
      设置合并单元格
      参数:
      col1 - 起始单元格列号
      row1 - 起始单元格行号
      col2 - 结束单元格列号
      row2 - 结束单元格行号
    • getDc

      public DataCenter getDc()
    • setCellStyle

      public void setCellStyle(ExcelBigCellStyle style)
      设置单元格样式
      参数:
      style - ExcelBigCellStyle
    • addCell

      public void addCell(ExcelCell cell)