Vsto开发记录
呵呵,原来开发插件的记录
Vsto bring the office application to .net programming .
Custom ribbon .
Custom task panes
Vsto == visual studio tool for office
支持2中级别
l Document level solution
Document-level customizations are the VSTO version of VBA macros in Word or Excel
l Application level solution
n ?难道说编写这种add –in 时,可以把数据统一保存到office的目录?也许根本不需要其他通信服务了?
Vsto 的好处
l VSTO provides data-caching capabilities as well as a ServerDocument class in C# that can be used by an application external to Offce
l Smart tags:recognize certain types of data in a document
l Ribbon
The development environment using Visual Studio 2008 is capable of creating application-level, data-centric solutions with VSTO 3.0. The data-centric solutions are the functionalities that are siginifcantly focused on data manipulation and data storage.
二.Object & Document
1.Actions Pane
Action Panes provide a convenient way for developers to introduce custom UIs into Offce applications
The Custom Actions Pane is very different from the Custom Task Pane, even though they sound very similar. The Custom Task Pane is associated with application-level solutions, and the Custom Actions Pane is associated with document-level solutions
注意区分应用程序级别和文档级别的,以及对应模块的区别,action pane应用于文档级别。
Task Panel ,Ribbon 应用于应用程序级别。
The Task Pane design also includes the three main design options:
l Design templates that include HTML layouts for Task Pane
l Color schemes that provide a way of creating a rich look and feel for Task Panes
l Animation schemes that let you do things such as adding animated fles through the Windows Form control or through HTML elements
Word Host Items
Host item
Host Control:VSTO 3.0 extends data binding to Offce solutions by enabling programmers to bind data to objects such as bookmarks, ranges, and so on. These objects are called host controls;
WdBuiltInProperty
Document.BuildInDocumentProperty
wdPropertyAppName | Name of application. |
wdPropertyAuthor | Author. |
wdPropertyBytes | Byte count. |
wdPropertyCategory | Category. |
wdPropertyCharacters | Character count. |
wdPropertyCharsWSpaces | Character count with spaces. |
wdPropertyComments | Comments. |
wdPropertyCompany | Company. |
wdPropertyFormat | Not supported. |
wdPropertyHiddenSlides | Not supported. |
wdPropertyHyperlinkBase | Not supported. |
wdPropertyKeywords | Keywords. |
wdPropertyLastAuthor | Last author. |
wdPropertyLines | Line count. |
wdPropertyManager | Manager. |
wdPropertyMMClips | Not supported. |
wdPropertyNotes | Notes. |
wdPropertyPages | Page count. |
wdPropertyParas | Paragraph count. |
wdPropertyRevision | Revision number. |
wdPropertySecurity | Security setting. |
wdPropertySlides | Not supported. |
wdPropertySubject | Subject. |
wdPropertyTemplate | Template name. |
wdPropertyTimeCreated | Time created. |
wdPropertyTimeLastPrinted | Time last printed. |
wdPropertyTimeLastSaved | Time last saved. |
wdPropertyTitle | Title. |
wdPropertyVBATotalEdit | Number of edits to VBA project. |
wdPropertyWords | Word count. |
Document currentDoucment = Globals.ThisAddIn.Application.ActiveDocument;
Microsoft.Office.Core.DocumentProperties docuemntProperty = (Microsoft.Office.Core.DocumentProperties) (currentDoucment.BuiltInDocumentProperties);
docuemntProperty[WdBuiltInProperty.wdPropertyKeywords].Value = (object)Guid.NewGuid().ToString();
currentDoucment.Save();
Cached Data in Data Island
使用[Cache]可以把文档中的数据,缓存到document当中的xml中。