Chapter 9 Working with the Office Open XML 2.5 SDK
Office Open XML SDK for Excel
Office Open XML is an open and standardized XML format for Office 2007 or higher file, based on the following standards:
- ECMA-376
- ISO/IEC 29500-1:2008
These standards define the structure and the elements for Office Open XML files. The Office Open XML files themselves, i.e. *.xlsx
for Excel, are zipped archives that contain a specific directory and file structure. The files that hold the content of a spreadsheet are XML files like any other XML files.
The basic Office Open XML file components are:
- Package: The zipped archive itself, e.g.,
filename.xlsx
- Parts: The files inside the package holding the content. Most of these are XML files, but other files types, such as binary, are possible.
- Content types: Each part has an associated content type that is enforced on open.
- Relationships: Associations between the package and its top-level parts, and between parent parts and child parts.
This table provides an example of the XML structure and files in an Excel .xlsx
file.
Example Excel .xslx file structure
|
Relationships among XML components |
|
Relationships among XML components |
|
Drawing components used in the worksheets |
|
The worksheet data files |
|
Strings shared among worksheet cells |
|
Styles used in the worksheets |
|
Sheets, controls, and other components that are used in the workbook |
|
Defines parts and extensions for the spreadsheet |
The Office Open XML 2.5 SDK provides an API to help in the direct interaction with XML elements between an application and xlsx
files, without Excel or any other Office application having to be installed on the development or deployment machine. The following sections describe the new reference assembly for Objective Grid for .NET, and a sample that illustrates the use of the API.