public final class ExcelUtils extends Object
| 构造器和说明 |
|---|
ExcelUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addCustomValid(String formula,
org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent)
Add custom validation when export
|
static void |
addDateValid(OperatorType operatorType,
String expr1,
String expr2,
String pattern,
org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent,
boolean showTip,
String tipTitle,
String tipContent)
Add date validation when export
|
static void |
addDropdownBox(String[] combobox,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent,
org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
String[] values)
Add a dropdown box when export
|
static void |
addNumericValid(ValidType validType,
OperatorType operatorType,
String expr1,
String expr2,
org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent,
boolean showTip,
String tipTitle,
String tipContent)
Add numeric validation when export,
|
static void |
addRepeatValid(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent,
boolean longTextNumber)
Add repeat validation when export
|
static org.apache.poi.ss.usermodel.Font |
createFont(org.apache.poi.ss.usermodel.Workbook workbook)
Create a font
|
static String |
createFormula(String suffix,
int firstColIndex,
int firstRowIndex,
int lastColIndex,
int lastRowIndex)
Create a formula
|
static org.apache.poi.ss.usermodel.Hyperlink |
createLink(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.common.usermodel.HyperlinkType type)
Create hyper link
|
static org.apache.poi.ss.usermodel.RichTextString |
createRichText(org.apache.poi.ss.usermodel.Workbook workbook,
String content)
Create rich text string
|
static String |
createSumFormula(int firstColIndex,
int firstRowIndex,
int lastColIndex,
int lastRowIndex)
Create a sum formula
|
static org.apache.poi.ss.util.CellRangeAddress |
getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
int index)
Get cell range address object
|
static boolean |
isMerge(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
Determines whether a cell has been merged
|
static void |
merge(org.apache.poi.ss.usermodel.Sheet sheet,
int firstCol,
int lastCol,
int firstRow,
int LastRow)
Merge cells
|
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value)
Set cell value
|
public static void setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value)
cell - Current cellvalue - Attribute valuespublic static void addDropdownBox(String[] combobox, boolean showErrorBox, Rank errorBoxRank, String errorTitle, String errorContent, org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, int firstRow, int lastRow, int colIndex, String[] values)
combobox - Dropdown box content of 25 or lessshowErrorBox - Whether show error boxerrorBoxRank - Error box rankerrorTitle - Error box titleerrorContent - Error box valueworkbook - Current workbooksheet - Current sheetfirstRow - Start rowlastRow - End rowcolIndex - Column indexvalues - The dropdown box can be large, but if it's version 07, it's limited by the window size in the Excel annotationExcelpublic static void addDateValid(OperatorType operatorType, String expr1, String expr2, String pattern, org.apache.poi.ss.usermodel.Sheet sheet, int firstRow, int lastRow, int colIndex, boolean showErrorBox, Rank errorBoxRank, String errorTitle, String errorContent, boolean showTip, String tipTitle, String tipContent)
operatorType - operatorTypeexpr1 - Date expression 1, such as: 2019-12-12expr2 - Date expression 2(Only operation types between and notBetween are required),such as:2019-12-24pattern - Date patternsheet - Current sheetfirstRow - Start rowlastRow - End rowcolIndex - Column indexshowErrorBox - Whether show error boxerrorBoxRank - Error box rankerrorTitle - Error box titleerrorContent - Error box valueshowTip - Whether show tiptipContent - Tip contenttipTitle - Tip titlepublic static void addNumericValid(ValidType validType, OperatorType operatorType, String expr1, String expr2, org.apache.poi.ss.usermodel.Sheet sheet, int firstRow, int lastRow, int colIndex, boolean showErrorBox, Rank errorBoxRank, String errorTitle, String errorContent, boolean showTip, String tipTitle, String tipContent)
validType - validTypeoperatorType - operatorTypeexpr1 - Expression 1, such as: 1expr2 - Expression 2(Only operation types between and notBetween are required),such as:2sheet - Current sheetfirstRow - Start rowlastRow - End rowcolIndex - Column indexshowErrorBox - Whether show error boxerrorBoxRank - Error box rankerrorTitle - Error box titleerrorContent - Error box valueshowTip - Whether show tiptipContent - Tip contenttipTitle - Tip titlepublic static void addRepeatValid(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int colIndex,
boolean showErrorBox,
Rank errorBoxRank,
String errorTitle,
String errorContent,
boolean longTextNumber)
sheet - Current sheetfirstRow - Start rowlastRow - End rowcolIndex - Column indexshowErrorBox - Whether show error boxerrorBoxRank - Error box rankerrorTitle - Error box titleerrorContent - Error box valuelongTextNumber - Whether is long text numberpublic static void addCustomValid(String formula, org.apache.poi.ss.usermodel.Sheet sheet, int firstRow, int lastRow, int colIndex, boolean showErrorBox, Rank errorBoxRank, String errorTitle, String errorContent)
formula - Check formulasheet - Current sheetfirstRow - Start rowlastRow - End rowcolIndex - Column indexshowErrorBox - Whether show error boxerrorBoxRank - Error box rankerrorTitle - Error box titleerrorContent - Error box valuepublic static void merge(org.apache.poi.ss.usermodel.Sheet sheet,
int firstCol,
int lastCol,
int firstRow,
int LastRow)
sheet - Current sheetfirstCol - First column indexlastCol - last column indexfirstRow - First row indexLastRow - Last row indexpublic static org.apache.poi.ss.util.CellRangeAddress getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
int index)
sheet - Current sheetindex - address index, start of 0public static String createSumFormula(int firstColIndex, int firstRowIndex, int lastColIndex, int lastRowIndex)
firstColIndex - Which column startfirstRowIndex - Which row startlastColIndex - Which column endlastRowIndex - Which row endpublic static String createFormula(String suffix, int firstColIndex, int firstRowIndex, int lastColIndex, int lastRowIndex)
suffix - Formula suffixfirstColIndex - Which column startfirstRowIndex - Which row startlastColIndex - Which column endlastRowIndex - Which row endpublic static org.apache.poi.ss.usermodel.Font createFont(org.apache.poi.ss.usermodel.Workbook workbook)
workbook - workbookpublic static org.apache.poi.ss.usermodel.RichTextString createRichText(org.apache.poi.ss.usermodel.Workbook workbook,
String content)
workbook - workbookcontent - Rich text contentpublic static org.apache.poi.ss.usermodel.Hyperlink createLink(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.common.usermodel.HyperlinkType type)
workbook - workbooktype - link typepublic static boolean isMerge(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
sheet - Current sheetrow - Current row numbercolumn - current column numberCopyright © 2021. All rights reserved.