Skip to content

Give header, footer and footnote images unique drawing ids - #214

Merged
cvas22 merged 1 commit into
mainfrom
fix/213-header-docpr-ids
Dec 6, 2026
Merged

cvas22 merged 1 commit into
mainfrom
fix/213-header-docpr-ids

Conversation

@cvas22

@cvas22 cvas22 commented Dec 6, 2026

Copy link
Copy Markdown
Owner

What this changes

Only the body got its drawing ids renumbered, so header and footer images kept whatever id they came with. Two headers with a logo each, an image loop in a header, or a header image whose id the body renumbering later hands out all produced duplicate wp:docPr ids. Now the counter keeps going through each header, footer and footnote part after the body, so every drawing in the file has its own id.

I also added a test for tables without a w:tblGrid. That used to crash fix_tables and has rendered fine since #206, but nothing covered it.

Fixes #213

How I tested it

The new tests fail on main and pass here. I ran all the sample scripts in tests/ and opened the header, footer and footnote outputs plus the repro cases in Word 16, which opened all of them without a repair prompt and with every image showing.

  • Tests added or updated in tests/unit
  • CHANGES.rst updated if users will notice the change
  • Docs updated if behavior or the API changed

fix_docpr_ids only ran on the body, so images in headers and footers
kept their template ids. Two headers with a logo each, an image loop in
a header, or a header id that the body renumbering later reuses all left
duplicate wp:docPr ids, which desktop Word can react to by hiding images.
Keep counting from the body through each header, footer and footnote
part so every drawing in the document gets its own id.

Also add a test for tables without a w:tblGrid, which used to crash
fix_tables and render fine since #206.

Fixes #213
@cvas22
cvas22 merged commit bea4dba into main Dec 6, 2026
10 checks passed
@cvas22
cvas22 deleted the fix/213-header-docpr-ids branch December 6, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images in headers and footers can get duplicate drawing ids

1 participant