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

_rels

Relationships among XML components

xl/_rels

Relationships among XML components

xl/drawings/drawing<1...n>.xml

Drawing components used in the worksheets

xl/worksheets/sheet<1...n>.xml

The worksheet data files

xl/sharedStrings.xml

Strings shared among worksheet cells

xl/styles.xml

Styles used in the worksheets

xl/workbook.xml

Sheets, controls, and other components that are used in the workbook

[Content_Types].xml

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.