Use SXSSFWorkbook in XlsExporter to improve memory usage when exporting xlsx files (#2594)

This commit is contained in:
PJ Fanning 2020-04-26 12:26:05 +02:00 committed by GitHub
parent 40336da2d5
commit 88f7fb2852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -253,12 +253,12 @@
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>4.1.1</version> <version>4.1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>4.1.1</version> <version>4.1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.odftoolkit</groupId> <groupId>org.odftoolkit</groupId>

View File

@ -48,7 +48,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.WorkbookUtil; import org.apache.poi.ss.util.WorkbookUtil;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.google.refine.ProjectManager; import com.google.refine.ProjectManager;
@ -72,7 +72,7 @@ public class XlsExporter implements StreamExporter {
public void export(final Project project, Properties params, Engine engine, public void export(final Project project, Properties params, Engine engine,
OutputStream outputStream) throws IOException { OutputStream outputStream) throws IOException {
final Workbook wb = xml ? new XSSFWorkbook() : new HSSFWorkbook(); final Workbook wb = xml ? new SXSSFWorkbook() : new HSSFWorkbook();
TabularSerializer serializer = new TabularSerializer() { TabularSerializer serializer = new TabularSerializer() {
Sheet s; Sheet s;