简体   繁体   中英

Powerpoint slide background color does not set properly

I use the following code to add a slide to the presentation, and then I want to set its background color to the color of one of the slides that are already in the presentation:

presentation.Slides.AddSlide(presentation.Slides.Count + 1  presentation.Slides[presentation.Slides.Count].CustomLayout);

//set the last slide color to the color of the current slide
presentation.Slides[presentation.Slides.Count].Background.Fill.ForeColor.RGB = presentation.Slides[e].Background.Fill.ForeColor.RGB;
presentation.Save();

However, the color does not get set to red. The right hand side has value 255, which is what I want, but the left hand side has 11675 (before and after the line where I set the color). How to fix this?

This solved the probelm:

 int slide_color = presentation.Slides[e].Background.Fill.ForeColor.RGB;
 presentation.Slides[presentation.Slides.Count].Design.SlideMaster.Background.Fill.ForeColor.RGB = slide_color;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM