How to Get Effective Background of Presentation Slide?

Hello,

Is there an easy way to get the effective background of a slide? either as SolidFillColor, GradientFormat or image?

Thanks,
Arbi

@rbstepanian,
Thank you for posting the inquiry.

To get an effective background of a slide, you should use Background.GetEffective method. The following code example shows you how to do this:

using (var presentation = new Presentation("example.pptx"))
{
    var background = presentation.Slides[0].Background.GetEffective();

    if (background.FillFormat.FillType == FillType.Solid)
    {
        // See: background.FillFormat.SolidFillColor
    }
    else if (background.FillFormat.FillType == FillType.Gradient)
    {
        // See: background.FillFormat.GradientFormat
    }
    else if (background.FillFormat.FillType == FillType.Picture)
    {
        // See: background.FillFormat.PictureFillFormat
    }
}

Documents: Getting Effective Background Values of Slides
API Reference: IBaseSlide.Background property | IBackground.GetEffective method