heavysixer / node-pptx

Generate PPTX files on the server-side with JavaScript.
MIT License
162 stars 45 forks source link

Removing slide doesn't remove slides from [Content_Types].xml #131

Open jamieshield opened 7 months ago

jamieshield commented 7 months ago

Removing slide doesn't remove the slide's relationships from [Content_Types].xml. That is, calling removeSlide to remove slide 2 does delete the following from [Content_Types].xml.

From my naive diagnosis, calling removeSlide calls the factory removeSlide. removeSlide(slide) { this.powerPointFactory.removeSlide(slide.name);

The factory removeSlide calls removeContentType(partName) factories/index.js: removeSlide(slideName) { ... this.contentTypeFactory.removeContentType(/ppt/slides/${slideName}.xml);

However, removeContentType is defined with two parameters partName and contentType. So the contentType never matches and the slides' relationship in ContentType.xml is not removed.

Adding a default parameter was a (hack) solution for me. node-pptx/lib/factories/content-types.js: removeContentType(partName, contentType = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml")

Time poor newbie reporting an issue - just trying to help. Apologies in advance for any inappropriateness in this issue report.