Click here to Skip to main content
15,895,829 members
Home / Discussions / Java
   

Java

 
AnswerRe: bookstore java project Pin
Richard MacCutchan29-Jan-17 3:38
mveRichard MacCutchan29-Jan-17 3:38 
Questionget cell to excel file Pin
iheb1127-Jan-17 4:45
iheb1127-Jan-17 4:45 
AnswerRe: get cell to excel file Pin
Richard MacCutchan27-Jan-17 5:02
mveRichard MacCutchan27-Jan-17 5:02 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 5:39
iheb1127-Jan-17 5:39 
GeneralRe: get cell to excel file Pin
Richard Deeming27-Jan-17 6:05
mveRichard Deeming27-Jan-17 6:05 
GeneralRe: get cell to excel file Pin
Richard MacCutchan27-Jan-17 6:18
mveRichard MacCutchan27-Jan-17 6:18 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 10:06
iheb1127-Jan-17 10:06 
Questionjava_excel Pin
iheb1126-Jan-17 13:07
iheb1126-Jan-17 13:07 
i need to get data from a file excel in java and to display the data on a jTable please help me to resolve this problem tnx
i was try this code but i think is incorrect



<
public Object getCellValue(Sheet sheet, int rowNum, int colNum) {
 
    Row row = sheet.getRow(rowNum);
    if ( row==null ) {
         return null;
    }
    else {
         Cell cell = row.getCell(colNum);
         if ( cell==null ) {
            return null;
         }
         else {
             return getCellValue(cell);
         }
    }
 
}
public Object getCellValue(Cell cell) {
switch (cell.getCellTypeEnum()) {
case CellType.STRING:
    return cell.getRichStringCellValue().getString();
case CellType.NUMERIC:
    if (DateUtil.isCellDateFormatted(cell)) {
        return cell.getDateCellValue();
    } else {
        return cell.getNumericCellValue();
    }
case CellType.BOOLEAN:
    return cell.getBooleanCellValue();
case CellType.FORMULA:
    return evalCell(cell); 
case CellType.BLANK:
return null;
default:
throw new IllegalStateException("Unknown cell type");
}
 
private Object evalCell(Cell cell) {
 
FormulaEvaluator evaluator = cell.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
 
CellValue cellValue = evaluator.evaluate(cell);
 
switch (cellValue.getCellType()) {
    case Cell.CELL_TYPE_BOOLEAN:
        return cellValue.getBooleanValue();
    case Cell.CELL_TYPE_NUMERIC:
        return cellValue.getNumberValue();
    case Cell.CELL_TYPE_STRING:
        return cellValue.getStringValue();
    case Cell.CELL_TYPE_BLANK:
        return null;
    case Cell.CELL_TYPE_ERROR:
        throw new RuntimeException("Excel formula error");
    default:
    throw new IllegalStateException("Unknown cell type");
}				
 
 
}

SuggestionRe: java_excel Pin
Richard MacCutchan26-Jan-17 21:54
mveRichard MacCutchan26-Jan-17 21:54 
AnswerRe: java_excel Pin
Patrice T10-Feb-17 11:42
mvePatrice T10-Feb-17 11:42 
Questionhow to write a simple program combining Encapsulation, inheritance, polymorphism and abstraction Pin
Jake Ryder17-Jan-17 3:13
Jake Ryder17-Jan-17 3:13 
RantRe: how to write a simple program combining Encapsulation, inheritance, polymorphism and abstraction Pin
Richard Deeming17-Jan-17 3:54
mveRichard Deeming17-Jan-17 3:54 
AnswerRe: how to write a simple program combining Encapsulation, inheritance, polymorphism and abstraction Pin
Richard MacCutchan17-Jan-17 22:19
mveRichard MacCutchan17-Jan-17 22:19 
QuestionWant to register nimbuzz account using java with smack lib Pin
ggnsrngl17-Jan-17 1:15
ggnsrngl17-Jan-17 1:15 
AnswerRe: Want to register nimbuzz account using java with smack lib Pin
OriginalGriff17-Jan-17 1:16
mveOriginalGriff17-Jan-17 1:16 
GeneralRe: Want to register nimbuzz account using java with smack lib Pin
ggnsrngl17-Jan-17 1:25
ggnsrngl17-Jan-17 1:25 
GeneralRe: Want to register nimbuzz account using java with smack lib Pin
Richard MacCutchan17-Jan-17 22:18
mveRichard MacCutchan17-Jan-17 22:18 
QuestionWant learn Java Pin
happyvalentinesdaywishess.com9-Jan-17 20:04
happyvalentinesdaywishess.com9-Jan-17 20:04 
AnswerRe: Want learn Java Pin
Peter Leow9-Jan-17 20:17
professionalPeter Leow9-Jan-17 20:17 
GeneralMessage Closed Pin
10-Jan-17 4:18
happyvalentinesdaywishess.com10-Jan-17 4:18 
GeneralRe: Want learn Java Pin
Richard MacCutchan10-Jan-17 4:59
mveRichard MacCutchan10-Jan-17 4:59 
AnswerRe: Want learn Java Pin
NotPolitcallyCorrect10-Jan-17 2:07
NotPolitcallyCorrect10-Jan-17 2:07 
SuggestionOT: Username Pin
Richard Deeming10-Jan-17 3:50
mveRichard Deeming10-Jan-17 3:50 
QuestionNothing happens when CheckBox is checked Pin
Pavlex49-Jan-17 9:09
Pavlex49-Jan-17 9:09 
AnswerRe: Nothing happens when CheckBox is checked Pin Pin
Richard MacCutchan9-Jan-17 22:33
mveRichard MacCutchan9-Jan-17 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.