Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

cannot write data document seems to have been closed already in java

@Override
protected void buildExcelDocument( Map<String, Object> model, Workbook workbook, HttpServletRequest request, HttpServletResponse response)   {

	createExcel(workbook, model); 
    
	response.setContentType("ms-vnd/excel");
	response.setHeader("Content-Disposition", "attachment;filename=example.xlsx");
	
	try {
		
		ServletOutputStream out = response.getOutputStream();
		workbook.write(out);
		out.flush();
		
	} catch (IOException e) {
		e.printStackTrace();
	}  
}
Source by soobindeveloper8.tistory.com #
 
PREVIOUS NEXT
Tagged: #write #data #document #closed #java
ADD COMMENT
Topic
Name
7+9 =