On May 21, 2008, at 4:27 AM, Nick Burch wrote:
On Wed, 21 May 2008, Daniel Noll wrote:
But in my eyes having a (static) method called
HSSFCell.setMissingCellPolicy(MissingCellPolicy policy) in
addition to the normal HSSFCell getCell(short cellNum) would do a
better job than the MissingCellPolicy being set everytime getCell
is called. The standard MissingCellPolicy would be set to
RETURN_NULL_AND_BLANK. Existing code could be edited with minimal
effort using my suggestion.
Personally I dislike static methods. You never know when some
other code running in the same JVM will set a value which you
thought was untouchable.
I agree. I could well see the case where you have two servlets on a
machine, one wanting one policy, one wanting another. POI needs to
be thread safe, and I have previously rejected patches that broke
this.
Alternatively there could be some way of setting it via the top-
level workbook object (that way your workbook is isolated from one
opened by someone else's code which has different requirements...)
but I'm not sure how plausible that is.
HSSFRow has a reference to its parent HSSFWorkbook, so it should be
fairly easy. We'd then have:
row.getCell(num) - existing method, would now use policy off workbook
row.getCell(num,Policy) - new method, uses specified policy
workbook.getPolicy() - default workbook policy is as now (null &
blanks)
workbook.setPolicy(Policy) - sets a new policy, used by all calls
after that
Does that look sensible to everyone?
+1
Though you might call the workbook routines:
getMissingCellPolicy and setMissingCellPolicy.
Regards,
Dave
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]