https://issues.apache.org/bugzilla/show_bug.cgi?id=47244





--- Comment #2 from Josh Micich <[email protected]>  2009-05-31 01:04:19 PST 
---
Sorry Jonathan and Yegor, I meant to reply earlier, but hadn't got round to it.

The proposed patch is NQR because it creates a header/footer object which is
detached from the HSSFSheet.  The newly created (empty) header / footer record
needs to be placed into the PageSettingsBlock, otherwise updating it will have
no effect.  That's easy enough, but it's messy to create objects that represent
their own absence.

I noticed that header/footer API on Sheet is a little deficient.  It's hard to
tell whether the usermodel objects are supposed to have a similar life-cycle as
the underlying biff records.  There's no methods on Sheet for update, delete or
doesExist, and I think it would clutter things to add these.  The getHeader /
getFooter methods seem to be called only twice from the full POI code-base.
ExcelExtractor assumes that getFooter() will return null when the footer is not
present.  HeadersAndFooters example expects that the footer will get lazily
created by HSSFSheet.getFooter(). This seems to suggest that HSSFHeader /
HSSFFooter should exist independent of HeaderRecord / FooterRecord.

I think a better solution might involve HSSFHeader / HSSFFooter directly
wrapping the PageSettingsBlock (which is lazily created, and already manages
the presence of all such contained records).  The HSSFHeader / HSSFFooter would
know how get / update / create and destroy the header / footer records, and
tell the PageSettingsBlock as needed.  This approach probably holds up better
in the XSSF world where headers and footers are further specialised to odd/even
etc (i.e. XSSFHeader should know about it's odd/even variants, not XSSFSheet).

We should also update the javadoc of getHeader / getFooter to say @return never
null.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to