当我将手机连接到计算机时,我创建了一个来自android的excel文件,然后在计算机中无法看到该文件。这是为什么?当手机SD卡连接到电脑时,文件不可见
Workbook wb = new HSSFWorkbook();
Cell c = null;
//Cell style for header row
CellStyle cs = wb.createCellStyle();
//New Sheet
Sheet sheet1 = null;
sheet1 = wb.createSheet("Meter Readings");
// Generate column headings
Row row = sheet1.createRow(1);
c = row.createCell(0);
c.setCellValue("Flat Number");
c.setCellStyle(cs);
sheet1.setColumnWidth(0, (15 * 200));
// Create a path where we will place our List of objects on external storage
File file = new File(context.getExternalFilesDir(null),fileName);
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
wb.write(os);
Log.w("FileUtils", "Writing file" + file);
success = true;
//os.close();
} catch (IOException e) {
Log.w("FileUtils", "Error writing " + file, e);
} catch (Exception e) {
Log.w("FileUtils", "Failed to save file", e);
} finally {
try {
if (null != os) {
os.close();
}
} catch (Exception ex) {
}
}
你的日志说什么? – GhostCat