poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paolo mottadelli <p.mottade...@sourcesense.com>
Subject XSSFSheet constructor
Date Wed, 30 Jan 2008 09:45:41 GMT
Hi to the POI dev community.
I would like to introduce myself as it is my first message on this
list, after some patches uploads on bugzilla.
My name is Paolo Mottadelli, I am working on the OOXML POI branch,
together with Ugo and some collegues.

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.

Class XSSFSheet
1.  CTWorksheet worksheet;
2.  public double getMargin(short margin) {
3.      CTPageMargins pageMargins = worksheet.getPageMargins();
4.      switch (margin) {
5.      case LeftMargin:
6.              return pageMargins.getLeft();
7.         ........
8.  }

now, we could set all the objects like worksheet.CTPageMargins inside
the constructor, in order to be sure that they are not null,
or we can throw an Exception inside getMargin if the
worksheet.CTPageMargin object is not set (and that would mean that no
margin is set).

What do you suggest for that?

Paolo Mottadelli
Sourcesense - making sense of Open Source: http://www.sourcesense.com 

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message