please i need help in getting excel file into jtable
i'm searching for this problem for 1 weak and no results
i downloaded hssf packages and didn't make achange in reading...
Thanks
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
please i need help in getting excel file into jtable
i'm searching for this problem for 1 weak and no results
i downloaded hssf packages and didn't make achange in reading...
Thanks
a) Read the excel file into a data structure b) display data structure in JTable. If you have a specific question about either of these steps, then please post what you've tried (as an SSCCE), where you are stuck, and please post any and all errors or misbehavior.please i need help in getting excel file into jtable
this code give me an error in this line :
w = Workbook.getWorkbook(inputWorkbook);
PHP Code:
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.CellType;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel {
private String inputFile;
public void setInputFile(String inputFile) {
this.inputFile = inputFile;
}
public void read() throws IOException {
File inputWorkbook = new File(inputFile);
Workbook w;
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet
Sheet sheet = w.getSheet(0);
// Loop over first 10 column and lines
for (int j = 0; j < sheet.getColumns(); j++) {
for (int i = 0; i < sheet.getRows(); i++) {
Cell cell = sheet.getCell(j, i);
CellType type = cell.getType();
if (type == CellType.LABEL) {
System.out.println("I got a label "
+ cell.getContents());
}
if (type == CellType.NUMBER) {
System.out.println("I got a number "
+ cell.getContents());
}
}
}
} catch (BiffException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException {
ReadExcel test = new ReadExcel();
test.setInputFile("c:/Age.xls");
test.read();
}
}
What error? We can only guess - compile time? Runtime? Post it in its entiretythis code give me an error in this line :
thanks for your effort
i get the error ...
the file extends must be just 1997-2003