Bug 60887

Summary: Surface XSSF header/footer attributes
Product: POI Reporter: Mark Murphy <jmarkmurphy>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Mark Murphy 2017-03-18 12:21:51 UTC
The different First Page, and different Even/Odd header/footer attributes of XSSF spreadsheets are set automatically when the appropriate methods are called. These attributes cannot be turned off, and there is no way to set the alignWithMargins and scaleWithDoc attributes.
Comment 1 Mark Murphy 2017-03-20 11:38:32 UTC
In working through this feature, I have noticed that creating an XSSFEvenHeader, or an XSSFFirstHeader sets the differentOddEven or differentFirst attributes respectively. And, setting the text for a header to an empty string removes that header, but does not attempt to remove the differentOddEven or differentFirst attributes. I am thinking that setting the text on an XSSFEvenHeader to the null string should remove the differentOddEven attribute if the XSSFEvenFooter is not set, and similarly setting text on the XSSFEvenFooter should remove the differentOddEven attribute if necessary. Same thing for differentFirst with respect to XSSFFirstHeader and XSSFFirstFooter. Any objections?
Comment 2 Greg Woolsey 2017-03-21 20:16:15 UTC
Sounds appropriate to me.
Comment 3 Mark Murphy 2017-11-11 14:21:12 UTC
Added r1814950
Comment 4 Javen O'Neal 2017-11-12 00:46:01 UTC
Make sure to document any surprising behavior in the javadoc. It sounds like some of this functionality would be better implemented in a different class to make the global behavior less surprising. But I am not familiar enough with printing, headers, or footers to suggest something better.
Comment 5 Mark Murphy 2017-11-13 12:21:19 UTC
(In reply to Javen O'Neal from comment #4)
> Make sure to document any surprising behavior in the javadoc. It sounds like
> some of this functionality would be better implemented in a different class
> to make the global behavior less surprising. But I am not familiar enough
> with printing, headers, or footers to suggest something better.

I will try to improve the documentation. I Created the XSSFHeaderFooterProperties class to handle global behavior of these properties. I can add some examples and a section in the Quick Guide as well. Is there somewhere else that you experienced unexpected behavior?
Comment 6 Javen O'Neal 2017-11-13 17:03:29 UTC
(In reply to Mark Murphy from comment #5)
> Is there somewhere else that you experienced unexpected behavior?

I haven't used these features or even read the existing javadocs, so no.