One million data export a report: demand analysis and ideas

Report export one million data

demand analysis

Use Apache POI to complete the amount of one million data export Excel reports

solution

Ideas analysis

Based XSSFWork export Excel reports, is by saving all cell object into memory, when all the cells in Excel all the write-once created and exported to Excel. When the one million level Excel data export, with the creation of the table, more and more objects in memory until the memory overflow. Apache Poi provides SXSSFWork objects, specifically for large volume data processing Excel report export.

Principle Analysis

When the number of instances of this object SXSSFWork, can be specified in the generated memory related objects derived POI (default 100), once the number of objects in memory reaches the predetermined value, these will be the contents of memory objects written to disk (XML file format), it can destroy these objects from memory, since as long as this value is reached, will be handled in a similar way to deal with until the Excel export is completed.

Released 2417 original articles · won praise 62 · Views 200,000 +

Guess you like

Origin blog.csdn.net/Leon_Jinhai_Sun/article/details/105307574