poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nilay Shah" <ns...@sunshinesys.com>
Subject RE: Too many cell formats
Date Tue, 28 Jan 2003 15:43:32 GMT
I've had this problem before also. The problem is you are creating a new
cell style
for each cell. If you want all but the first rows to have the same cell
style, just do this:




HSSFSheet sheet = workbook.createSheet();

HSSFCellStyle cellStyle = wb.createCellStyle();

cellStyle.setWrapText(true);

for (short rowIter = startRow; rowIter <= bottomRow; rowIter++){
	row = sheet.createRow(rowIter);

	for (short colIter = leftMostColumn; colIter <= rightMostColumn;
colIter++){
		cell = row.createCell(colIter);
		cell.setCellStyle(style);
	}
}

-----Original Message-----
From: D. Alvarado [mailto:laredotornado@coolgoose.com]
Sent: Monday, January 27, 2003 12:05 PM
To: poi-dev@jakarta.apache.org
Subject: Too many cell formats


Hi,

I have generated a particularly large Excel document and when
I try to open it, I get the message "Too many cell formats."
Aside from the first row, I want all subsequent rows to have
the same cell style.  Currently, I'm making this call to
every cell:

HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);

Is there some way I can set up a default cell style so I
won't always have to invoke this code and thus, might prevent
the "Too many cell formats" error?

Thanks in advance, Dave

--
To unsubscribe, e-mail:
<mailto:poi-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:poi-dev-help@jakarta.apache.org>


Mime
View raw message