I query the mail archive and get this post: Updating ODS file using ODFDOM version 0.8.7 http://odftoolkit.org/projects/odfdom/lists/users/archive/2011-07/message/10
It is also from you;) I think you face the same problem this time ;) 2011/10/20 Neelima <[email protected]> > Hi, > > I have used ODF API for writing information into an ODS file. Following are > the steps: > > 1. Load an ODS document from a location which acts as a template f or > writing information. (Spead across different workSheets) > > *SpreadsheetDocument ods = > SpreadsheetDocument.loadDocument("Sample.ods");* > * > * > 2. Load the record from the database. > 3. Write information of retrieved record from the database across different > spreadsheets. > * //fetch rows and cell* > * cell.setStringValue("value");* > * > * > 4. Append columns/rows when necessary as I progress loading each record and > write to the ODS file. > * Table sheet = ods.getSheetByIndex(0);* > * sheet.appendColumn();* > * //when I need to append rows* > * sheet.appendRows(2);* > * //when I have to insertRows* > * sheet.insertRowsBefore(8,2);* > > 5. Repeat steps 2-4 until all records are written to the database. At the > end save the document to the desired location > *ods.save("Sample_Output.ods");* > * ods.close();* > * > * > When our program is running and when we calculate memory usage by object > ods, > for every item its increasing to many folds and finally if we have around > 500 records to be written to the file, it runs to OutOfMemory error even > with a JVM heap size of 512M. We have a requirement wherein we have to > write > atleast a couple of 1000 records to the file. > Below are some of the readings we have taken for the memory occupied by ods > object (all in bytes): For 25 items it took almost 19MB of memory. > > *Memory used for item start when template ods file is loaded : 70904* > * > Memory used for item 1 is::6582856 > Memory used for item 2 is::7153712 > Memory used for item 3 is::7693304 > Memory used for item 4 is::8229752 > Memory used for item 5 is::8790632 > Memory used for item 6 is::9330904 > Memory used for item 7 is::9872280 > Memory used for item 8 is::10403760 > Memory used for item 9 is::10926408 > Memory used for item 10 is::11444312 > Memory used for item 11 is::11975584 > Memory used for item 12 is::12569264 > Memory used for item 13 is::13111056 > Memory used for item 14 is::13630656 > Memory used for item 15 is::14162408 > Memory used for item 16 is::14619104 > Memory used for item 17 is::15137664 > Memory used for item 18 is::15655856 > Memory used for item 19 is::16175768 > Memory used for item 20 is::16687440 > Memory used for item 21 is::17192536 > Memory used for item 22 is::17712152 > Memory used for item 23 is::18227080 > Memory used for item 24 is::18867536 > Memory used for item 25 is::19372664 > Memory used for item after all items are written and saved to file: > 19180232 > * > > Please advise if am missing something in the API which needs to be used. > > Thanks & Regards, > Neelima > -- -Devin
