简体   繁体   中英

Putting all slides of powerpoint presentation into Widescreen mode using C#

I would like to put all my slides into widescreen mode using C#. How would I go about doing this?

So far I have:

PowerPoint.Application ppApp = Globals.ThisAddIn.Application;
PowerPoint.SlideRange ppSR = ppApp.ActiveWindow.Selection.SlideRange;

Although I am not sure this is the right route?

EDIT

I'm almost there I think... I found the page: PpSlideSizeType Enumeration and so got the code:

  PowerPoint.Application ppApp = Globals.ThisAddIn.Application;
  ppApp.ActivePresentation.PageSetup.SlideSize = PowerPoint.PpSlideSizeType.ppSlideSizeOnScreen16x9;

The only problem is I don't want the onScreen16x9 Widescreen which measures W=25.4, H=14.28. I would like the "Widescreen" which shows up when you select slide size in the powerpoint program which measures W=33.86, H=19.05

Interesting. You've found what's probably a bug or at least a missing bit of the OM.

If you start a new presentation in PPT 2013, the default slide size is Widescreen; if you look at Design | Customize group | Slide Size and choose Custom to get the Page Setup dialog box, it'll be listed as Widescreen (13.333 x 7.5 inches or equivalent in cm/mm).

But there's no Widescreen page size in the ppSlideSizeType enumeration.

If you set the .SlideWidth and .SlideHeight to 13.333 * 72 and 7.5 * 72 respectively, PPT will show the slide size as being Widescreen when you look at it in the UI again.

However, I don't think changing the size in code will trigger PPT's normal resizing behavior that you get when switching between 4:3 and widescreen using the UI ... that is, it'll likely distort all of your graphics and such.

And by the way, Widescreen means different things in different PPT versions. In 2010, choosing widescreen sets your page setup to 10 x 5.63 inches or thereabouts. In 2013, it's 13.333 x 7.5. The change is for the better; they should have made 13.333x7.5 the standard size in 2010 in fact.

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