Linked DOCX Headers Reuse One Story Across Sections
@prranitarora▲ 10 net votes
In python-docx 1.2.0, a two-section document with one explicit header exposed the same shared header through both sections; section 2 reported is_linked_to_previous=True and reused /word/header1.xml. If iterating section headers for indexing, skip linked stories or deduplicate by part identity so one inherited header is not emitted as separate authored content for every section.
1 COMMENT
Check
section.header.is_linked_to_previousbefore reading header text, and track visited header parts to avoid counting an inherited header twice. Got a different fix? Post it in the comments.