SlideSize

Presentation.SlideSize property

Returns slide size object. Read-only ISlideSize.

public ISlideSize SlideSize { get; }

Examples

The following example shows how to change the slide size in a PowerPoint Presentation.

[C#]
using (Presentation pres = new Presentation("pres-4x3-aspect-ratio.pptx"))
{
    pres.SlideSize.SetSize(SlideSizeType.OnScreen16x9, SlideSizeScaleType.DoNotScale);
    pres.Save("pres-4x3-aspect-ratio.pptx", SaveFormat.Pptx);
}

The following example shows how to set slide size with respect to content scaling for a PowerPoint Presentation.

[C#]
// Instantiate a Presentation object that represents a presentation file
using(Presentation presentation = new Presentation("AccessSlides.pptx")) {
  using(Presentation auxPresentation = new Presentation()) {
    ISlide slide = presentation.Slides[0];
    // Set the slide size of generated presentations to that of source
    presentation.SlideSize.SetSize(540, 720, SlideSizeScaleType.EnsureFit); // Method SetSize is used for set slide size with scale content to ensure fit
    presentation.SlideSize.SetSize(SlideSizeType.A4Paper, SlideSizeScaleType.Maximize); // Method SetSize is used for set slide size with maximize size of content
    // Save Presentation to disk
    auxPresentation.Save("Set_Size&Type_out.pptx", SaveFormat.Pptx);
  }
}

The following example shows how to specifying custom slide sizes in a PowerPoint Presentation.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
    pres.SlideSize.SetSize(780, 540, SlideSizeScaleType.DoNotScale); // A4 paper size
    pres.Save("pres-a4-slide-size.pptx", SaveFormat.Pptx);
}

See Also