On Tue, 29 Jan 2008, Paolo Mottadelli wrote:
Question about the XSSFSheet constructor; I would like to have some
suggestion about how to proceed.
A lot of methods, for XSSFSheet, require that the CTWorksheet object
has some other objects set.
EXAMPLE: the getMargin method requires that the CTPageMargins object
is set for worksheet, or we get a NullPointerException on line 6. of
the example below.

If you call setMargin, we're going to need to add the CTPageMargins object if it isn't already there. So, I'd see two options:

1) Create "private void ensurePageMargins()", which is called by both
    getMargin and setMargin, and adds a CTPageMargins if none is there
2) Have getMargin return a default value (perhaps Double.NaN) if no
    CTPageMargins is defined, and have only setMargin add one if not
    present

I'd probably be tempted to lean towards option 2. I don't think we need to go creating missing (but optional) objects until they're actually needed

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to