PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

Master Layouts and Master Slides

Open kajda90 opened this issue 7 years ago • 9 comments

Hi @gitbrent,

I've tried to find a contact information in this repository but unsuccessfully; thus, I've chosen this way.

First of all, I really appreciate your library, it's really helpful to us and that's also the reason why I try to contribute. However, I've noticed that the feature you're calling slide master is not exactly what it is supposed to be 🙂

As I got principle in your library, master slides work as a set of object and style rules that are applied to a newly created slide in a static way. That means, elements defined in master slide object are added to every single slide even if these slides use the same master. Slide layouts are generated for each slide.

Whereas if you generate a file in PowerPoint, it works as follows: a slide is attached to a slide layout, not to the master slide. So, if you want multiple slides to have the same layout, you just link them to the slide layout file. These slide layouts are then attached to the master files. This principle ensures user who opens such a generated file to be able to update slide layouts and master slide and to apply the changes they perform to all the slides that follow a particular slide layout. And this is what I need.

I know it's difficult to implement methods for creating master file or layout because these files' structure seems to be really complicated. Thus, I'd suggest to pass ready XML definitions of master file and slide layouts to the library. Then, at the moment of creating a slide, name of a layout (that the slide should be attached to) would be passed as an argument. This ensures proper generating relation between layouts and slides.

Now I need your opinion. We need to work with proper master slides and slide layout so I'm ready to implement this. The original solution of master slide would be preserved to provide backward compatibility, of course.

I hope I described the issue clearly.

Thank you in advance 🙂

kajda90 avatar Aug 16 '17 08:08 kajda90

Hi @kajda90

You're absolutely right. I am using "masters" as an object pattern to cheat and not have to deal with the formal layout style. :-)

I would, obviously, prefer the library to generate presentations that are as close 100% correct as it can, so i'd be interested to see what you can come up with.

Thanks for your interest and for all the contributions!

gitbrent avatar Aug 17 '17 03:08 gitbrent

The initial version of this feature is now live.

The old way of creating masters is gone - replaced with a new method defineSlideMaster() that creates actual Master Slide Layouts in PowerPoint.

Come Version 2.0, we should be integrating 100% compliant Masters by allowing the creation of the actual Master Slide in addition to just the new Layouts. I'm walking it forward in phases for continuity and ease of use for both new and current users.

Thanks for all the work on this non-trivial feature @kajda90 !!

gitbrent avatar Sep 06 '17 04:09 gitbrent

Is there a way to use a manually created presentation and their master layout and master slides within this tool? I was just thinking that the layout and design could be done much easier using the native tool and then data applied dynamically using this library.

heavysixer avatar Nov 07 '17 15:11 heavysixer

@heavysixer that's what I was thinking. While I really like the options to define the master slides from JS, it would be very interesting if you could somehow just include the contents of a pre-branded ppt file in the library, and use that. Although, I'm not quite sure how you would add new sliders following a master slide layout if you haven't defined it in the JS yourself.

jcanaan8806 avatar Nov 07 '17 16:11 jcanaan8806

Unfortunately, importing existing Presentations is one of the features I have no plans to support, so that kind of eliminates the use of existing master layouts.

gitbrent avatar Nov 10 '17 05:11 gitbrent

hi @gitbrent , thank you for building this wonderful library. I wanted to check if there is a way to update/create the main master layout. image

CoderTrx avatar Jun 06 '19 13:06 CoderTrx

image

I would also like to manipulate both "Slide Master" and "Layout"

kevinresol avatar Dec 30 '19 09:12 kevinresol

@gitbrent Hi Brent, thank you for creating this wonderful library. I think an option to import an existing master layout from a customer's presentation would be a really useful feature. Is that against your philosophy? Have you looked into it and determined it to be a tough problem? Would it be possible to commission such a feature or would you accept a pull request?

libardo avatar Mar 09 '21 13:03 libardo

@libardo - pptxgenjs will never ingest other files. we create presentations, thats it. :)

gitbrent avatar Mar 10 '21 02:03 gitbrent