Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

excel file is not deleting from server

Hello expert,

I am creating excel file using jxl and in that file i am inserting table data. now the problem is that file is not deleting from the server.please give some suggestion so that i can delete from server .

Thanks and Regards

Kumar Rakesh.

IWDCachedWebResource cachedExcelResource = null;

try

{

String date = DateConvert(new Date(System.currentTimeMillis()).toString());

String user_ex_form= wdContext.currentContextElement().getUser_excel_cfrom();

String fileName = "CFormStatus"dateuser_ex_form+".xls";

File f = new File(fileName);

WritableWorkbook workbook = Workbook.createWorkbook(f);

WritableFont red = new WritableFont(WritableFont.ARIAL, WritableFont.DEFAULT_POINT_SIZE, WritableFont.NO_BOLD, false, UnderlineStyle.SINGLE, Colour.RED);

WritableCellFormat redFormat = new WritableCellFormat(red);

WritableFont blue = new WritableFont(WritableFont.ARIAL, WritableFont.DEFAULT_POINT_SIZE, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLUE);

WritableCellFormat blueFormat = new WritableCellFormat(blue);

WritableSheet sheet = workbook.createSheet("C Form Status", 0);

workbook.setColourRGB(Colour.LIME, 0xff, 0, 0);

workbook.write();

FileInputStream excelCSVFile = new FileInputStream(f);

cachedExcelResource =getCachedWebResource(excelCSVFile,fileName,

WDWebResourceType.getWebResourceType("xls","application/ms-excel"));

wdContext.currentContextElement().setRESOURCE(cachedExcelResource);

workbook.close();

f.delete();

Not what you were looking for? View more on this topic or Ask a question