如何格式化POI HSSF一列,而不是细胞 [英] How to format a column instead of cell in POI hssf
问题描述
我打开一个excel数百/数千个数据,行的太多不同的单元格格式
文件时所面临的一个问题有关错误的结果更多信息
的http://excelzoom.com/2009/09/the-mystery-of-excels-too-many-different-cell-formats/
所以我试图格式化列不是一个单元格。我可以找出如何格式化列的唯一方法是通过在格式化每个细胞;通过实施下列code。我想格式化列,而不是一行。我有上百个/千行数据进行格式化。任何建议将非常AP preciated。
谢谢,
HSSFCellStyle cellStyle = wb.createCellStyle();
HSSFDataFormat DATAFORMAT = wb.createDataFormat();
cellStyle.setDataFormat(dataFormat.getFormat(0.00));HSSFRow行= sheet.createRow(iRow);
HSSFCell细胞= row.createCell((短)1);
cell.setCellStyle(cellStyle);
在这里找到了答案
http://poi.apache.org/faq.html#faq-N100EF 进入栏目
- 我创造当POI的工作簿,但Excel的拒绝打开该文件,抱怨太多的样式使用样式。
山姆
I'm facing an issue when opening a excel file with hundreds/thousands of rows of data, "Too Many Different Cell Formats"
More info about the error
http://excelzoom.com/2009/09/the-mystery-of-excels-too-many-different-cell-formats/
So I'm trying to format a column not a cell. The only way I can figure out how to format a column is by formating each individual cell; by implementing the code listed below. I would like to format a column instead of a row. I have hundreds/thousands of rows of data to format. Any suggestions would be very much appreciated.
Thanks,
HSSFCellStyle cellStyle = wb.createCellStyle();
HSSFDataFormat dataFormat = wb.createDataFormat();
cellStyle.setDataFormat(dataFormat.getFormat("0.00"));
HSSFRow row = sheet.createRow(iRow);
HSSFCell cell = row.createCell((short)1);
cell.setCellStyle(cellStyle);
Found the answer here
http://poi.apache.org/faq.html#faq-N100EF go to the section
- I am using styles when creating a workbook in POI, but Excel refuses to open the file, complaining about "Too Many Styles".
Sam
这篇关于如何格式化POI HSSF一列,而不是细胞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!