cs_coltman
Messages postés97Date d'inscriptionjeudi 3 janvier 2008StatutMembreDernière intervention10 février 2009
-
2 févr. 2009 à 15:28
pikapote
Messages postés66Date d'inscriptionlundi 13 mars 2006StatutMembreDernière intervention11 mars 2014
-
3 août 2010 à 13:41
Bonjour,
J'ai un petit souci avec JExcel. J'ai une
java.lang.ClassCastException: jxl.biff.EmptyCell cannot be cast to jxl.write.Label
à la ligne où il y a :
Code :
Label cat_lbl = (Label) cat_cell;
je ne comprend pas pourquoi il me fait ca vu que je suis à la lettre la doc fournie avec l'API; voici mon code :
public String xlssourcepath = null;
public String xlssourcedestination=null;
public boolean success=false;
private int nbelements=0;
public Workbook sourcedoc=null;
public WritableWorkbook destdoc=null;
private WritableSheet worksheet=null;
public boolean proceedconfirmation=true;
private int i=0;
private boolean initialize(DefaultMutableTreeNode node, int i) throws IOException, WriteException { //this method initializes the xls report by writing the first line that corresponds to the titles of the columns in the document
if (proceedconfirmation) {
Integer level=this.i+1;
String levelmsg=level.toString();
switch (level) {
case 1 : levelmsg="first"; break;
case 2 : levelmsg="second"; break;
case 3 : levelmsg="third"; break;
default : levelmsg+="th";
}
int response = JOptionPane.showConfirmDialog(null, "Please select a name for your column ","XLS Generator",JOptionPane.OK_CANCEL_OPTION);
if (response==JOptionPane.OK_OPTION) {
if (node.getChildAt(0).isLeaf()==false) {
String generalcategory = JOptionPane.showInputDialog(null,"Name for the column");
JOptionPane.showMessageDialog(null, "The xls won't be generated");
this.proceedconfirmation=false;
}
}
return proceedconfirmation;
}
}
juste pour info : cette classe me permet en fait de reproduire la hierarchie d'un jtree dans un fichier excel ... j'en suis qu'au début j'ai pas encore fini l'algo mais là ca coince deja comme vous le voyez ...
cs_coltman
Messages postés97Date d'inscriptionjeudi 3 janvier 2008StatutMembreDernière intervention10 février 2009 2 févr. 2009 à 19:29
j'ai resolu ce souci d'exception c'etait simplement une erreur bete : par oubli j'ai mis deux fois mondoc.write() au lieu de faire mondoc.write() et mondoc.close()
par contre j'ai un autre souci est-ce que vous pouvez m'aider à y voir plus clair :