We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get master slide with layout information

Hello Aspose Team!

I want an idea to get master slide information with layout(if there is define layout in master slide). And also want each layout information like layout color, position, dimension etc.I have shared two same master slide with same layout with different color. So How can i get deep level information ? Please have share any idea.

I have developed an application in which i have uploaded one master slide with some layout on it with specific color on layout. Whenever i upload same master slide with same layout as uploaded before with different color, then at that time i want reflect layout color in pptx file on the basis of new master slide layout color

Thanks in advance!slidemaster.zip (39.6 KB)


Can you please elaborate your following requirements.

Also, by following do you want to have two masters in one presentation and apply the masters on different slides in presentation.

Ohh!! Okay I’m explaining what I’m doing.

  1. I have web application, from where user upload a master slide with only two layout that would be common for all slides. both layout colour is blue and Gray.

  2. After that user request for build presentation.

  3. Aspose build a presentation with given master slide. And all slides in presentation have common layout that master slide has. I have shared same master slide with two different colour above.

  4. Now, User upload same master slide with same layout as firstly he uploaded but now layout colour is different. And at that time Aspose will build all slides in presentation with new layout colour.

So this is my requirement. Hope you can understand. Thanks @mudassir.fayyaz


I have observed your requirements and like to share that as far as applying master on added slides is concerned, Aspose.Slides is flexible in this regard. You can add as many masters as you like in your presentation and apply them to desired presentation slides based on your requirements. I suggest you to please visit this documentation link that has sample code for cloning master slide and applying them on slide. You can even change the master slide for any slide in your presentation at any time provided that the new master has layout slide which belong the actual slide for which you ought to change master.

Hey, I don’t want to change master slide, i just want to change colour of layout that is placed on master slide.
So how can i get colour of layout that is placed in master slide ? It would be great if you provide a source that will provide all information(if there is layout then get colour, position, dimension etc ) of master slide.



You can access and work with master shape just like normal shapes. Please use the following sample code on your end to see how to change master shapes.

    public static void TestMaster()
        String path = @"C:\Users\Muhammad\Downloads\slidemaster\slidemaster\";

        Presentation pres1 = new Presentation(path + "slidemaster1.pptx");
        Presentation pres2 = new Presentation(path + "slidemaster2.pptx");
        IMasterSlide mast1 = pres1.Masters[0];
        IMasterSlide mast2 = pres2.Masters[0];
        var themeable1=pres1.MasterTheme.ColorScheme;//.AsIMasterThemeable.ThemeManager.;
        var themeable2 = pres2.MasterTheme.ColorScheme;

        for (int i = 0; i < mast1.Shapes.Count;i++ )
            IShape shape = mast1.Shapes[i];
            if (shape is IAutoShape)
                IAutoShape ashp = (IAutoShape)shape;

                if (ashp.FillFormat.FillType == FillType.Solid)
                    if (i == 0)
                        ashp.FillFormat.SolidFillColor.Color = Color.Red;
                        //optionally change position and size of shape as well
                        ashp.X = ashp.X + 20;
                        ashp.X = ashp.Y + 10;
                        ashp.Width = ashp.Width - 20;
                        ashp.Height = ashp.Height - 10;
                        ashp.FillFormat.SolidFillColor.Color = Color.Purple;
                        //optionally change position and size of shape as well
                        ashp.X = ashp.X + 10;
                        ashp.X = ashp.Y + 20;
                        ashp.Width = ashp.Width - 10;
                        ashp.Height = ashp.Height - 20;
            pres1.Save(path + "Saved.pptx", Aspose.Slides.Export.SaveFormat.Pptx);