Bug 55275 - HSSF - createCellComment seems limited to 1000 cell comments by sheet
Summary: HSSF - createCellComment seems limited to 1000 cell comments by sheet
Status: RESOLVED DUPLICATE of bug 56380
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 55025 56852 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-17 11:15 UTC by nb
Modified: 2015-03-11 20:12 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nb 2013-07-17 11:15:35 UTC
hello,

It seems there is a limitation (approximately 1 000) of the number of 'cell comments' on a sheet with POI-Excel.

But why ? 
With OpenOffice, and Excel, we can, manually, more than 1 000. 
So can we make more, cell comment on a sheet, than 1 000 ? Like 3 000-4 000 :)

Regards
Comment 1 Nick Burch 2013-07-17 11:18:38 UTC
What happens if you try to add more? Does POI object? Office? OpenOffice? Can you write a unit test that shows the issue? Does the limit change from file to file? Does it vary based on the length of text in the comment?

If you create several thousand comments in Excel or OpenOffice, does it use a different kind of record/records to what POI does? (BiffViewer may help you work that out)
Comment 2 nb 2013-07-17 12:34:39 UTC
Hello,

If i try to add more : there is only the last comments on my sheet. :'(

See below my little test to view that it's not fine :

import java.awt.Desktop;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

public class truc {

	private static File FILERESULT;
	
	private Workbook ExcelPlanDeTravail;
	//private CreationHelper ExcelPlanDeTravailFactory;
	private Sheet mafeuille;
	private Row laligne;
	private Cell lecellule;
	private ClientAnchor commentairepanel;
	private Drawing commentairedessin;
	
public truc(){
	try{
	//============================================
    ////////////// - \\\\\\\\\\\\\\\\
    //============================================
	FILERESULT = File.createTempFile("ExtractXLS",".xls");
 	FILERESULT.deleteOnExit();

 	//============================================
    ////////////// - \\\\\\\\\\\\\\\\
    //============================================
	ExcelPlanDeTravail = new HSSFWorkbook();
	mafeuille = ExcelPlanDeTravail.createSheet("test");
	//ExcelPlanDeTravailFactory = ExcelPlanDeTravail.getCreationHelper();
	
	
	if(commentairedessin==null){	    
    	commentairedessin = mafeuille.createDrawingPatriarch();
    }
	
	
	int m = 1;
	for (int i=0;i<30;i++){
	
		laligne = mafeuille.createRow(i);
	
		for (int u=0;u<50;u++){
			
			lecellule = laligne.createCell(u);
     		lecellule.setCellValue(m);
			setCellComment(lecellule, i+"="+u);
			m++;
		}
	
	}
	
	
	
	} catch (Exception monerreur) {
		monerreur.printStackTrace();
	} finally {
		try {
			FileOutputStream fichiersorti = new FileOutputStream(FILERESULT.getAbsolutePath());
			ExcelPlanDeTravail.write(fichiersorti);
			fichiersorti.close();
		} catch (Exception monerreur) {
			monerreur.printStackTrace();
		} finally {
		    //============================================
		    ////////////// OUVERTURE FICHIER \\\\\\\\\\\\\\
		    //============================================
		    if(FILERESULT.exists()==true){
		    	if(Desktop.isDesktopSupported()){
		    		if(Desktop.getDesktop().isSupported(java.awt.Desktop.Action.OPEN)){
		    		try {
		    			Desktop.getDesktop().open(new File(FILERESULT.getAbsoluteFile().toString()));
		    		 
		    		} catch (IOException monerreur) {
		    			//
		    		}
		    		} else {
		    			//
		    		}
		    	}else {
		    		//
			    	}
		    }
		}
	}
	
}
protected void setCellComment(Cell cell, String message) {
	commentairepanel = ExcelPlanDeTravail.getCreationHelper().createClientAnchor();
	commentairepanel.setCol1(lecellule.getColumnIndex() + 2);
	commentairepanel.setCol2(lecellule.getColumnIndex() + 9);
	commentairepanel.setRow1(lecellule.getRowIndex() + 2);
	commentairepanel.setRow2(lecellule.getRowIndex() + 9);
	
	Comment comment = commentairedessin.createCellComment(commentairepanel);
	RichTextString str = ExcelPlanDeTravail.getCreationHelper().createRichTextString(message);
	comment.setString(str);
	comment.setAuthor(System.getProperty("user.name"));

	cell.setCellComment(comment);
}
	
	
}

Rgds
Comment 3 zhibin fang 2014-08-14 06:59:55 UTC
hello,

Our project will need to import the excel for some data init. cell will be added the comment about the reasons of error, so there may be add more than 1024 comments, but will only display the last 1024.

Regards
Comment 4 daniele.renda 2015-03-11 18:30:49 UTC
There is some news about this limitation?
Comment 5 Dominik Stadler 2015-03-11 20:07:37 UTC
*** Bug 56852 has been marked as a duplicate of this bug. ***
Comment 6 Dominik Stadler 2015-03-11 20:10:43 UTC
*** Bug 55025 has been marked as a duplicate of this bug. ***
Comment 7 Dominik Stadler 2015-03-11 20:12:35 UTC
There is actually bug 56380 which reports the same and has some more discussion already together with a unit test, therefore resolving this as duplicate.

*** This bug has been marked as a duplicate of bug 56380 ***