作者:乔山办公网日期:
返回目录:excel表格制作
while(rs.next()){
row=sheet.createRow(++rowindex);
for(int cellindex=0;cellindex<head.size();cellindex++){
cell=row.createCell((short)cellindex);
datas=rs.getString(cellindex);
XSSFRichTextString richString = new XSSFRichTextString(datas == null ? "" :datas);
cell.setCellValue(richString.toString());
}
}
刚没看清楚,现在看明白zhidao了。你应专该用while循环来创建行属,for循环创建列。
两个原因:
1.你的excel模版本身有问题,可以尝试新建一个模版。
2.你的excel使用了一些POI不支持的函数。
解决办法:
另存是由excel重写了完整的文件,可以解决问题。
关闭文件例子:
FileOutputStream os = new FileOutputStream("workbook.xls");
wb.write(os);
os.close();
每一行的开头都给加上copy一个空白的单元格,这样第一列不就是空白么zhidao
HSSFCell cell0 = row.createCell((short) 0);
cell0.setCellStyle(style);
cell0.setCellValue(“ ”);
只需要将数据添加到excel中?
---------------------
能详细举例吗?这样不是很明白。