OpenDocument technical specification

From Wikipedia, the free encyclopedia

OpenDocument Format

This document describes the technical specifications of the OpenDocument office document standard, as developed by the OASIS industry consortium. The standard was publicly developed by a variety of organizations, and is publicly accessible, meaning it can be implemented by anyone without restriction. The OpenDocument format is intended to provide an open alternative to proprietary document formats.

Contents

[edit] File types

The recommended file extensions and MIME types are included in the official standard (OASIS, May 1, 2005).

[edit] Documents

The most common file extensions used for OpenDocument documents are .odt for text documents, .ods for spreadsheets, .odp for presentation programs, and .odg for graphics. These are easily remembered by considering ".od" as being short for "OpenDocument", and then noting that the last letter indicates its more specific type (such as t for text). Here is the complete list of document types, showing the type of file, the recommended file extension, and the MIME:

File type Extension MIME Type
Text .odt application/vnd.oasis.opendocument.text
Spreadsheet .ods application/vnd.oasis.opendocument.spreadsheet
Presentation .odp application/vnd.oasis.opendocument.presentation
Drawing .odg application/vnd.oasis.opendocument.graphics
Chart .odc application/vnd.oasis.opendocument.chart
Formula .odf application/vnd.oasis.opendocument.formula
Image .odi application/vnd.oasis.opendocument.image
Master Document .odm application/vnd.oasis.opendocument.text-master

[edit] Templates

OpenDocument also supports a set of template types. Templates represent formatting information (including styles) for documents, without the content themselves. The recommended filename extension begins with ".ot" (which can be viewed as short for "OpenDocument template"), with the last letter indicating what kind of template (such as "t" for text). The supported set are:

File type Extension MIME Type
Text .ott application/vnd.oasis.opendocument.text-template
Spreadsheet .ots application/vnd.oasis.opendocument.spreadsheet-template
Presentation .otp application/vnd.oasis.opendocument.presentation-template
Drawing .otg application/vnd.oasis.opendocument.graphics-template
Chart template .otc application/vnd.oasis.opendocument.chart-template
Formula template .otf application/vnd.oasis.opendocument.formula-template
Image template .oti application/vnd.oasis.opendocument.image-template
Web page template .oth application/vnd.oasis.opendocument.text-web

[edit] Capabilities

As noted above, the OpenDocument format can describe text documents (e.g., those typically edited by a word processor), spreadsheets, presentations, drawings/graphics, images, charts, mathematical formulas, and "master documents" (which can combine them). It can also represent templates for many of them.

The official OpenDocument standard (OASIS, May 1, 2005) defines OpenDocument's capabilities. Haumacher (2005) provides a hyperlinks formal specification (Haumacher, 2005) derived from the official standard. Eisenberg (2005)'s book describes the format in more detail. The text below provides a brief summary of the format's capabilities.

[edit] Metadata

The OpenDocument format supports storing metadata (data about the data) by having a set of pre-defined metadata elements, as well as allowing user-defined and custom metadata. The predefined metadata are: Generator, Title, Description, Subject, Keywords, Initial Creator, Creator, Printed By, Creation Date and Time, Modification Date and Time, Print Date and Time, Document Template, Automatic Reload, Hyperlink Behavior, Language, Editing Cycles, Editing Duration, and Document Statistics.

[edit] Content

OpenDocument's text content format supports both typical and advanced capabilities. Headings of various levels, lists of various kinds (numbered and not), numbered paragraphs, and change tracking are all supported. Page sequences and section attributes can be used to control how the text is displayed. Hyperlinks, ruby text (which provides annotations and is especially critical for some languages), bookmarks, and references are supported as well. Text fields (for autogenerated content), and mechanisms for automatically generating tables such as tables of contents, indexes, and bibliographies, are included as well.

In the OpenDocument format, spreadsheets are an example of a set of tables. Thus, there are extensive capabilities for formatting the display of tables and spreadsheets. Database ranges, filters, and data pilots (known to Excel users as "pivot tables") are also supported. Change tracking is available for spreadsheets as well.

The graphics format supports a vector graphic representation, in which a set of layers and the contents[1] of each layer is defined. Available drawing shapes include Rectangle, Line, Polyline, Polygon, Regular Polygon, Path, Circle, Ellipse, and Connector. 3D Shapes are also available; the format includes information about the Scene, Light, Cube, Sphere, Extrude, and Rotate (it is intended for use as for office data exchange, however, and not sufficient to represent movies or other extensive 3D scenes). Custom shapes can also be defined.

Presentations are supported. Animations can be included in presentations, with control over the Sound, showing a shape or text, hiding a shape or text, or dimming something, and these can be grouped. In OpenDocument, much of the format capabilities are reused from the text format, simplifying implementations. However, tables are not supported within OpenDocument as drawing objects, so may only be included in presentations as embedded tables.

Charts define how to create graphical displays from numerical data. They support titles, subtitles, a footer, and a legend to explain the chart. The format defines the series of data that is to be used for the graphical display, and a number of different kinds of graphical displays (such as line charts, pie charts, and so on).

Forms are specially supported, building on the existing XForms standard.

[edit] Formatting

The style and formatting controls are numerous, providing a number of controls over how information is displayed.

Page layout is controlled by a variety of attributes. These include page size, number format, paper tray, print orientation, margins, border (and its line width), padding, shadow, background, columns, print page order, first page number, scale, table centering, maximum footnote height and separator, and many layout grid properties.

Headers and footer can have defined fixed and minimum heights, margins, border border line width, padding, background, shadow, and dynamic spacing.

There are many attributes for specific text, paragraphs, ruby text, sections, tables, columns, lists, and fills. Specific characters can have their fonts, sizes, and other properties set. Paragraphs can have their vertical space controlled through attributes on keep together, widow, and orphan, and have other attributes such as "drop caps" to provide special formatting. The list is extremely extensive; see the references (in particular the actual standard) for details.

[edit] Spreadsheet formulas issue

OpenDocument is fully capable of describing mathematical formulas that are displayed on the screen. It is also fully capable of exchanging spreadsheet data, formats, pivot tables, and other information typically included in a spreadsheet. OpenDocument can exchange spreadsheet formulas (formulas that are recalculated in the spreadsheet); formulas are exchanged as values of the attribute table:formula.

However, some believe that the allowed syntax of table:formula is not defined in sufficient detail. The OpenDocument version 1.0 specification defines spreadsheet formulas using a set of simple examples which show, for example, how to specify ranges and the SUM() function. Some critics argue that a more detailed, precise specification for spreadsheet functions, including syntax and semantics, should be created to augment these examples. The OpenDocument committee argued that this was outside their scope, since the syntax of such formulas is not in XML. Others have argued that, while the specification is less specific than one might like, the intent is fairly clear (especially since formulas tend to follow decades-long traditions), and also because the vast majority of spreadsheets only use a small set of functions (such as SUM) which are universally supported by all spreadsheet implementations anyway. In practice, many developers look to OpenOffice.org as a "canonical implementation"; since its code is public for anyone to review, and its XML output can be trivially inspected, this can resolve many questions. There is draft work proposing a more detailed specification for spreadsheet formulas (e.g. OpenFormula). Such work is expected to simply clarify in more detail what is acceptable in a spreadsheet formula; no one expects such work to invalidate any of the current OpenDocument standard. The OASIS OpenDocument Formula sub group is currently standardizing the table:formula, based on the OpenFormula draft. For more information (see the OpenFormula article).

[edit] Format internals

An OpenDocument file is a JAR compressed archive containing a number of files and directories. This simple compression mechanism means that OpenDocument files are normally significantly smaller than equivalent Microsoft ".doc" or ".ppt" files. This smaller size is important for organizations who store a vast number of documents for long periods of time, and to organizations those who must exchange documents over low bandwidth connections. Once uncompressed, most data is contained in simple text-based XML files, so the data contents (once uncompressed) have the typical ease of modification and processing of XML files. The standard also allows for the creation of a single XML document, which uses <office:document> as the root element, for use in document processing.

Directories can be included to store images, non-SMIL animations, and other files that are used by the document but cannot be expressed directly in the XML.

Due to the openly specified compression format used, it is possible for a user to extract the container file to manually edit the contained files. This allows a corrupted file to be repaired or low level manipulation of the contents. It is known that many programs which implement the OpenDocument format do not utilise high compression levels. It is therefore possible for the user to optimise the file sizes by using more aggressive compression programs. This may be coupled with a number of image optimisation programs being used on the contained pictures and has been seen to give over 40% reduction in file size over a file directly saved from an OpenDocument compatible program[1].

The zipped set of files and directories includes the following:

  • XML files
    • content.xml
    • meta.xml
    • settings.xml
    • styles.xml
  • Other files
    • mimetype
  • Directories
    • META-INF/
    • Thumbnails/

The OpenDocument format provides a strong separation between content, layout and metadata. The most notable components of the format are described in the subsections below. The files in XML format are further defined using the RELAX NG language for defining XML schemas. RELAX NG is itself defined by an OASIS specification, as well as by part two of the international standard ISO/IEC 19757: Document Schema Definition Languages (DSDL).

[edit] content.xml

content.xml is the most important file. It carries the actual content of the document (except for binary data, like images). The base format is inspired by HTML, and though far more complex, it should be reasonably legible to humans:

<text:h style-name="Heading_2">This is a title</text:h>
<text:p style-name="Text_body"/>
<text:p style-name="Text_body">
   This is a paragraph. The formatting information is
   in the Text_body style. The empty text:p tag above
   is a blank paragraph (an empty line).
</text:p>

[edit] styles.xml

styles.xml contains style information. OpenDocument makes heavy use of styles for formatting and layout. Most of the style information is here (though some is in content.xml). Styles types include:

  • Paragraph styles.
  • Page Styles.
  • Character Styles.
  • Frame Styles.
  • List styles.

The OpenDocument format is somewhat unusual in that using styles for formatting cannot be avoided. Even "manual" formatting is implemented through styles (the application dynamically makes new styles as needed).

[edit] meta.xml

meta.xml contains the file metadata. For example, Author, "Last modified by", date of last modification, etc. The contents look somewhat like this:

<meta:creation-date>2003-09-10T15:31:11</meta:creation-date>
<dc:creator>Daniel Carrera</dc:creator>
<dc:date>2005-06-29T22:02:06</dc:date>
<dc:language>es-ES</dc:language>
<meta:document-statistic
      table-count="6" object-count="0"
      page-count="59" paragraph-count="676"
      image-count="2" word-count="16701"
      character-count="98757"/>

The names of the <dc:...> tags are taken from the Dublin Core XML standard.

[edit] settings.xml

settings.xml includes settings such as the zoom factor or the cursor position. These are properties that are not content or layout.

[edit] mimetype (file)

mimetype is just a one-line file with the mimetype of the document. One implication of this is that the file extension is actually immaterial to the format. The file extension is only there for the benefit of the user.

[edit] Reuse of existing formats

OpenDocument is designed to reuse existing open XML standards whenever they are available, and it creates new tags only where no existing standard can provide the needed functionality. So, OpenDocument uses a subset of DublinCore for metadata, MathML for displayed formulas, SMIL for multimedia, XLink for hyperlinks etc.

Although not fully reusing SVG for vector graphics, Opendocument does use SVG compatible vector graphics within an ODF format specific namespace but also includes non SVG graphics.

[edit] References

[edit] External links

Languages