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.
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
Created attachment 32510 [details] Different Headers - doc
Created attachment 32511 [details] Same Headers - doc
Created attachment 32512 [details] Same headers with link to previous - doc
Created attachment 32513 [details] Same Headers - docx
Created attachment 32514 [details] Different Headers - docx
Created attachment 32515 [details] Same headers with link to previous - docx
(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.