VSTO常用类(Commonly used classes)
Both English version and Chinese Version
Since I’ve got several projects on hand,I’ve no too much time writting the blog.So just write casually!
Today,I just want to introduce some classes commonly used in mine project,and relations between them.
As I said before,my projects temporarily mainly aims at PowerPoint.Regarding the PowerPoint VSTO project,each time when one project is opened,there will produce a PowerPoint.Application object,in which, there are an ActivePresentation object and an ActiveWindow object.Each documents, is a Presentation.Obviously, ActivePresentation is the current documents.Now,I will give some classes commonly used in my project,and relations between them:

in which, SlideRange is the Slide set selected currently;easy to guess,ShapeRange is currently selected Shape set.
With these sets, we may enumerate obtain each element, for example:
foreach (PowerPoint.Slide CurSlide in CurSlideRange)
Thus, then can cselect all the element the enumeration.
In shape demonstrated the ordinary text,is stored up in TextEffect.Text.
And,through to the Presentation detection,we can detect the commonly used event in PowerPoint, like open presentation, preserve presentation, slide show and so on.You can turn to the first several articles specifically for codes.
I’ve to stop here today, if had any introduction not clear,contact me.
最近,手头上有几个项目,没太多时间写博客,随便写写罢!
今天,主要想介绍一些在我的项目中常用到的类,及他们之间的关系。
前面已经有过些介绍,我做的项目,暂时来说主要是针对PowerPoint。对于PowerPoint的VSTO项目来说,每个项目打开时都会应一个PowerPoint.Application类。这个类中,我常用到的是ActivePresentation和ActiveWindow。每一个文档,都是一个Presentation,很明显ActivePresentation便是当前文档。
以下,给出我的项目中用到的类,及其关系:

其中,SlideRange为当前选中的Slide集合;很容易猜测到ShapeRange为当前选中Shape集合。有这些集合,我们可以枚举获得每一个元素,如:foreach(PowerPoint.Slide CurSlide in CurSlideRange)。这样,便能完成对选中元素的枚举。
一个shape里显示的普通文本,储存在TextEffect中的Text里。
另外,通过对Presentation的侦测,我们能够侦测到PowerPoint的常用事件,如打开,保存,播放等。具体可以翻查前几篇文章。
今天就介绍到这儿了,如果有什么介绍得不清楚的地方,还希望大家多提醒我。
~Charlie
Tags: ActivePresentation, ActiveWindow, selection, VSTO