Skip to Content
0
Jul 03, 2019 at 10:33 AM

FileDownload Component using from code

50 Views

Hi experts! Is it possible to download file into client PC without using FileDownload UI component?

here inputstream code but how can I use ByteArrayInputStream to transfer to client?

 Reports reportItem = new Reports();
			  reportItem.setItem(reports);
	          Map<String, Reports> map = new HashMap<String, Reports>();
	          map.put("report", reportItem);
	          XLSTransformer transformer = new XLSTransformer();
	          Workbook workbook = transformer.transformXLS(new FileInputStream(templateFile), map);
			  
	          ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
	          workbook.write(outputStream);
	          
	          return new ByteArrayInputStream(outputStream.toByteArray());