Hallo Leute! Ich habe ein Problem. Ich schreibe an einem kleinen Programm. Es soll zunächst Werte aus einem Excel-Sheet in ein String Array packen. Ich habe alles ausprobiert, denke, dass das wahrscheinlich mit den Lebenszyklen der Variablen zusammenhängt, finde aber trotzdem keine Lösung. Unten folgt der Quellcode. Ich danke im Voraus für jede wirkliche Hilfe! P. S. Ich nutze JDeveloper12, weiß nicht, ob es wichtig ist.
Java:
public void read() throws IOException {
//String inputVerzStr = path to .xls-file
File inputWorkbook = new File(inputVerzStr);
Workbook w;
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet
Sheet sheet = w.getSheet(0);
// Loop x columns and lines
for (int j = 0; j < sheet.getColumns(); j++) {
for (int i = 0; i < sheet.getRows(); i++) {
String value = "";
int rows = sheet.getRows();
initializeArray(rows);
Cell cell = sheet.getCell(j, i);
// CellType type = cell.getType();
if (j == 0) {
System.out.println("I got a label "
+ cell.getContents());
value = cell.getContents();
sheetValues[i][j][j][j][j][j] = value;
System.out.println(sheetValues[i][j][j][j][j][j]);
if(i>0){
System.out.println(sheetValues[i-1][j][j][j][j][j]);
}
// fillArrayAccount(i);
}
if (j == 1) {
System.out.println("I got a label "
+ cell.getContents());
sheetValues[j][i][j][j][j][j] = value;
}
if (j == 2) {
System.out.println("I got a label "
+ cell.getContents());
sheetValues[j][j][i][j][j][j] = value;
}
if (j == 3) {
System.out.println("I got a label "
+ cell.getContents());
sheetValues[j][j][j][i][j][j] = value;
}
}
}
} catch (BiffException e) {
e.printStackTrace();
}
}
[code=Java]