Skip to content

[BUG] Slide master images overwrite #1416

@DavidmLopes

Description

@DavidmLopes

Issue Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Product Versions

  • Library version: 4.0.1
  • Target PowerPoint version: N/A
  • Browser: N/A

Desired Behavior

Slide master image names not conflict with slide image names, even when creating more than 1000 slides (thats the fixed value that I have seen). Ideally, slide master images should use a different naming scheme, or it should be possible to change the fixed starting value via a function so it can be adjusted based on the expected number of slides.

Observed Behavior

Slide master images are named starting at index 1000 (e.g., image-1000-1.png). When the presentation reaches slide 1000, slide images also generate names like image-1000-1.png, which overwrites the master image.

I also inspected the .pptx file with a zip tool and confirmed that the images are being replaced due to identical names.

Steps to Reproduce

Create a presentation with a slide master containing an image.
Add more than 1005 slides, each with a new image. (The first image of first slide master saves with "image-1002-1.png", so create more than that slides)
Observe that the master image is replaced by a slide image due to filename collision.

Fix

Have looked at the code and come up with some ideas:

  1. Maybe addImageDefinition could take another argument that says if it’s a layout image. If yes, then instead of naming it "image-" it could use something like "layout-image-" and with that could remove the +1000 in _slideNum of defineSlideMaster.
  2. Another idea: add an isLayout?: boolean field to PresSlide. When createSlideMaster runs, set that flag to true. Then in addImageDefinition, check it and switch the target name to "layout-image-". Again could remove the +1000 in _slideNum of defineSlideMaster

I don't know if the fixes are good enough or follow your architecture just sharing what I came up with while trying to debug it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions