7/24/2007 caparea.net presentation - visual studio tools for office - automation and customizing...
DESCRIPTION
Building office applications has never been better. You've heard all of the hype about Office 2007, Ribbons, etc. This session is based on what the majority of us are in today...Office 2003. Customizing and automating Excel 2003 is a great way to build dynamic workbooks that solve some cool problems. This presentation is an overview of what Visual Studio Tools for office is about and how it applies to Excel 2003 and Office 2003.TRANSCRIPT
Scott LockMVP, MCPDManaging ConsultantExcella ConsultingJuly 24th, 2007
Special Thanks
Frank LaVigne for developing the original slide deck and inspiration for
demos
What exactly is VSTO?Pros & Cons of VSTO developmentThree Patterns of VSTO ProjectsAdvantages of VSTO Over VBA
Integration With Visual StudioXML Mapping in ExcelFuture of VSTO
VSTO: Visual Studio Tools for OfficeProvides design time integration with
Microsoft Office DocumentsAllows .NET Code to Interoperate
with Microsoft Office products It’s not your father’s VBA
Demo
Automation client
VSTO code is Managed CodeCode is stored in a DLL file
And not in the documentMore security optionsCan leverage existing .NET Libraries
XML, Web Services, etcAdditional Features
Caching
Creating a VSTO Customization Project
Deployment
Deployment model based on ClickOnce *Not “really” ClickOnce in VSTO 2005
Uses Manifests to version and locate assemblies Deployment Manifest – points to the most
current version of the application Application Manifest – contains info on
where the customization assembly is and host item classes to create
Deployment
How it works…
Workbook.xlsWorkbook.xls
Workbook.application(Embedded and File)
Workbook.application(Embedded and File)
Workbook.dll.manifestWorkbook.dll
Workbook.dll.manifestWorkbook.dll
C:\deploy\workbook_1.0.0.0
Workbook.dll.manifestWorkbook.dll
Workbook.dll.manifestWorkbook.dll
C:\deploy\workbook_1.0.0.1
Workbook.dll.manifestWorkbook.dll
Workbook.dll.manifestWorkbook.dll
C:\deploy\workbook_1.0.0.2
Security
Code Access Security is used to keep “evil” VSTO assemblies from executing
“Not Trusted” by default You must explicitly add the assembly
in order to execute VSTO Add scripts for automated deployments Use intellimirror for network deployments
to support disconnected machines Visual Studio automatically adds the
CAS entry each time you run in debug
Data Caching
XML Data Island used to cache data with workbook itself
Rich object model available to access data ServerDocument.CachedData
Full control over cache lifecycle or simple attribute based caching
Any object that can be serialized can be cached Datasets Strings Arrays
Publishing Attaching/Detaching customizationsCaching Data
XML Support
XML is supported using XML Maps Maps are schemas associated to a
workbook Workbooks can contain multiple maps Elements and attributes are visually
mapped to ranges in worksheetXML Data can be imported/exportedSpecial object XMLList used for
repeating elements
Excel’s Built-In XML Mapping Capabilities
Excel XML ToolkitProgrammatically Accessing XML
Excel Object Model
Application – Highest level Workbooks
▪ Worksheets▪ Ranges
Cells Access to these objects is through Interop
wrapper classes Classes are extended by VSTO
Ex. Microsoft.Office.Tools.Excel.Worksheet VSTO adds two additional range host controls
NamedRange, XMLMappedRange
Microsoft.Office.Tools.Excel vs. Microsoft Office.Interop.Excel Microsoft.Office.Tools extends native
objects Data-binding Richer event models
Extended objects added at design time are automatically created as host items and host controls Ex. Interop.Excel.Range does not have events,
Tools.Excel.Range adds events. Host items are not created at run time.
Are only Excel Native objects with no added features
Native object access via the innerobject property
Demo
Calling a WebserviceUsing Excel Objects
VSTO 2005 SE (Second Edition) released. Includes support for Office 2007 as well
as Add-In templates for VisioRibbonX API for developing custom
Office 2007 ribbons.
VSTO Provides a Smart Client complement to MOSS Development.
Books Visual Studio Tools for Office
by Eric Carter & Eric Lippert VSTO for Mere Mortals
by Kathleen McGrath & Paul StubbsWebsites
Office Zealothttp://www.officezealot.com
MSDN Office Developer Centerhttp://msdn2.microsoft.com/en-us/office/default.aspx
VSTO Developer Portalhttp://msdn2.microsoft.com/en-us/office/aa905533.aspx
Any questions?