Skip to content

Add support for headers and footers #15

@vaceslav

Description

@vaceslav

Description

Enable placeholder replacement, conditionals, and loops in document headers and footers.

Current Limitation

The current implementation only processes the main document body. Headers and footers are separate OpenXML parts that are not currently traversed by the DocumentWalker.

Proposed Solution

Extend DocumentWalker to also process:

  • Headers (first page, odd/even, default)
  • Footers (first page, odd/even, default)
  • Different headers/footers for different sections

Technical Implementation

  1. Access header/footer parts from MainDocumentPart
  2. Apply same visitor pattern to header/footer content
  3. Handle section-specific headers/footers
  4. Preserve header/footer formatting and settings

Use Cases

  • Dynamic page numbers with conditions
  • Company names/logos in headers
  • Document metadata in footers
  • Different headers for different sections

Acceptance Criteria

  • Placeholders work in headers/footers
  • Conditionals work in headers/footers
  • Loops work in headers/footers (where applicable)
  • All header/footer types supported
  • Section-specific headers/footers work
  • Formatting preserved
  • Tests added
  • Documentation updated

Priority

Medium - Common user request

References

  • OpenXML SDK documentation for HeaderPart/FooterPart
  • Related to overall document processing architecture

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions