Interop.PowerPoint: 如何从另一张幻灯片设置幻灯片背景?

Interop.PowerPoint: How set slide background from another slide?

对不起我的英语:)

我需要设置从第五张幻灯片开始的第二张幻灯片的背景颜色

static void Main(string[] args)
{
    var presentationPath = @"d:\myPresentation.pptx";
    var app = new PowerPoint.Application();
    var presentation = app.Presentations.Open(presentationPath, WithWindow: MsoTriState.msoFalse);
    var slide2 = presentation.Slides[2];
    var slide5 = presentation.Slides[5];

    slide2.FollowMasterBackground = MsoTriState.msoFalse;
    var backgroundStyle = slide5.BackgroundStyle;
    try
    {
        slide2.BackgroundStyle = backgroundStyle;
    }
    catch (Exception exception)
    {
        Console.WriteLine($@"Slide5.BackgroundStyle: {backgroundStyle.ToString()}");
        Console.WriteLine(exception.Message);
        Console.ReadKey();
    }
    finally
    {
        presentation.Close();
    }                      
}

但是代码抛出异常(第二行):

Slide5.BackgroundStyle: msoBackgroundStyleNotAPreset

Slide (unknown member) : Integer out of range. 0 is not in the valid range of 1 to 12.

我解决了问题

 static void Main(string[] args)
    {
        var presentationPath = @"d:\myPresentation.pptx";
        var app = new PowerPoint.Application();
        var presentation = app.Presentations.Open(presentationPath, WithWindow: MsoTriState.msoFalse);
        var slide2 = presentation.Slides[2];
        var slide5 = presentation.Slides[5];

        slide2.FollowMasterBackground = MsoTriState.msoFalse;
        slide2.Background.Fill.ForeColor.RGB = slide5.Background.Fill.ForeColor.RGB;                      
    }