içinde apache POI kullanarak varolan xls veya xlsx dosyası hakkında veri yazmak nasıl apache POI kullanarak bir şablon .xls dosyasına (gerekirse xlsx olabilir) veri koymak deneyin ama bunu anlayamıyorum ve dosya hala değişmez. PrintStackTrace'de herhangi bir istisna atılmadı. lütfen bana bir çalışma kodu verir misiniz? Çok fazla belge okuyorum, lütfen bana çalışma kodu ile yardım edin. teşekkürlerandroid
kodum:
final Button but = (Button) findViewById(R.id.bk);
but.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
writeXLSFile(3, 3);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
public static void writeXLSFile(int row, int col) throws IOException {
try {
FileInputStream file = new FileInputStream(Environment.getExternalStorageDirectory().toString() +"telegran/"+ "ex.xls");
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheetAt(0);
Cell cell = null;
//Update the value of cell
cell = sheet.getRow(row).getCell(col);
cell.setCellValue("changed");
file.close();
FileOutputStream outFile =new FileOutputStream(new File(Environment.getExternalStorageDirectory().toString() +"telegran/"+ "ex.xls"));
workbook.write(outFile);
outFile.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
değil çalışma – dudu