poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Blake Watson <blake.wat...@pnmac.com>
Subject Re: How to "clone" values of a workbook
Date Tue, 10 May 2016 20:18:06 GMT
>>because the creation of workbook instances is pretty costly (about 200ms
to 15 seconds for the workbooks we are dealing with) we implemented a
pooling of workbook instances which seems to work pretty well.<<

This is what I did, as well.

>>Since we are only performing limited write-operations on the workbook
instances (basically only calling Cell.setCellType() and
Cell.setCellValue()) we need a way of "cloning" the original workbook
values when retrieving a workbook instance from the pool, remembering them
and "reseting" the workbook instance when returning it to the pool by
setting all those remembered values to the workbook instance.<<

I, too, ran into this situation.

>>I'm wondering if there is already a functionality like this in poi or if
somebody already did sth. similar? Otherwhise I'll have to write sth. by my
own (which shouldn't be too hard) - but I thought that I'll ask anyway.<<

I don't think there is. In my case, only certain values are settable
(specifically, named ranges that are not formulae), so I capture those
values when I load the spreadsheet and "reset" them when I've gotten the
results I wanted. So it's: set-all-inputs, recalculate as needed,
retrieve-all-outputs, reset-all-inputs.

>>Performing a deep clone of the complete workbook is not an option as this
would make the whole pooling idea pointless.

Ah, but if you a deep clone feature, you wouldn't need to pool (presuming
cloning was not as resource intensive as loading a workbook is).

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message