public class CommonsUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Integer |
MAX_ROWSUM |
static Integer |
MAX_ROWSYTLE |
| 构造器和说明 |
|---|
CommonsUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
createFreezePane(org.apache.poi.xssf.streaming.SXSSFSheet sxssfSheet,
Integer row)
功能描述: 锁定行(固定表头)
参数说明:
HashMap setPaneMap = new HashMap();
//第一个表格、第三行开始固定表头
setPaneMap.put(1,3);
|
static boolean |
isBlank(String str)
判断字符串是否为空
|
static void |
setBorder(org.apache.poi.ss.usermodel.CellStyle cellStyle,
Boolean isBorder)
功能描述:设置边框
|
static void |
setColumnWidth(org.apache.poi.xssf.streaming.SXSSFSheet sxssfSheet,
HashMap map)
功能描述: 自定义列宽
参数说明:
HashMap
|
static void |
setDataList(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<String[]>> dataLists,
HashMap notBorderMap,
HashMap regionMap,
HashMap columnMap,
HashMap styles,
HashMap paneMap,
String[] sheetName,
String[] labelName,
HashMap rowStyles,
HashMap columnStyles,
HashMap dropDownMap)
设置数据:有样式(行、列、单元格样式)
|
static void |
setDataListNoStyle(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<String[]>> dataLists,
HashMap notBorderMap,
HashMap regionMap,
HashMap columnMap,
HashMap paneMap,
String[] sheetName,
String[] labelName,
HashMap dropDownMap)
设置数据:无样式(行、列、单元格样式)
|
static void |
setDataValidation(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
List<String[]> dropDownListData,
int dataListSize)
功能描述:下拉列表
参数说明:
HashMap dropDownMap = new HashMap();
List
|
static void |
setDataValidation(org.apache.poi.xssf.streaming.SXSSFSheet xssfWsheet,
String[] list,
Integer firstRow,
Integer lastRow,
Integer firstCol,
Integer lastCol)
功能描述:下拉列表
|
static void |
setExcelRowStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<Object[]> rowstyleList,
int rowIndex) |
static void |
setExcelStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
Integer fontSize,
Boolean bold,
Boolean center,
Boolean isBorder,
Boolean leftBoolean,
Boolean rightBoolean,
Integer fontColor,
Integer height) |
static void |
setExcelStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<Object[]>> styles,
int cellIndex,
int rowIndex)
功能描述:所有自定义单元格样式
使用的方法:是否居中?
|
static void |
setLabelStyles(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow)
大标题样式
|
static void |
setMergedRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
ArrayList<Integer[]> rowColList)
功能描述: excel 合并单元格
参数说明:
List
|
static void |
setMergedRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
int firstRow,
int lastRow,
int firstCol,
int lastCol)
功能描述: 合并单元格
|
static void |
setStyle(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.usermodel.XSSFFont font)
默认样式
|
static String |
strToDateFormat(String strDate,
String style,
String expectDateFormatStr) |
static boolean |
verificationDate(String strDate,
String style)
验证是否是日期
|
static void |
writeAndColse(org.apache.poi.xssf.streaming.SXSSFWorkbook sxssfWorkbook,
OutputStream outputStream) |
public static final Integer MAX_ROWSUM
public static final Integer MAX_ROWSYTLE
public static void setDataList(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<String[]>> dataLists,
HashMap notBorderMap,
HashMap regionMap,
HashMap columnMap,
HashMap styles,
HashMap paneMap,
String[] sheetName,
String[] labelName,
HashMap rowStyles,
HashMap columnStyles,
HashMap dropDownMap)
throws Exception
sxssfRow - dataLists - notBorderMap - regionMap - columnMap - styles - paneMap - sheetName - labelName - rowStyles - columnStyles - dropDownMap - Exceptionpublic static void setExcelStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
Integer fontSize,
Boolean bold,
Boolean center,
Boolean isBorder,
Boolean leftBoolean,
Boolean rightBoolean,
Integer fontColor,
Integer height)
cell - Cell对象。wb - SXSSFWorkbook对象。fontSize - 字体大小。bold - 是否加粗。center - 是否左右上下居中。isBorder - 是否加边框leftBoolean - 左对齐rightBoolean - 右对齐height - 行高public static void setExcelRowStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<Object[]> rowstyleList,
int rowIndex)
public static void setDataListNoStyle(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<String[]>> dataLists,
HashMap notBorderMap,
HashMap regionMap,
HashMap columnMap,
HashMap paneMap,
String[] sheetName,
String[] labelName,
HashMap dropDownMap)
throws Exception
wb - sxssfRow - dataLists - notBorderMap - regionMap - columnMap - paneMap - sheetName - labelName - dropDownMap - Exceptionpublic static void writeAndColse(org.apache.poi.xssf.streaming.SXSSFWorkbook sxssfWorkbook,
OutputStream outputStream)
throws Exception
Exceptionpublic static void setExcelStyles(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow,
List<List<Object[]>> styles,
int cellIndex,
int rowIndex)
cell - wb - styles - public static void setLabelStyles(org.apache.poi.xssf.streaming.SXSSFWorkbook wb,
org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.xssf.streaming.SXSSFRow sxssfRow)
wb - cell - sxssfRow - public static void setStyle(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.xssf.usermodel.XSSFFont font)
cellStyle - font - public static boolean isBlank(String str)
str - public static void createFreezePane(org.apache.poi.xssf.streaming.SXSSFSheet sxssfSheet,
Integer row)
sxssfSheet - row - public static void setColumnWidth(org.apache.poi.xssf.streaming.SXSSFSheet sxssfSheet,
HashMap map)
sxssfSheet - map - public static void setMergedRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
ArrayList<Integer[]> rowColList)
sheet - rowColList - public static void setMergedRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
int firstRow,
int lastRow,
int firstCol,
int lastCol)
sheet - firstRow - lastRow - firstCol - lastCol - public static void setDataValidation(org.apache.poi.xssf.streaming.SXSSFSheet sheet,
List<String[]> dropDownListData,
int dataListSize)
sheet - dropDownListData - dataListSize - public static void setDataValidation(org.apache.poi.xssf.streaming.SXSSFSheet xssfWsheet,
String[] list,
Integer firstRow,
Integer lastRow,
Integer firstCol,
Integer lastCol)
xssfWsheet - list - firstRow - lastRow - firstCol - lastCol - public static void setBorder(org.apache.poi.ss.usermodel.CellStyle cellStyle,
Boolean isBorder)
cellStyle - isBorder - public static boolean verificationDate(String strDate, String style)
strDate - Copyright © 2019. All rights reserved.