I'm using jOpenDocument to fill out .ods-templates with lists of persondata
using a Java application.
When I try to write more than 6000 rows to the .ods-file, i get a
java.lang.OutOfMemoryError. Especially the
org.jopendocument.dom.spreadsheet.Cell[] class is using lots of memory (25
mb). I think the problem is that the entire spreadsheet is build in the
memory and then written to the outputfile. Is there any possibility to
directly write to the outputfile?
This is some of the code i'm using:
public SpreadsheetGenerator(File templateFile, int sheetNumber) {
try {
this.spreadsheet = SpreadSheet.createFromFile(
templateFile);
this.sheet = spreadsheet.getSheet(sheetNumber);
Range range = sheet.getRange("firstRow");
currentRow = range.getEndPoint().y;
} catch (IOException e) {
throw new
RuntimeException("Unable
to create spreadsheet from template", e);
}
}
public void export(Settlement settlement, SpreadsheetValueProviderSource
spreadsheetValueProvider) {
for (Entry<Integer, String> column : columns.entrySet()) {
sheet.setValueAt(spreadsheetValueProvider.getValue(
settlement, today(), Language.NL, column.getValue()),
column.getKey(), currentRow );
}
currentRow++;
}
public void close(File outputFile, OfficeManager officeManager) {
try {
spreadsheet.saveAs(outputFile);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
--
---
You received this message because you are subscribed to the Google Groups
"jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.