

īut apache poi version 3.16 Beta 2 has doc.createHeader(HeaderFooterType.FIRST) which sets titlePg flag in XML. In actual final apache poi version 3.15 this XML element titlePg can only be set using underlying low level objects using doc.getDocument().getBody().getSectPr().addNewTitlePg(). In Word GUI there is a checkbox Different First Page in Header & Footer Tools to achieve that.Īnd according Office Open XML Part 4 - Markup Language Reference there must a boolean XML element titlePg be set to determine that there is a title page present. Then you can define a first page header that consists of nothing except an empty. That there is a different header set for first page only, means not that this header will also be shown. If you need the first page of each chapter to be different for example, no header, content starting partway down the page, and perhaps just a centered page number as a footer turn on the 'Different first page' setting in the Page Setup's Layout tab.
