public class DataCell extends 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
跨行数
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterCellRender(Object cell)
回调实现此方法,在POI的cell生成以后触发,可以对Cell进行个性化操作。
|
int |
getColSpan() |
String |
getContent() |
int |
getRowSpan() |
int |
getType() |
void |
setColSpan(int colSpan) |
void |
setContent(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(String content)
public DataCell(String content, int type)
public DataCell()
public String getContent()
public void setContent(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(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对象CellCopyright © 2016–2017. All rights reserved.