Developing for Office 2007

The New UI and Open XML format

This article was originally published on DNJ Online
DNJ Online
This article was originally published on DNJ Online
DNJ

The new user interface

That said, the most obvious change is to the user interface. Gone are the endless drop-down menus that always seem to hide the feature that you want beneath the ‘more' option at the bottom. Instead there is a new tabbed ‘ribbon' control wide enough to give you a much more meaningful representation of what each command will achieve. Commands are grouped in a more logical fashion and many support ‘live preview' which means that, as you pass your mouse across the option, your document changes to reflect the result of selecting it.

Which commands are displayed in the ribbon also depends on context. Select an area that you've formatted as a table in Excel 2007, for example, and the ribbon changes to display the commands that you might need when working on tables. Select a cell outside the table and the ribbon reverts to displaying more general formatting commands.

There are also new ‘document themes' that help you maintain a consistent use of fonts, colour and design across documents that you and your colleagues create in Excel, PowerPoint and Word 2007. There is a new graphics engine that is shared by all applications, while SmartArt makes it easy to insert professional-looking diagrams. Although at first the differences can be unsettling, they do on the whole make the Office applications considerably more productive, and there is much to help organisations maintain a consistent and professional look across all their documents.

Excel 2007 shows off its new conditional formatting feature.

Open XML file format

For the application developer, perhaps the most significant change is the adoption of an XML-based file format as the default for Word, PowerPoint and Excel 2007 documents. Although you can save documents in a format that is compatible with earlier versions of Office, with the familiar ‘doc', ‘ppt' and ‘xls' file extensions, the default is the new Open XML format recognisable by the ‘docx', ‘pptx' and ‘xlsx' file extensions.

These are actually ZIP files, as you can see if you change the file extension. Inside you find a number of XML documents, called ‘XML Parts', which represent various aspects of the document. In Word 2007, for example, the ‘styles.xml' Part contains details of the styles used by the document. Each slide in a PowerPoint presentation is stored as a separate XML Part.

What makes the Open XML file format so significant for developers is that it opens up the possibility of directly editing Word, PowerPoint and Excel documents without having to go through the corresponding application. Instead you can write .NET code that directly manipulates the XML Parts within the document where it resides on the server, using all the facilities offered by the .NET Framework for manipulating XML. You can insert text, change values in a spreadsheet or manipulate document properties.

Taking this further, you can insert an XML Part that contains custom data into a document, and you can then access that data from code or, thanks to the new Content Controls supported by Word 2007, from within the document itself. Content Controls allow data to be displayed and edited within a Word 2007 document, and can be set so they can't be deleted by the end user. This opens up all sorts of possibilities, particularly when it comes to automating workflow.

The Open XML specification has been submitted to the ECMA standards body. It does compete with the OpenDocument Foundation (ODF) format, which is supported by Sun Microsystems' StarOffice product and is an ISO standard. However both are based on XML which should make translation possible, and indeed Microsoft has announced the Open XML Translator project for this purpose, an open source initiative hosted at the SourceForge web site.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Brevity is the soul of wit” - Shakespeare