poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55275] HSSF - createCellComment seems limited to 1000 cell comments by sheet
Date Wed, 17 Jul 2013 12:34:39 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=55275

nb <truciops@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from nb <truciops@gmail.com> ---
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

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


Mime
View raw message