Why is the file format important

The new "open" XML file formats for Microsoft Office represent a significant step for the computing community. For the first time, it's relatively easy to read and write Excel workbooks using software other than Excel. For example, it's possible to write a program to modify thousands of Excel workbook files without even opening Excel. Such a program could insert a new worksheet into every file. The programmer, of course, would need to have excellent knowledge of the XML file structures, but such a task is definitely doable.

Importantly, the new file formats are much less prone to corruption (compared to the old binary formats). I saved a workbook file and then deleted one of the worksheet XML files. When I tried to reopen it in Excel, I got the message shown in Figure 4-7. Excel was able to tell that the file was damaged by comparing the information in the .res files with what's actually in the file. In this case, Excel was able to repair the file and open it. The deleted worksheet was re-inserted, but it was empty.

Figure 4-7: Excel can often repair a damaged workbook file.

Figure 4-7: Excel can often repair a damaged workbook file.

In addition, the zipped XML files are usually smaller than comparable binary files. And, finally, the structured nature of the files makes it possible to extract individual elements (for example, all graphic images).

The typical Excel user won't need to examine or modify the XML components of a workbook file. But, as a developer, you may want to write code that changes Excel's Ribbon user interface. If that's the case, you will need to be at least somewhat familiar with the structure of a workbook XML file.

CROSS- Refer to Chapter 22 for more information about modifying Excel's Ribbon.

REFERENCE

The QAT File

The only user interface element in Excel 2007 that's customizable by the end user is the Quick Access Toolbar. The information for the QAT is stored in a file named Excel.qat, and this file is located here:

C:\Documents and Settings\<usemame>\Local Settings\Application Data\ Microsoft\OFFICE

This file is updated whenever a change is made to the QAT. It's updated immediately, not when Excel is closed.

Excel.qat is an XML file, and you can view it using an XML editor, a Web browser, or Excel. To view this file in Excel, follow these steps:

1. Make a copy of the Excel.qat file.

2. Add an XML extension to the copy of the file so that the name is Excel.qat.xml.

3. Choose Office Open to open the file or just drag it into Excel's window.

4. You'll see a dialog box with some options; choose As an XML Table.

Figure 4-8 shows an imported Excel.qat file (the file is displayed as a table). This QAT has three commands in addition to the eleven default commands. Of the default commands, only three are visible.

A

B

c j

1

MQ

vi s iL ft: E

2

msciFileNevii befaii It

FALSE

3

mso:FileOpen

FALSE

4

TRUE

5

rns o.Fi le Se rid A j A ttachai ent

FALSE

6

rnso:FilePrintQijick

FALSE

7

mi o : Fi le Pri nt Pre v i e\v

FALSE

8

mso:Spel!tng

FALSE

9

rnso:undo

TRUE

10

rnso:fiedo

TRUE

11

ms o :SortAi ce n d i ngE* eel

FALSE

12

mi q :Sort De see nd trigE xce L

FALSE

13

msoiSheetRowslnsert

TRUE

14

rns D : Win do w save1workspace

TRUE

15

ms o :0 le Ob je et rti nsert

TRUE ,

15

t

14 à

' ► n Sheet 1 ?J

4 HI

_

Figure 4-8: Viewing a QAT data file in Excel.

Figure 4-8: Viewing a QAT data file in Excel.

It's possible to share a QAT with other users. For example, you may have customized your QAT with two dozen useful tools. If a colleague is impressed, just give him a copy of your Excel.qat file and tell him where to put it.

Don't attempt to modify the Excel.qat file unless you know what you're doing.

The XLB File

Excel stores customized toolbar and menu bar configurations in an XLB file. Even though Excel 2007 doesn't officially support custom toolbars and menus in the way that it did in previous versions, it still uses an XLB file.

When you exit Excel, the current toolbar configuration is saved in a file named Excel 12 . xlb. This file is (most likely) located here:

C:\Documents and Settings\<usemame>\Application Data\Microsoft\Excel

This binary file contains information regarding the position and visibility of all custom toolbars and custom menu bars, plus modifications that you've made to built-in toolbars or menu bars.

4 PREV

NEXT

0 0

Responses

Post a comment