Q&A: Using .NET to Build on Microsoft Office

REDMOND, Wash. Feb 2, 2005 — This week, at the first Microsoft Office System Developer Conference, Microsoft is introducing Visual Studio 2005 Tools for the Microsoft Office System (VSTO 2005), which enables the millions of developers with skills developing on the Microsoft .NET Framework to apply those skills to creating custom solutions on top of Microsoft Excel 2003, Microsoft Word 2003 and Microsoft InfoPath 2003.



KD Hallman, General Manager, Microsoft Visual Studio Tools for Office

PressPass asked KD Hallman , general manager for Visual Studio Tools for Office, to explain what is new in this version of the tools and what benefits they bring to developers and end users. Joining Hallman was Chris Kunicki , an industry veteran who provides strategic consulting on the Microsoft Office System. Kunicki is also the founder and editor-in-chief of www.OfficeZealot.com, a community-oriented Web site for Microsoft Office developers, administrators and users, where he shares his insights and best practices for building solutions on the Office platform.

PressPass: What is VSTO 2005?

Hallman: VSTO 2005 is a member of the Microsoft Visual Studio product family that enables Visual C# and Visual Basic .NET developers to build custom applications using Microsoft Excel 2003, Microsoft Word 2003 and Microsoft InfoPath 2003. VSTO 2005 brings the security, ease of application deployment and developer productivity of Microsoft Visual Studio and the .NET Framework to business solutions using Microsoft Office System as a development platform. These solutions can take full advantage of Microsoft Excel’s calculation and presentation features, Microsoft Word’s document formatting and text management features and Microsoft InfoPath’s information gathering and management features. These solutions can leverage Extensible Markup Language (XML) and Web services to enable information workers using Microsoft Office System to easily interact with enterprise-wide processes and corporate data.

PressPass: What advantages does VSTO 2005 provide over previous tools for building solutions on Microsoft Office?

Hallman: Today, Visual Basic for Applications (VBA) and COM-based (Component Object Model) automation are the traditional methodology for building solutions on the Microsoft Office platform. While many of our customers have been extremely successful in using Office not only as a productivity suite but as a platform for building custom applications, there are some development scenarios that we knew we could simplify even further. In addition to reducing the amount of code that a developer has to write, we also knew that developers would want to take advantage of the security and deployment features that were present in the .NET Framework. With VSTO 2005, we have lessened development complexity tremendously, so a programmer who has never learned the object models of Microsoft Office System applications can build very powerful solutions using the most popular programming languages, Visual Basic .NET and Visual C# .NET.



Chris Kunicki, Editor in Chief, OfficeZealot

Kunicki: Up until now, people have used VBA and COM-oriented technologies to automate Microsoft Office. While these technologies have worked well, the Microsoft .NET Framework and Visual Studio have emerged and the differences in power and productivity have become quite apparent. Customers, already drawn to .NET for most of their enterprise development efforts, are now looking to adopt this on the desktop as well.

That’s where the previous version, Visual Studio 2003 Tools for the Microsoft Office System, became interesting. It allowed .NET developers to program reliably and securely for Microsoft Word and Excel. In other words, it enabled professional .NET developers without Microsoft Office experience to use the development tools they were familiar with to create solutions for Microsoft Office. VSTO 2005 is even a bigger step forward. Not only does it bring Microsoft Office into the .NET world, but it provides capabilities and solutions that weren’t even possible with the previous version of VSTO 2005 — or anything else.

PressPass: What new features does VSTO 2005 offer to developers?

Hallman: Probably the largest new feature set is in the way VSTO 2005 uses XML to separate data from the way it’s presented (its “view”), making it simpler to build Office-based solutions and to keep those solutions from breaking when documents change. Specifically, VSTO 2005 enables data to be embedded as an XML data island within an Office document, and is thus able to update the data directly without having to write view code. For example, a developer codes to Customer.ID rather than ActiveWorkbook.Worksheets(“Sheet1”)Range(2, 2).Cells(1, 1).Value. This capability to program directly to data through an XML schema-based model dramatically improves developer productivity. Code that works with data does not need to address the Microsoft Excel, Word and InfoPath object models. This simplifies much of the code involved in building Microsoft Office solutions and makes solutions resilient to changes in the document.

VSTO 2005 also improves how we support Microsoft Excel, Microsoft Word, and Microsoft InfoPath programming by representing elements such as cells, ranges, lists, and bookmarks as first-class controls that can be easily accessed in code.

Kunicki: The VSTO 2005 feature that I find most exciting is the managed action pane technology, which enables programmatic creation of task panes. This is exciting because end users often need assistance while in the user interface, but they don’t like dialogue boxes interfering in their work experience. The action pane enables us to make information available without the need to open dialogue boxes. In fact, we call action pane technology the “dialogue-box killer.” The second feature I’m really excited about is the ability to use managed user controls. Historically, to implement user controls in Microsoft Office System required the deployment of the ActiveX control, which is very complex. VSTO 2005 allows us to put rich, managed user controls right inside the document or workbook. These give us an alternative way to interact with users while they’re navigating through Microsoft Office applications, almost like an alternative user interface. Using these tools, we can build inline user-interface elements that move with users, but without getting in the way, so users receive the information they need based on the context of where they are in a workbook or document. It’s almost like a floating layer above the application. These inline user-interface elements change to provide the appropriate information based on whatever cell the user is in.

Another exciting set of features is VSTO 2005’s data capabilities. These exist at two levels. First, I can now persist data, such as an ADO.NET data set, a custom business object, or even an XML object, into the document and bind those data sources right into the document as a data island. So whenever the document opens, it loads the data source and populates the data to the document.

The cool thing here is that I can do this on both the client and on the server. On the server, I can open the document, shove data into it, and when the user opens it on their side, the data binding kicks in and populates the document. The user makes changes to the document, and that data is persisted back into a data cache, which is basically an off-line version of data that lives and moves with the document. When the user is finished, the data can saved or submitted back up to a server, where the data can be extracted into a library. In effect, this allows us to separate data from the presentation.

Making data in Microsoft Office System documents a transparent, directly accessible component enables new server-side opportunities. First, the data island embedded in the document can be manipulated without starting the Office application. This is a dramatic shift from the current model, where, in order for code to manipulate the contents of the document, Microsoft Office System applications must be running.

By contrast, the VSTO 2005 will support instantiation on a server without the need to run the application. The data island in a document can then be manipulated from the server-side code. When the user opens the associated Microsoft Office System document the view would be re-synchronized with the data island and the user would be automatically presented with the updated data. For instance, an ASP.NET developer wouldn’t need to know the ins and outs of Microsoft Office development to access the data contained in Microsoft Office System documents. All this developer needs to know is that there’s a library that allows data to be added or extracted from Microsoft Office applications, without having to touch Microsoft Office System application code.

PressPass: What are the benefits of VSTO 2005 to developers?

Hallman: Productivity. VSTO 2005 provides developers all the productivity of Visual Studio and the power of the .NET Framework, so it leverages the skills that developers already have as Visual Studio .NET, VB.NET and C# developers and extends them into the Microsoft Office System.

What’s more, VSTO 2005 also delivers tremendous savings of developer time and effort. In the previous version, if a developer wanted to display the action pane inside a Microsoft Word or Excel document, it would require about 600 lines of code. In VSTO 2005, it takes one line of code. This is an extreme example of how VSTO 2005 provides increased developer productivity, but it’s not atypical. The total time- and effort-savings impact of VSTO 2005 — provided by the new programming model, easy access to Web services, to ADO.NET, integrated debugging, and an improved click-once deployment model — all add up to substantial productivity gains for developers writing solutions for the Microsoft Office System. Combine this with the innovative new features in the integrated design environment, such as intellitasks, code refactoring in C#, autocomplete, data sources window and wizards, and the developer has a powerful set of tools to build enterprise-scale, robust applications.

There are 400 million users of Microsoft Office world-wide. That’s a large audience for custom application development. From an enterprise standpoint, a typical workforce can take applications built on Microsoft Word, Excel and InfoPath and use them intuitively, without a steep learning curve. That translates into training cost savings. VSTO 2005 allows professional developers to address the needs of a huge and diverse enterprise audience quickly.

Kunicki: VSTO 2005 provides productivity gains to both the developer and the end user of Microsoft Office System applications. I know of companies moving to Microsoft Office System 2003 for the productivity benefits alone. When a developer creates an application, a lot of time is spent mapping data elements, placing them where they should appear in the document. With VSTO 2005, this is a drag-and-drop experience rather than a code-writing experience. The time savings can be significant. A basic application may take two or three hours to code, because the developer has to programmatically navigate through the document, insert the data, move to the next element, retrieve the data set, insert it, and move on. However, using VSTO 2005, the mapping process for Microsoft Office documents of similar size and complexity would take 30 minutes, because the coding is automated.

Another benefit to the developer is the ability to abstract business logic into a Web service layer, eliminating the need for the developer to duplicate business logic on the client. Also, the managed code itself sits as an external .NET managed assembly from the document itself. Because the developer can deploy the code base to the server, he or she can centrally update it and distribute the changes without having to touch client machines or documents.

This also produces a faster and richer end user experience. Pre-designed Microsoft Office System templates can be populated with data from back-end systems much more quickly using XML and .NET. .NET talks to Web services natively, so data is quickly and efficiently supplied to the template. Office applications, because they now have XML support, can do this with very little code. So not only is there less code to write, because the Office application transforms the XML right in the document itself, there’s also a significant speed benefit.

For instance, I’ve seen an 80-page template with 200 data elements that have to be populated from back-office data sources. Using traditional coding, the process of populating the form could take 45 seconds to a minute. Using the XML capabilities in VSTO 2005, this process has been reduced to just two seconds.

VSTO 2005 is alluring to professional developers because they can use the tools they are already familiar with in an environment they are comfortable with to automate an environment their users are familiar with. They don’t have to reinvent the wheel. Through community discussion at OfficeZealot.com, I’ve heard a number of developers say that VSTO 2005 gives them the motivation to have another look at Microsoft Office System as a development platform.

Related Posts