Skip to content

fix(pptx): move hidden shapes to the invisible content layer - #4733

Merged
DanielNg0729 merged 2 commits into
docling-project:mainfrom
mittalpk:fix/pptx-hidden-shape-invisible-layer
Oct 10, 2026
Merged

DanielNg0729 merged 2 commits into
docling-project:mainfrom
mittalpk:fix/pptx-hidden-shape-invisible-layer

Conversation

@mittalpk

@mittalpk mittalpk commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

A shape hidden in PowerPoint's Selection Pane (hidden on p:cNvPr) was still exported as body text when its slide was shown. This moves the content of a hidden shape to ContentLayer.INVISIBLE, the same treatment #4647 gave hidden slides. It applies to text boxes, pictures, tables, charts and connectors, and a hidden group hides everything inside it.

The shape still runs through the normal handlers, so nothing is dropped; the items they add are moved to the invisible layer afterwards.

Issue resolved by this Pull Request:
Resolves #4732

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

A shape hidden in PowerPoint's Selection Pane (p:cNvPr/@hidden) on a shown
slide was emitted as body content. Treat it like a hidden slide: its items,
and those of every shape inside a hidden group, go to ContentLayer.INVISIBLE.

Signed-off-by: Praveen Mittal <pkmittal28@gmail.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @mittalpk, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

tests/test_backend_pptx.py went past the 1500-line limit.

Signed-off-by: Praveen Mittal <pkmittal28@gmail.com>

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@DanielNg0729
DanielNg0729 merged commit 21588f5 into docling-project:main Oct 10, 2026
26 checks passed
DanielNg0729 added a commit that referenced this pull request Oct 23, 2026
* fix(docx): leave hidden text out of the default export

Text with Word's Hidden font property (w:vanish) was emitted as body
content, although Word does not show or print it. A fully hidden
paragraph now goes to ContentLayer.INVISIBLE, the same treatment a
hidden PPTX slide (#4647) or shape (#4733) gets. A hidden run inside a
shown paragraph or a table cell cannot have its own layer, so it is
dropped from the text.

The hidden state is resolved from the run, then its character style
chain, then the paragraph style chain. Documents with no w:vanish skip
the checks, so conversion speed is unchanged.

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>

* fix(docx): hide hidden headings, list items and note text too

Address the review of the first commit:

- Headings and list items take their own add calls, which did not pass
  the content layer. They now go to ContentLayer.INVISIBLE when hidden.
  List groups stay on the surrounding layer, so a hidden first item no
  longer hides the shown items after it or makes the list loose.
- The equation parser read the w:t of hidden runs, so its rebuilt text
  did not match and the equation was lost. It now skips hidden runs. A
  table cell with an equation also kept its hidden text; it does not now.
- A paragraph with an equation is never fully hidden, and an equation
  with only hidden text beside it is a standalone formula again.
- python-docx loads footnotes and endnotes as plain parts, so w:vanish
  only there was not found. A hidden paragraph in a note is now left out.
- Documents without w:vanish skip the style chain lookups for every run
  and table cell run.

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>

* chore: drop duplicate import left by the main merge

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>

---------

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>
Signed-off-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Co-authored-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
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.

PPTX: text of a hidden shape on a shown slide is emitted as body content

3 participants