on ‎2018 Dec 10 12:27 PM
Hi I was reading an excel file form media ,which is uploaded through storefront and stored in media. After reading that file based on my requirement i was adding new columns(like error logs) in existing excel file.After that I was accessing that mediaurl using media model.getURL to download ,but its not working and download started and getting cancelled after few seconds.
final File excel = new File(filePath);
final FileInputStream file = new FileInputStream(excel);
// final FileInputStream file = new FileInputStream(new File(filePath));
final XSSFWorkbook workbook = new XSSFWorkbook(file);
// Get first sheet from the workbook
final XSSFSheet abMappingSheet = workbook.getSheetAt(0);
for (final HashMap.Entry entry : errorData.entrySet())
{
final int cellNo = abMappingSheet.getRow(cellCount + 2).getLastCellNum();
final XSSFCell errorCell = abMappingSheet.getRow(cellCount + 2).createCell(cellNo);
errorCell.setCellValue(entry.getKey() + "=" + entry.getValue());
cellCount++;
}
final FileOutputStream outFile = new FileOutputStream(excel, false);
workbook.write(outFile);
outFile.close();
workbook.close();
file.close();
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.