In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use springboot+easypoi to export a large amount of data from excel". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to use springboot+easypoi large amount of data excel export" bar!
01
The last time I wrote a line of code to solve the export import, the little partner who did not read it suggested that we should first take a look at "one line of code to do Excel import and export", but there is a problem in the actual business. If the data is relatively large, for example, 10w + data will be exported once, it will get stuck. Continue to look at the official documents. There is a large amount of data export method, which is implemented as follows.
@ RequestMapping ("export") public void export (HttpServletResponse response) {Map params = new HashMap (); Workbook workbook = bigExcel (1, params, null, new ExportParams ("King of the Sea Thief", "King of the Sea Thief"), new Page (); ExcelExportUtil.closeExportBigExcel (); downLoadExcel ("King of the Sea Thief", response, workbook);} private Workbook bigExcel (int pageNum, Map params, Workbook workbook, ExportParams exportParams, Page page) {page.setCurrent (pageNum); page.setSize (1000) Page.setCondition (params); page = this.getData (sysUserService.queryPage (page)); List users = FastJsonUtils.toList (FastJsonUtils.toJSONString (page.getRecords ()), SysUser.class); workbook = ExcelExportUtil.exportBigExcel (exportParams, SysUser.class, users); if (page.getPages () > pageNum) {bigExcel (pageNum + 1, params, workbook, exportParams, page);} return workbook } private void downLoadExcel (String fileName, HttpServletResponse response, Workbook workbook) {try {response.setCharacterEncoding ("UTF-8"); response.setHeader ("Content-Disposition", "attachment;filename=" > response.setHeader ("content-Type", "application/vnd.ms-excel"); workbook.write (response.getOutputStream ());} catch (IOException e) {throw new NormalException (e.getMessage ()) }} at this point, I believe you have a deeper understanding of "how to export with springboot+easypoi excel with large amounts of data". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.