Skip to content

Conversation

@rpg600
Copy link

@rpg600 rpg600 commented Nov 13, 2025

feat: add drawing pass-through support for unsupported elements

Add opt-in pass-through mechanism to preserve unsupported drawing
elements (shapes, textboxes etc) during read/write operations.

  • Add enableDrawingPassThrough property to BaseReader
  • Store original drawing XML when pass-through is enabled
  • Reuse stored XML in Writer instead of regenerating
  • Disabled by default for backward compatibility

This allows preservation of Excel elements not yet supported by
PhpSpreadsheet without requiring full implementation.

Currently, the pass-through mechanism works as follows:

  1. Reader: setEnableDrawingPassThrough(true) stores the original drawing XML
  2. Writer: Automatically uses the stored XML if:
    • The drawing collection is empty (no drawings added programmatically)
    • AND the unparsed data contains the original XML

I'm open to adding an explicit Writer flag if you believe it provides better clarity and control.

This addresses existing issues : #4681, #4037, #2621

@rpg600 rpg600 marked this pull request as ready for review November 14, 2025 11:46
@oleibman
Copy link
Collaborator

I am still evaluating whether this is a good idea or not. Will it work if you add or remove a row or a column on the sheet? Add a comment when there weren't any before, and when there were? Remove a comment?

Your commentary says that you are fixing 3 open issues. Are there tests for each of those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants