You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by yuzhenling <yu...@gmail.com> on 2011/07/06 08:14:41 UTC

RE: trying to remove some comments from a cell

hello,
 i use poi-3.2-FINAL-20081019.jar, has same problem.
  when i upload one excel file, write comment on some cell with this excel
and download,then modify cell content where it have comment ,and now the
comment is not be remove .so try again to upload this excel has been
modified. then : java.lang.NullPointerException
	at
org.apache.poi.hssf.usermodel.HSSFCell.findCellComment(HSSFCell.java:1021)
	at org.apache.poi.hssf.usermodel.HSSFCell.getCellComment(HSSFCell.java:952)
	at com.**.util.xls.ExcelCellClear.clearComments(ExcelCellClear.java:35)

java src:for(Iterator<HSSFCell> cellIt = row.cellIterator();
cellIt.hasNext();){
			HSSFCell cell = cellIt.next();
			if(cell != null ){
				if(cell.getCellComment() != null){
					cell.setCellComment(null);
				}
				
			}
		}

i debug with program, when 'if(cell != null ){'   cell is not null and it go
'if(cell.getCellComment() != null){' but 
at 'if(cell.getCellComment() != null){' throw java.lang.NullPointerException
,so ...could you give me some method to resolve this problem ,thank you very
much . my english is poor ,sorry please never mind
.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/trying-to-remove-some-comments-from-a-cell-tp3389606p4555846.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org