Click here to Skip to main content
14,032,300 members
   

Java

 
AnswerRe: bookstore java project Pin
Richard MacCutchan29-Jan-17 3:38
protectorRichard MacCutchan29-Jan-17 3:38 
Questionget cell to excel file Pin
iheb1127-Jan-17 4:45
memberiheb1127-Jan-17 4:45 
AnswerRe: get cell to excel file Pin
Richard MacCutchan27-Jan-17 5:02
protectorRichard MacCutchan27-Jan-17 5:02 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 5:39
memberiheb1127-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
protectorRichard MacCutchan27-Jan-17 6:18 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 10:06
memberiheb1127-Jan-17 10:06 
Questionjava_excel Pin
iheb1126-Jan-17 13:07
memberiheb1126-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
protectorRichard 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
memberJake 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
protectorRichard MacCutchan17-Jan-17 22:19 
QuestionWant to register nimbuzz account using java with smack lib Pin
ggnsrngl17-Jan-17 1:15
memberggnsrngl17-Jan-17 1:15 
AnswerRe: Want to register nimbuzz account using java with smack lib Pin
OriginalGriff17-Jan-17 1:16
protectorOriginalGriff17-Jan-17 1:16 
GeneralRe: Want to register nimbuzz account using java with smack lib Pin
ggnsrngl17-Jan-17 1:25
memberggnsrngl17-Jan-17 1:25 
GeneralRe: Want to register nimbuzz account using java with smack lib Pin
Richard MacCutchan17-Jan-17 22:18
protectorRichard MacCutchan17-Jan-17 22:18 
QuestionWant learn Java Pin
happyvalentinesdaywishess.com9-Jan-17 20:04
memberhappyvalentinesdaywishess.com9-Jan-17 20:04 
AnswerRe: Want learn Java Pin
Peter Leow9-Jan-17 20:17
professionalPeter Leow9-Jan-17 20:17 
GeneralRe: Want learn Java Pin
Richard MacCutchan10-Jan-17 4:59
protectorRichard MacCutchan10-Jan-17 4:59 
AnswerRe: Want learn Java Pin
NotPolitcallyCorrect10-Jan-17 2:07
memberNotPolitcallyCorrect10-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
memberPavlex49-Jan-17 9:09 
AnswerRe: Nothing happens when CheckBox is checked Pin Pin
Richard MacCutchan9-Jan-17 22:33
protectorRichard MacCutchan9-Jan-17 22:33 
AnswerRe: Nothing happens when CheckBox is checked Pin
Mirwise Khan25-Jan-17 14:46
memberMirwise Khan25-Jan-17 14:46 

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.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190419.4 | Last Updated 22 Apr 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid