32
DEV261 DEV261 2007 2007 Office Office 客客客客客客客 客客客客客客客

DEV261 2007 Office 客户端开发增强

  • Upload
    alamea

  • View
    137

  • Download
    2

Embed Size (px)

DESCRIPTION

DEV261 2007 Office 客户端开发增强. 课程内容概述. - PowerPoint PPT Presentation

Citation preview

Page 1: DEV261 2007 Office 客户端开发增强

DEV261DEV26120072007 OfficeOffice 客户端开发增强客户端开发增强

Page 2: DEV261 2007 Office 客户端开发增强

课程内容概述课程内容概述

在在 Office 2007Office 2007 客户端众多新特性中,和使用者客户端众多新特性中,和使用者关系最为密切的应该是在关系最为密切的应该是在 UIUI 方面的增强。例方面的增强。例如,如, Office 2007Office 2007 摒弃了传统以计算机命令作为摒弃了传统以计算机命令作为功能组织单位的菜单,而替换为以用户命令为组功能组织单位的菜单,而替换为以用户命令为组织单位的织单位的 RibbonRibbon ,这使得用户可以根据当前正,这使得用户可以根据当前正在操作的文档内容,快速定位到想要执行的操作在操作的文档内容,快速定位到想要执行的操作。对于每一个信息工作者而言,。对于每一个信息工作者而言, UIUI 增强将很大程增强将很大程度到提高我们编写文档的质量和效率,而对于每度到提高我们编写文档的质量和效率,而对于每个开发人员而言,对于个开发人员而言,对于 Office ClientOffice Client 用户界面可用户界面可扩展性的增强和包括扩展性的增强和包括 Open XMLOpen XML 这种开发存储格这种开发存储格式的提供使得对于式的提供使得对于 Office ClientOffice Client 端的扩展和开发端的扩展和开发变得随心所欲。变得随心所欲。

Page 3: DEV261 2007 Office 客户端开发增强

课程内容安排课程内容安排

新一代的新一代的 20072007 OfficeOffice 客户端增强客户端增强随心所欲操控新的随心所欲操控新的 OfficeOffice OpenOpen XMLXML 格式文档格式文档扩展和定制扩展和定制 20072007 OfficeOffice 客户端,包括客户端,包括 VSTOVSTO 3.03.0 ,,扩展扩展 RibbonRibbon ,创建自定义任务面板等,创建自定义任务面板等MicrosoftMicrosoft 20072007 OfficeOffice SystemSystem 开发展望开发展望

Page 4: DEV261 2007 Office 客户端开发增强

微软微软 OfficeOffice 一路走来一路走来

Page 5: DEV261 2007 Office 客户端开发增强

现在的用户界面遇到了什么瓶颈现在的用户界面遇到了什么瓶颈 ??Menus and toolbars were designed for less full-featured programs

The feature set of Office has grown and stretched existing UI mechanisms to the limit

It’s harder to find functionality than it was a decade ago“There must be a way to do this…”“I don’t even know where to start looking.”

0

50

100

150

200

250

300

Menu Items

0

5

10

15

20

25

30

35

Wor

d 1.

0

Wor

d 2.

0

Wor

d 95

Wor

d 20

00

Wor

d 20

03

Toolbars

Task Panes

Page 6: DEV261 2007 Office 客户端开发增强

直观印象:下一代的直观印象:下一代的 20072007 OfficeOffice 到底是什么样子到底是什么样子的?的?

Page 7: DEV261 2007 Office 客户端开发增强

Ribbons Ribbons 和和 GroupsGroups

RibbonReplacement for menus and toolbarsAssociated with a tabs and organized around specific scenarios or objectsModeless UI designed for easy browsing

GroupEach ribbon is organized into several groupsContains related controls:

Richer content than menus/toolbars Buttons, galleries, dialog box content…

Giving users one central place for Giving users one central place for functionalityfunctionality

Page 8: DEV261 2007 Office 客户端开发增强

全新用户界面大观

The “Ribbon”GalleriesLive PreviewContextual ToolsQuick Access

Toolbar (“QAT”)“Super Tooltips”

“KeyTips” and Keyboard Navigation

Streamlined Options

Context MenusNew File Menu

Page 9: DEV261 2007 Office 客户端开发增强

新的文件扩展名新的文件扩展名

Macro-Free Macro-Enabled

Document Template Document Template

docxdocx dotxdotx docmdocm dotmdotm

pptxpptx potxpotx pptmpptm potmpotm

xlsxxlsx xltxxltx xlsmxlsm xltmxltm

Open Packaging Convention

Page 10: DEV261 2007 Office 客户端开发增强

新的新的 OfficeOffice 文档格式:文档格式: OpenOpen XMLXML

OfficeOffice 变成了一个基于变成了一个基于 XMLXML 的文档格式的文档格式基于微软基于微软 OfficeOffice 开发开发 XMLXML 格式标准格式标准应用到了应用到了 Word, ExcelWord, Excel 和和 PowerPointPowerPointOfficeOffice 保存为一个包含各个组成部分的压缩文件保存为一个包含各个组成部分的压缩文件文档的组成部分保存为清晰的、开放的文档的组成部分保存为清晰的、开放的 XMLOXMLO 格式格式

Developers can read specific parts of a Developers can read specific parts of a Word or Excel file with a simple XML Word or Excel file with a simple XML

parserparser

Developers can read specific parts of a Developers can read specific parts of a Word or Excel file with a simple XML Word or Excel file with a simple XML

parserparser

Developers can read and modify Office Developers can read and modify Office documents without requiring Office or documents without requiring Office or

using the Office object modelsusing the Office object models

Developers can read and modify Office Developers can read and modify Office documents without requiring Office or documents without requiring Office or

using the Office object modelsusing the Office object models

Developers can easily replace or Developers can easily replace or remove parts of a document such as remove parts of a document such as

the styles, graphics or commentsthe styles, graphics or comments

Developers can easily replace or Developers can easily replace or remove parts of a document such as remove parts of a document such as

the styles, graphics or commentsthe styles, graphics or comments

Valuable for both client-side and Valuable for both client-side and server-side developmentserver-side development

Valuable for both client-side and Valuable for both client-side and server-side developmentserver-side development

Word Document (ZIP file)Word Document (ZIP file)Word Document (ZIP file)Word Document (ZIP file)

Document PropertiesDocument Properties

CommentsComments

Document Content as WordMLDocument Content as WordML

Custom-defined XMLCustom-defined XML

Images / Sounds / VideoImages / Sounds / Video

Embedded code / macrosEmbedded code / macros

ChartsCharts

Page 11: DEV261 2007 Office 客户端开发增强

使用“ 使用“ WinZipWinZip ”” 来编辑来编辑 MicrosoftMicrosoft WordWord 文档文档自己编写程序来创建一个自己编写程序来创建一个 MicrosoftMicrosoft WordWord 文档文档

Page 12: DEV261 2007 Office 客户端开发增强

代码分析:代码分析: WinFX Packaging APIWinFX Packaging API

Microsoft WinFX Software Development Kit (SDK)System.IO.Packaging namespace

add document parts,

retrieve and update contents,

or create new relationships

Important ClassesPackage,

PackagePart,

PackageRelationship

Page 13: DEV261 2007 Office 客户端开发增强

System.IO.PackagingSystem.IO.Packaging

Windowsbase.dllWindowsbase.dllWindowsbase.dllWindowsbase.dll

Page 14: DEV261 2007 Office 客户端开发增强

兼容性兼容性

旧有版本创建的 Office 文档(如 Office 2000, Office XP, Office 2003 )可以在 2007 Office 中打开仅仅安装了就有版本 Microsoft Office 的用户只需要安装一个扩展包,就可以直接打开、编辑 2007 Office 创建的文档2007 Office 客户端仍然可以把 Office 文档保存成以前的格式

Page 15: DEV261 2007 Office 客户端开发增强

OfficeOffice 开发,开发, VSTOVSTO 才是王道才是王道

Visual Studio Tools for the Microsoft Office System v3 (VSTO 3.0)Highly streamlined developer experienceDocument-level Customizations

Microsoft Excel Microsoft WordMicrosoft InfoPath

Application-level Add-ins

Page 16: DEV261 2007 Office 客户端开发增强

VSTO RoadmapVSTO Roadmap

VSTO 2003VSTO 2003 Document-level code behindDocument-level code behind

Brings Office into the managed worldBrings Office into the managed world Strict security modelStrict security model

VSTO 2005VSTO 2005 Custom ActionsPaneCustom ActionsPane

Host Controls on the document surfaceHost Controls on the document surface Cached Data in the documentCached Data in the document Server-side data processingServer-side data processing App-level add-ins for OutlookApp-level add-ins for Outlook

Manifest-based deployment & updateManifest-based deployment & update

O12-specifics : new features, file O12-specifics : new features, file format, UIformat, UI

App-level add-ins for most client App-level add-ins for most client programsprograms

Deeper server side programmingDeeper server side programming Excel User-Defined Funcs (client/server)Excel User-Defined Funcs (client/server)

Workflow & SharePoint supportWorkflow & SharePoint support Mobile device supportMobile device support

VSTO Version 3.0 VSTO Version 3.0 (early thinking)(early thinking)

Page 17: DEV261 2007 Office 客户端开发增强

更多的更多的 OfficeOffice 开发向导开发向导

Page 18: DEV261 2007 Office 客户端开发增强

Host ControlsHost Controls

BookmarkBookmark

XmlNodeXmlNode

RangeRange

ListList

ChartChart

BookmarkBookmark

XmlNodeXmlNode

NamedRangeNamedRange

ListObjectListObject

ChartObjectChartObject

First class .NET object extending Office object model types

Inherits members of underlying objectEnhanced functionalityNew eventsData binding supportResolution of Event/Method CollisionsTag field & Parameterized Property Fix for C#Core Tasks

TaskPanes

Custom Ribbon Extensions

Page 19: DEV261 2007 Office 客户端开发增强

Windows Forms ControlsWindows Forms Controls

Use normal Windows controls in Word documents and Excel spreadsheetsEmbedded in VSTO-defined ActiveX container

Core TasksTaskPanes

Custom Ribbon Extensions

Page 20: DEV261 2007 Office 客户端开发增强

数据绑定 数据绑定 DatabindingDatabinding

Builds on ADO.NETBuilds on ADO.NET

Program against data instead of Word and Excel object modelsProgram against data instead of Word and Excel object models

Bind multiple controls to same DataSetBind multiple controls to same DataSet

Two types of bindingTwo types of binding

Simple (Binding a field to the property of a view control)Simple (Binding a field to the property of a view control)

Complex (Binding multiple field values to a control)Complex (Binding multiple field values to a control)

Data sources include:Data sources include:

Web ServiceWeb Service

DatabaseDatabase

DataSetDataSet

Custom ObjectCustom Object

Core TasksTaskPanes

Custom Ribbon Extensions

Page 21: DEV261 2007 Office 客户端开发增强

创建一个创建一个 VSTOVSTO WordWord 20072007 项目,使用项目,使用 HostHost controlcontrol 和和 WindowsWindows ControlControl 来进行数据绑定来进行数据绑定

Page 22: DEV261 2007 Office 客户端开发增强

定制定制 Office 2007 Office 2007 用户界面用户界面ScenariosScenarios

ISV with ERP solution can ISV with ERP solution can create application-wide create application-wide ribbon extensions that allow ribbon extensions that allow users to access their users to access their information from within all information from within all Office 2007 products that Office 2007 products that support the new UXsupport the new UX

Add your own tabsAdd your own tabs

Add your own groups to Add your own groups to built-in tabsbuilt-in tabs

Add to the File menuAdd to the File menu

Add to built-in contextual Add to built-in contextual tabstabs

Repurpose built-in controlsRepurpose built-in controls

Core TasksCore Tasks TaskTaskPanesPanes

Custom Ribbon ExtensionsCustom Ribbon Extensions

Page 23: DEV261 2007 Office 客户端开发增强

Ribbon ComponentsRibbon ComponentsReviewReview

Ribbon accessible via a tabA Ribbon contains one or more groupsA group contains one or more controls

New controls: ToggleButtons, SplitButtons, EditBoxes, DropDowns, ComboBoxes, CheckBoxes, DropDownGrids

Core TasksTaskPanes

Custom Ribbon Extensions

Page 24: DEV261 2007 Office 客户端开发增强

Ribbon XML FileRibbon XML FileArchitectureArchitecture

ribbonribbontabstabs

tabtabgroupgroup

controlcontrolgroupgroup

controlcontrol

Core TasksTaskPanes

Custom Ribbon Extensions

Page 25: DEV261 2007 Office 客户端开发增强

Document-Level Custom UIDocument-Level Custom UIStepsSteps

1.1. Create ribbon XML fileCreate ribbon XML file

2.2. Open Office 2007 zip packageOpen Office 2007 zip package

3.3. Add ribbon XML file to zip packageAdd ribbon XML file to zip package

4.4. Add new content typeAdd new content type

5.5. Add new relationshipAdd new relationship

6.6. Package back again as Office 2007 documentPackage back again as Office 2007 document

<Override PartName="/customui/customui.xml“ ContentType="application/xml"/><Override PartName="/customui/customui.xml“ ContentType="application/xml"/>

<Relationship Id="rId<Relationship Id="rId**“ Type=“ Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"

Target="customui/customui.xml"/> Target="customui/customui.xml"/>

Core TasksTaskPanes

Custom Ribbon Extensions

Page 26: DEV261 2007 Office 客户端开发增强

Action HandlersAction Handlers

Create procedure (VBA or .NET)

Hook it up with the control in the ribbon XML

Sub Sub YourActionHandlerProcedureYourActionHandlerProcedure(ByVal control As Variant)(ByVal control As Variant)

Your CodeYour Code

End SubEnd Sub

<button id="buttonGenerateRefNumber" label="Reference Number" <button id="buttonGenerateRefNumber" label="Reference Number" size="large" size="large" onAction=“onAction=“YourActionHandlerYourActionHandler""/>/>

Core TasksTaskPanes

Custom Ribbon Extensions

Page 27: DEV261 2007 Office 客户端开发增强

给一个文档增加一个自定义给一个文档增加一个自定义 RibbonRibbon

Page 28: DEV261 2007 Office 客户端开发增强

定制定制 Office 2007 Office 2007 客户端的界面客户端的界面Your optionsYour options

Document-level (static)Include custom UI in the file package

Make action handlers available in Visual Basic for Applications (VBA)

Application-level (dynamic)Load custom UI via add-in

Make action handlers available in add-in

Specific Doc/TemplateSpecific Doc/Template

Doc Doc PartsParts

Custom UICustom UI

ActionActionHandlersHandlers

Any DocumentAny Document

Custom UICustom UI ActionActionHandlersHandlers

Add-InAdd-In

Core TasksTaskPanes

Custom Ribbon Extensions

Page 29: DEV261 2007 Office 客户端开发增强

定制任务面板定制任务面板 (( Task PanesTask Panes ))ScenariosScenarios

ISV creating a smart documentsolution for helping a sales personcreating a sales proposal

ISV creating a task pane that can be activated by the user in order for him to access the ISVspecific information (e.g. from a back-end financial LOB system)

Core TasksCore Tasks TaskTaskPanesPanes

Custom Ribbon ExtensionsCustom Ribbon Extensions

Page 30: DEV261 2007 Office 客户端开发增强

创建一个文档级别的任务面板创建一个文档级别的任务面板

Page 31: DEV261 2007 Office 客户端开发增强

MicrosoftMicrosoft 20072007 OfficeOffice SystemSystem 开发展开发展望望

CollaborationCollaboration Content Content managementmanagement

Streamlined Streamlined processesprocesses

PortalsPortals

Business Business intelligenceintelligence

SearchSearch

Word Word processingprocessing

Business Business modelingmodeling

PresentationsPresentationsBusiness Business

data data managemenmanagemen

ttInformationInformation

ManagementManagement

Page 32: DEV261 2007 Office 客户端开发增强