Hello,
In my app, I create an excel sheet (with Jakarta POI) and I want to make it downloadable just after it has been created (the user has to click a button to create a file) So i try to override appendToResponse like this but in the file there is some html tags...and not the content of the sheet created...
if(isExported) { super.appendToResponse(response,context);
response.setHeader("inline; filename=" + fFileName, "content-disposition"); response.setHeader("application/vnd.ms-excel", "content-type");
//Convert File to byte[] try { response.setContent(new NSData(convert("tmp" + fFileName))); } catch(Exception e) { NSLog.out.appendln(e.getMessage()); } }
public byte[] convert(String file) throws Exception { File fichier = new File(file); InputStream in = new FileInputStream(fichier); byte[] tableau= new byte[in.available()]; in.read(tableau); return tableau; }
|