Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath

Mike Riley

October 30, 2009

3 Min Read
ITPro Today logo in a gray background | ITPro Today

PRObooks

 

Visual Studio Tools for Office: Using C# with Excel, Word,Outlook, and InfoPath

I have been using Visual Basic for Applications (VBA)within the Microsoft Office family of applications for more than 10 years, yetI still recall the surge of empowerment I experienced when my first VBA-enabledExcel workbook turned a static spreadsheet into an autonomic formatting andreporting machine. A long time has passed, and Microsoft has elevated the .NETFramework to be the all-encompassing, universal pathway to Microsoftapplication automation. For those like me, migrating from the familiar confinesof VBA to the lesser-known .NET VSTO became a much easier and rewardingexperience on account of the clear explanations and detail presented in thisbook. Authors Eric Carter and Eric Lippert agree, and have written thedefinitive tome on making this leap to .NET office automation even easier.

 

As the subtitle of the book states, it teaches readersabout Microsoft Excel, Word, Outlook, and InfoPath automation using the C#programming language. The first two chapters orient the reader to the objectmodels used for .NET office automation, as well as give a flavor of how the C#language is used to instantiate and manipulate objects exposed by the toolkit. About half the book then explores .NET object models and codeexamples for Excel, Word, Outlook (taking up a majority of the pages), andInfoPath. The remaining half of the book explores using Windows Formswith the toolkit, creating custom extensions and Office add-ins, andmanipulating the Office containers and features (such as the action panes,smart tags, client- and server-side data models, .NET code security anddeployment, and even consuming and manipulating XML in Excel, Word, andInfoPath). Throughout these chapters, the authors (both of whom are Microsoftemployees, with Eric Carter being the lead developer on VSTO) supply clearexplanations and ample code to demonstrate the concepts.

 

While this book is invaluable for Office developers, it snot perfect. Given my VBA background, I would have preferred to seeside-by-side code comparisons between VBA and C#, as it seemed in some casesthat it took more lines of C# to accomplish the same thing in VBA. Also, beyondstrictly teaching the objects and processes required to manipulate Officeobjects, it would have been great to see an ber-Office automation exampletying in everything learned into an application that really demonstrated thepower of what .NET and Office can do together. Something like a smart tag that,when selected, populated an Excel chart for a selected individual in a list,compiling server-based data and formatting it especially for that person,embedding that chart into a Word document with additional detail (like a 401kstatement, for example), and ultimately attaching that document to a formattedOutlook message. There s also nary a word on where the sample code can bedownloaded it s not available from the book s Web site, and no URLs aredisclosed in the book. Lastly, it would have been useful insight to at leastacknowledge Access in the VSTO context and what plans, if any, the VSTO teamhas to incorporate this major Office application into the VSTO model.

 

Even with these minor criticisms, this book will withoutquestion accelerate understanding and practical use of the technology,particularly for those progressive developers who have already realized thepower of leveraging the .NET Framework and the familiarity of the C# syntax forautomation contexts.

 

Mike Riley

 

Rating:

Title: Visual Studio Tools for Office: Using C#with Excel, Word, Outlook, and InfoPath

Authors: EricCarter and Eric Lippert

Publisher: Addison-Wesley

ISBN: 0-321-33488-4

Web Site: http://www.awprofessional.com/title/0321334884

Price: US$49.99

Page Count: 1,008

 

 

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like