Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
All,
I am working on a Jlink tool to replace formats. I have most of it figured out but when I read tables and run into an empty cell the program ends with out finishing. It does not die it just acts like it is done. I have not been able to figure out how to find out if the cell is empy or not. It seems like it cannot get past the call to create a stringseq of the table cell created. Any help would be appreciated. Thanks.
Hi Steve,
I use this code to find out whats in there.
stringseq full = tbl.GetText(pfcTable.TableCell_Create(Integer.parseInt(cellrow), Integer.parseInt(cellcol)), ParamMode.DWGTABLE_FULL);
stringseq norm = tbl.GetText(pfcTable.TableCell_Create(Integer.parseInt(cellrow), Integer.parseInt(cellcol)), ParamMode.DWGTABLE_NORMAL);
StringBuilder fulls = new StringBuilder(); //NOI18N
StringBuilder norms = new StringBuilder(); //NOI18N
par.writeLog(number + " " + full.getarraysize()); //NOI18N
if (full != null) for (int k = 0; k < full.getarraysize(); k++) {
fulls.append(full.get(k));
}
par.writeLog(number + " " + norm.getarraysize()); //NOI18N
if (norm != null) for (int k = 0; k < norm.getarraysize(); k++) {
norms.append(norm.get(k));
}
After that I get the full and norm stringbuilder and can use them. I never had problems with empty cells till today. I've used it with WF 3.0 and Creo 1.0
Best regards,
Eike
PS: Which Wildfire version do you use? So I can test it here too.
All,
if (full != null) for (int k = 0; k < full.getarraysize(); k++) {
fulls.append(full.get(k));
}
par.writeLog(number + " " + norm.getarraysize()); //NOI18N
if (norm != null) for (int k = 0; k < norm.getarraysize(); k++) {
norms.append(norm.get(k));
}
2ND)
if(currTable !=null){
TableCell cell = pfcTable.TableCell_Create(rowNumber, columnNumber);
try{
lines = dwgTable.GetText(cell, ParamMode.DWGTABLE_NORMAL); // throws error when cell is empty
}
catch (XToolkitGeneralError err){
continue;
}
lineText = lines.get(0).toString();
if(lineText.equals(findCellValue)){
//return currTable;//added
break;
}//End of if
}//End of if
3)
Integer.parseInt(cellcol)),
[ ... ]
fulls.append(full.get(k));
I believe that an empty cell will return a stringseq value of null. If
throw a Java NullPointerException. A try/catch block for jxthrowable does
statement that ignores null stringseq values.