ich versuche eine Exeltabelle zulesen (klappt super), und dann zu schreiben. Das geht nicht, die Zelle bleibt leer.
Was mache ich falsch?
Was mache ich falsch?
Java:
private boolean checkImportFile(File file)
{
FileInputStream fis;
FileOutputStream fos;
try
{
fis = new FileInputStream(file);
HSSFWorkbook wb = new HSSFWorkbook(fis);
readXLS(wb, 0, 0, 0);
writeCell(wb,0,1,1)
fis.close();
FileOutputStream fileOut = new FileOutputStream(file);
wb.write(fileOut);
fileOut.close();
} catch (Exception e)
{}
return false;
}
private void writeCell(HSSFWorkbook wb, int sheetIdx, int startRow, int startCol)
{
HSSFCell cell;
HSSFRow row;
HSSFSheet sheet = wb.getSheetAt(sheetIdx);
row = sheet.getRow(startRow);
if (row != null)
{
int cellnum = row.getPhysicalNumberOfCells();
cell = row.createCell((short) cellnum);
HSSFRichTextString text = new HSSFRichTextString("MEIN TEXT");
if (cell != null) cell.setCellValue(text);
}
}
}