Bug 57597 - No support for multiple sections in HeaderStories
Summary: No support for multiple sections in HeaderStories
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.8-FINAL
Hardware: PC All
: P5 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-18 21:50 UTC by sbuberl
Modified: 2015-02-23 15:56 UTC (History)
1 user (show)



Attachments
Different Headers - doc (41.50 KB, application/msword)
2015-02-23 15:48 UTC, sbuberl
Details
Same Headers - doc (45.50 KB, application/msword)
2015-02-23 15:48 UTC, sbuberl
Details
Same headers with link to previous - doc (45.00 KB, application/msword)
2015-02-23 15:49 UTC, sbuberl
Details
Same Headers - docx (28.28 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-02-23 15:50 UTC, sbuberl
Details
Different Headers - docx (23.69 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-02-23 15:50 UTC, sbuberl
Details
Same headers with link to previous - docx (19.52 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-02-23 15:51 UTC, sbuberl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sbuberl 2015-02-18 21:50:44 UTC
As far as I can tell, the HeaderStories only aplies to the first section of the document.  I run across a lot of Word documents that have multiple sections with unique headers and footers, and no way of getting them out.  Either HeaderStories and/or the Section objects returned by Ranges should be able to access the appropriate headers and footers.
Comment 1 Nick Burch 2015-02-21 12:52:33 UTC
As a first step, are you able to create some simple sample .doc and .docx files, with several sections, some with their own headers/footers, some without? That'll then be a start for unit tests for this, in advance of any code changes

Next up would probably be adding support in XWPF (if it isn't already there?), since that's generally easier to work with, then finally add it at the HWPF level with a very similar API
Comment 2 sbuberl 2015-02-23 15:48:05 UTC
Created attachment 32510 [details]
Different Headers - doc
Comment 3 sbuberl 2015-02-23 15:48:35 UTC
Created attachment 32511 [details]
Same Headers - doc
Comment 4 sbuberl 2015-02-23 15:49:25 UTC
Created attachment 32512 [details]
Same headers with link to previous - doc
Comment 5 sbuberl 2015-02-23 15:50:05 UTC
Created attachment 32513 [details]
Same Headers - docx
Comment 6 sbuberl 2015-02-23 15:50:41 UTC
Created attachment 32514 [details]
Different Headers - docx
Comment 7 sbuberl 2015-02-23 15:51:09 UTC
Created attachment 32515 [details]
Same headers with link to previous - docx
Comment 8 sbuberl 2015-02-23 15:56:13 UTC
(In reply to Nick Burch from comment #1)
> As a first step, are you able to create some simple sample .doc and .docx
> files, with several sections, some with their own headers/footers, some
> without? That'll then be a start for unit tests for this, in advance of any
> code changes
> 
> Next up would probably be adding support in XWPF (if it isn't already
> there?), since that's generally easier to work with, then finally add it at
> the HWPF level with a very similar API

I attached a view generic test documents for both .doc and .docx.  Yes, I believe XWPF  does still have this issue, but I bypassed that by querying for what I needed in OOXML model.  No easy way for me to do the same with HWPF api.