In Spring MVC application, to download a resource such as a file to the browser, you need to do the following in your controller. Use the void return type for your request-handling method and add HttpServletResponse as an argument to the method. Set the response’s content. I'am working on an excel export functionality in one of my webapps. I set up a little test case and got the download working, but the xlsx file is corrupted and don't know what else I could try.
Spring MVC comes with AbstractExcelView class to export data to Excel file via Apache POI library. In this tutorial, it show the use of AbstractExcelView class in Spring MVC application to export data to Excel file for download.
1. Apache POI
![Spring Mvc Download Excel Spring Mvc Download Excel](/uploads/1/2/5/0/125075607/188585184.png)
Get the Apache POI library to create the excel file.
2. Controller
A controller class, generate dummy data for demonstration, and get the request parameter to determine which view to return. If the request parameter is equal to “EXCEL”, then return an Excel view (AbstractExcelView).
File : RevenueReportController.java
3. AbstractExcelView
Create an Excel view by extends the AbstractExcelView class, and override the buildExcelDocument() method to populate the data to Excel file. The AbstractExcelView is using the Apache POI API to create the Excel file detail.
Note
For detail about how to use the Apache POI , please refer to Apache POI documentation
For detail about how to use the Apache POI , please refer to Apache POI documentation
File : ExcelRevenueReportView.java
Note
Alternatively, you can use the AbstractJExcelView, which is using the JExcelAPI to create the same Excel view, see this AbstractJExcelView example.
Alternatively, you can use the AbstractJExcelView, which is using the JExcelAPI to create the same Excel view, see this AbstractJExcelView example.
4. Spring Configuration
![Spring Spring](/uploads/1/2/5/0/125075607/766956522.jpg)
Create a XmlViewResolver for the Excel view.
File : spring-excel-views.xml
Download videos using url link. More importantly, the free tool is clean. You won't be bothered by pop-up ads, plugins, or malware.
5. Demo
URL : http://localhost:8080/SpringMVC/revenuereport.htm?output=excel
It generates an Excel file for user to download.
Jun 06, 2016 I had Dell come out and replace the display just in case and their support says that Intel needs to rewrite the HD 3000 drivers to work with Windows 10. I am currently running version 9. Of the HD 3000 drivers and the driver fails sometimes multiple times a day and sometimes it will go a week without failing. Intel hd 3000 driver windows 10 code 10. 7 rows Description Type OS Version Date; Intel® HD Graphics Driver for Windows. 7/8/8.1-32bit. Intel HD Graphics 3000 Driver This package provides the driver for the Intel HD Graphics and is supported on XPS L321x that are running following Windows Operating system: Windows 10 64bit. Jul 29, 2015 This download installs the Intel® HD Graphics production driver version 15.40.1.64.4256 to support Microsoft Windows® 10, 64-bit. operating system for N-Series platforms. Not sure if this is the right driver or software for your component? Run Intel® Driver & Support Assistant to automatically detect driver or software updates.
Download Source Code
Download it – SpringMVC-ExcelFile-AbstractExcelView-Example.zip (9KB)