public class DataCell
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
colSpan
跨列数
|
static int |
DATA_TYPE_BLANK |
static int |
DATA_TYPE_DATE |
static int |
DATA_TYPE_DATETIME |
static int |
DATA_TYPE_INTEGER |
static int |
DATA_TYPE_INTEGER_Thousandth |
static int |
DATA_TYPE_NUMERIC |
static int |
DATA_TYPE_NUMERIC_Thousandth |
static int |
DATA_TYPE_PERCENT |
static int |
DATA_TYPE_TEXT |
protected int |
rowSpan
跨行数
|
| 构造器和说明 |
|---|
DataCell() |
DataCell(java.lang.String content) |
DataCell(java.lang.String content,
int type) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterCellRender(java.lang.Object cell)
回调实现此方法,在POI的cell生成以后触发,可以对Cell进行个性化操作。
|
int |
getColSpan() |
java.lang.String |
getContent() |
int |
getRowSpan() |
int |
getType() |
void |
setColSpan(int colSpan) |
void |
setContent(java.lang.String _content) |
void |
setRowSpan(int rowSpan) |
void |
setType(int type) |
public static final int DATA_TYPE_NUMERIC
public static final int DATA_TYPE_TEXT
public static final int DATA_TYPE_BLANK
public static final int DATA_TYPE_DATE
public static final int DATA_TYPE_DATETIME
public static final int DATA_TYPE_INTEGER
public static final int DATA_TYPE_PERCENT
public static final int DATA_TYPE_NUMERIC_Thousandth
public static final int DATA_TYPE_INTEGER_Thousandth
protected int colSpan
protected int rowSpan
public DataCell(java.lang.String content)
public DataCell(java.lang.String content,
int type)
public DataCell()
public java.lang.String getContent()
public void setContent(java.lang.String _content)
public int getType()
public void setType(int type)
public int getColSpan()
public void setColSpan(int colSpan)
public int getRowSpan()
public void setRowSpan(int rowSpan)
public void afterCellRender(java.lang.Object cell)
DataCell dataCell=new DataCell(head.getDisplay()){
public void afterCellRender(Object cell) {
org.apache.poi.ss.usermodel.Cell c = (org.apache.poi.ss.usermodel.Cell)cell;
Workbook workbook = cell.getSheet().getWorkbook();
DataFormat df = workbook.createDataFormat();
short format = df.getFormat("#,##0.000");
CellStyle style = workbook.createCellStyle();
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setHidden(true);
style.setWrapText(true);
style.setDataFormat(format);
cell.setCellStyle(style);
}
};
cell - POI的cell对象Cell