row = sheet.createRow(0); // 建立新行
// 显示标题列名�?
for (int i = 0; i < pShowKeys.length; i++) {
cell = row.createCell(i); // 建立新cell
// cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(new HSSFRichTextString(pShowKeys[i]));
}
// 逐行取数�?
int rowId = 1;// 数据行号(从�?2行开始填充数�?)
for (Iterator<T> iter = list.iterator(); iter.hasNext(); rowId++) {
row = sheet.createRow(rowId); // 建立新行
T obj = iter.next();
// 生成每一
for (int i = 0; i < pKeys.length; i++) {
cell = row.createCell(i); // 建立新cell
cellVal = exporter.getPropertyValue(obj, pKeys[i]);
// cell.setEncoding(HSSFCell.ENCODING_UTF_16);
String cellValue = "";
if (null != cellVal) {
cellValue = cellVal.toString();
}
if (cellVal instanceof Float) {
cellValue = numberformat.format(cellVal);
}
cell.setCellValue(new HSSFRichTextString(cellValue));
}
}
return wb;
}