简体   繁体   English

使用C#将PowerPoint演示文稿的所有幻灯片放到宽屏模式

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

I would like to put all my slides into widescreen mode using C#. 我想使用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: 我想我几乎在那里...我找到了页面: PpSlideSizeType枚举 ,因此得到了代码:

  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. 唯一的问题是我不希望屏幕尺寸为W = 25.4,H = 14.28的onScreen16x9宽屏。 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 我希望在Powerpoint程序中选择幻灯片尺寸时显示的“宽屏”,该尺寸为W = 33.86,H = 19.05

Interesting. 有趣。 You've found what's probably a bug or at least a missing bit of the OM. 您已经发现可能是bug或至少缺少OM的一部分。

If you start a new presentation in PPT 2013, the default slide size is Widescreen; 如果您在PPT 2013中开始新的演示文稿,则默认幻灯片大小为“宽屏”; 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). 滑动大小,然后选择自定义以获取页面设置对话框,它将列为宽屏(13.333 x 7.5英寸或等效的厘米/毫米)。

But there's no Widescreen page size in the ppSlideSizeType enumeration. 但是ppSlideSizeType枚举中没有宽屏页面大小。

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. 如果将.SlideWidth和.SlideHeight分别设置为13.333 * 72和7.5 * 72,则当再次在UI中查看幻灯片时,PPT会将幻灯片大小显示为“宽屏”。

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. 但是,我不认为更改代码的大小会触发您使用UI在4:3和宽屏之间切换时获得的PPT的正常大小调整行为……也就是说,它可能会使所有图形等失真。

And by the way, Widescreen means different things in different PPT versions. 顺便说一下,宽屏在不同的PPT版本中意味着不同的东西。 In 2010, choosing widescreen sets your page setup to 10 x 5.63 inches or thereabouts. 在2010年,选择宽屏会将您的页面设置设置为10 x 5.63英寸左右。 In 2013, it's 13.333 x 7.5. 2013年为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. 实际上,他们应该在2010年将标准尺寸设为13.333x7.5。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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