OpenDocument technical specification

OpenDocument technical specification
OpenDocument Format

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

Contents

File types

Document Representation

The OpenDocument format supports the following two ways of document representation:

  • As a single XML document - also known as Flat XML or Uncompressed XML Files. Single OpenDocument XML files are not widely used. Filename extensions for a single OpenDocument XML documents are not defined in the OpenDocument technical specification, but commonly used are .xml, .fodt,[1][2] .fods, ... etc.
  • As a collection of several subdocuments within a package, each of which stores part of the complete document. This is the common representation of OpenDocument documents. It uses filename extensions such as .odt, .ott, .ods, .odp ... etc. The package is a standard ZIP file with different filename extension and with defined structure of subdocuments. Each subdocument within a package has a different document root and stores a particular aspect of the XML document. All types of documents (e.g. text and spreadsheet documents) use the same document and subdocuments definitions.

The recommended filename extensions and MIME types are included in the official standard (OASIS, May 1, 2005 and its later revisions or versions). The MIME types and extensions contained in the ODF specification are applicable only to office documents that are contained in a package. Office documents that conform to the OpenDocument specification but are not contained in a package should use the MIME type text/xml.

The MIME type is also used in office:mimetype attribute. It is very important to use this attribute in flat XML files/single XML documents, where this is the only way the type of document can be detected (in a package, the MIME type is also present in a separate file mimetype). Its values are the MIME types that are used for the packaged variant of office documents.

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 Type:

File type Extension MIME Type ODF specification
Text .odt application/vnd.oasis.opendocument.text 1.0
Spreadsheet .ods application/vnd.oasis.opendocument.spreadsheet 1.0
Presentation .odp application/vnd.oasis.opendocument.presentation 1.0
Drawing .odg application/vnd.oasis.opendocument.graphics 1.0
Chart .odc application/vnd.oasis.opendocument.chart 1.0
Formula .odf application/vnd.oasis.opendocument.formula 1.0
Image .odi application/vnd.oasis.opendocument.image 1.0
Master Document .odm application/vnd.oasis.opendocument.text-master 1.0
Database .odb application/vnd.sun.xml.base[3][4] not defined in ODF 1.0/1.1 specifications;
used in OpenOffice.org 2.x
Database .odb application/vnd.oasis.opendocument.base Draft of ODF 1.2;[5]
used in OpenOffice.org 3.x
Database .odb application/vnd.oasis.opendocument.database defined in IANA registration
all OpenDocument single/flat XML files not defined text/xml 1.0

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" (interpretable as short for "OpenDocument template"), with the last letter indicating what kind of template (such as "t" for text). The supported set includes:

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

Capabilities

As noted above, the OpenDocument format can describe text documents (for example, 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 version 1.0 (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.

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 format predefines the following metadata fields:

  • 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
  • Document Statistics

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.

The OpenDocument format implements spreadsheets as sets of tables. Thus it features extensive capabilities for formatting the display of tables and spreadsheets. OpenDocument also supports database ranges, filters, and "data pilots" (known in Microsoft Excel contexts as "pivot tables"). 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. Users can include animations 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.

Objects

A document in OpenDocument format can contain two types of objects, as follows:

  • Objects that have an OpenDocument representation. These objects are:
    • Formulas (represented as MathML)
    • Charts
    • Spreadsheets
    • Text documents
    • Drawings
    • Presentations
  • Objects that do not have an XML representation. These objects only have a binary representation. An example for this kind of objects are OLE objects. (According to the OpenDocument 1.0 specification, OLE is defined in Kraig Brockschmidt, Inside OLE, Microsoft Press, 1995, ISBN 1-55615-843-2.)

Use of Microsoft Object Linking and Embedding (OLE) objects limits the interoperability, because these objects are not widely supported in programs for viewing or editing files (e.g. embedding of other files inside the file, such as tables or charts from a spreadsheet application in a text document or presentation file).[6][7][8][9][10] If a software that understands an OLE object is not available, the object is usually replaced by a picture (bitmap representation of the object) or not displayed at all.[11][12][13]

Formatting

The style and formatting controls are numerous, providing a number of controls over the display of information.

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, generic font family names (roman - serif, swiss - sans-serif, modern - monospace, decorative, script or system), 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.

Spreadsheet formulas issue

OpenDocument is fully capable of describing mathematical formulas displayable on-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[who?] 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[who?] argue that a more detailed, precise specification for spreadsheet functions, including syntax and semantics, should be created[by whom?] 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[who?] 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[which?] look to OpenOffice.org as a "canonical implementation"; since anyone can review its published code, 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).

Format internals

An OpenDocument file commonly consists of a standard ZIP archive (JAR archive[14]) containing a number of files and directories; but OpenDocument file can also consist only of a single XML document. OpenDocument file is commonly a collection of several subdocuments within a (ZIP) package. OpenDocument file as a single XML is not widely used. According to the OpenDocument 1.0 specification, the ZIP file specification is defined in Info-ZIP Application Note 970311, 1997.[15][16] The simple compression mechanism used for a package normally makes OpenDocument files 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 those organizations who must exchange documents over low bandwidth connections. Once uncompressed, most data is contained in simple text-based XML files, so the uncompressed data contents 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.

The standard allows the inclusion of directories 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 repair of a corrupted file or low-level manipulation of the contents. It is known[by whom?] that many programs which implement the OpenDocument format do not utilise high compression levels. Users can therefore 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.[17]

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/
      • manifest.xml
    • Thumbnails/
      • thumbnail.png

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).

content.xml

content.xml, the most important file, carries the actual content of the document (except for binary data, such as 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>

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).

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 come from the Dublin Core XML standard.

settings.xml

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

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.

Thumbnails (directory)

Thumbnails is a separate folder for a document thumbnail. The thumbnail must be saved as “thumbnail.png”. A thumbnail representation of a document should be generated by default when the file is saved. It should be a representation of the first page, first sheet, etc. of the document. The required size for the thumbnails is 128x128 pixel. In order to conform to the Thumbnail Managing Standard (TMS) at www.freedesktop.org, thumbnails must be saved as 24bit, non-interlaced PNG image with full alpha transparency.

META-INF (directory)

META-INF is a separate folder. Information about the files contained in the OpenDocument package is stored in an XML file called the manifest file. The manifest file is always stored at the pathname META-INF/manifest.xml. The main pieces of information stored in the manifest are:

  • A list of all of the files in the package.
  • The media type of each file in the package.
  • If a file stored in the package is encrypted, the information required to decrypt the file is stored in the manifest.

Pictures (directory)

Pictures is a separate folder for images included in the document. This folder is not defined in the OpenDocument specification. Files in this folder can use various image formats, depending on the format of inserted file. While the image data may have an arbitrary format, it is recommended that bitmap graphics are stored in the PNG format and vector graphics in the SVG format.

Reuse of existing formats

By design, OpenDocument reuses existing open XML standards whenever they are available, and it creates new tags only where no existing standard can provide the needed functionality. Thus 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.

History

  • Version 1.0 became an OASIS standard on 2005-05-01[18]
  • Version 1.1 became an OASIS standard on 2007-02-07[19]

Versions detection

To indicate which version of the OpenDocument specification a file complies with, all root elements take an office:version attribute. The version number is in the format revision.version (e.g. office:version="1.1"). The office:version attribute identifies the version of ODF specification that defined the associated element, its schema, its complete content, and its interpretation.

ODF 1.0/1.1

If the file has a version known to an XML processor, it may validate the document. Otherwise, it is optional to validate the document, but the document must be well formed. It is not mandatory to use office:version attribute in ODF 1.0 and ODF 1.1 files.

Draft version of ODF 1.2

The office:version attribute shall be present in each and every <office:document>, <office:document-content>, <office:document-styles>, <office:document-meta>, and <office:document-settings> element in the XML documents that comprise an OpenDocument 1.2 document. The value of the office:version attribute shall be "1.2".

When an element has office:version="1.1" the element and its content are based on the OpenDocument v1.1 specification. For office:version="1.0" the element and its content are based on the OpenDocument v1.0 specification. When an element has office:version omitted, the element is based on a version of the OpenDocument specification earlier than v1.2. In these cases and in the case of values other than "1.2", the elements do not comprise an OpenDocument 1.2 document.[20]

Conformance

ODF 1.0

The OpenDocument specification does not specify which elements and attributes conforming application must, should, or may support. Even typical office applications may only support a subset of the elements and attributes defined in the specification. The specification contains a non-normative table that provides an overview which element and attributes usually are supported by typical office application.

Documents that conform to the OpenDocument specification may contain elements and attributes not specified within the OpenDocument schema. Such elements and attributes must not be part of a namespace that is defined within the specification and are called foreign elements and attributes.

Conforming applications either shall read documents that are valid against the OpenDocument schema if all foreign elements and attributes are removed before validation takes place, or shall write documents that are valid against the OpenDocument schema if all foreign elements and attributes are removed before validation takes place. Conforming applications that read and write documents may preserve foreign elements and attributes. In addition to this, conforming applications should preserve meta information and the content of styles.

Conforming applications shall read documents containing processing instructions and should preserve them.

Draft version of ODF 1.2

A draft version of ODF 1.2 defines more precisely some conformance needs.[21] The final ODF 1.2 version was approved by Oasis as a Committee Specification on 26 March 2011.

Footnotes

  1. ^ "OpenOffice.org Document Version Control With Mercurial". http://www.ensode.net/roller/dheffelfinger/entry/openoffice_documents_version_control_with. Retrieved 2010-06-07. 
  2. ^ "Flat OpenDocument fodt on Windows". http://user.services.openoffice.org/en/forum/viewtopic.php?f=15&t=11103. Retrieved 2010-06-07. 
  3. ^ MIME types - OpenSolaris Default Applications, http://dlc.sun.com/osol/jds/downloads/sources/defaults.list, retrieved 2010-06-06 
  4. ^ .odb Extension - List of programs that can open .odb files, http://extension.nirsoft.net/odb, retrieved 2010-06-06 
  5. ^ Open Document Format for Office Applications (OpenDocument) Version 1.2, Part 1: Introduction and OpenDocument Schema, Committee Draft 04, 15 December 2009, http://docs.oasis-open.org/office/v1.2/part1/cd04/OpenDocument-v1.2-part1-cd04.html, retrieved 2010-06-06 
  6. ^ Bruce Byfield (2005-08-23). "FOSS word processors compared: OOo Writer, AbiWord, and KWord". http://www.linux.com/archive/feed/47307. Retrieved 2010-04-06. 
  7. ^ "Sharing files between OpenOffice.org and Microsoft Office". 2005-07-28. http://www.linux.com/archive/feed/46599. Retrieved 2010-04-06. 
  8. ^ "SoftMaker Office 2008 focuses on compatibility with Microsoft Office". 2008-11-20. http://www.linux.com/archive/feature/153229. Retrieved 2010-04-06. 
  9. ^ "SoftMaker Office 2006 beta: Not a killer app". 2006-11-21. http://www.linux.com/archive/feed/58330. Retrieved 2010-04-06. 
  10. ^ Philippe Lagadec (2006-11-30) (PDF), OpenOffice / OpenDocument and Microsoft Office 2007 / Open XML security, http://pacsec.jp/psj06/psj06lagadec-e.pdf, retrieved 2010-04-06 
  11. ^ "OLE object - bitmap representation?". http://www.keyongtech.com/2560234-ole-object-bitmap-representation. Retrieved 2010-04-06. 
  12. ^ "A Rich Edit Control That Displays Bitmaps and Other OLE Objects". http://www.codeproject.com/KB/edit/COleRichEditCtrl.aspx. Retrieved 2010-04-06. 
  13. ^ "ACC: Why OLE Objects Cause Databases to Grow". 2007-01-19. http://support.microsoft.com/kb/123151. Retrieved 2010-04-29. 
  14. ^ "Web resources & interesting links - easy and simple introduction to OpenDocument Format (ODF)". http://www-03.ibm.com/able/resources/odfintro.html. Retrieved 2010-06-07. 
  15. ^ "NEEDS-DISCUSSION: ZIP reference - N 1309". http://tools.oasis-open.org/issues/browse/OFFICE-2205. Retrieved 2010-06-07. 
  16. ^ "Zip reference is neither public nor authoritative". 2009-10-11. http://tools.oasis-open.org/issues/browse/OFFICE-2082. Retrieved 2010-06-07. 
  17. ^ "Discussion of a Linux Shell script for OpenDocument compaction". http://www.oooforum.org/forum/viewtopic.phtml?t=27452. 
  18. ^ "OASIS Open Document Format for Office Applications (OpenDocument) TC". OASIS website. OASIS. http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office. Retrieved 2010-02-08. "The OpenDocument v1.0 specification was approved as an OASIS Standard on 1 May 2005" 
  19. ^ "OpenDocument v1.1 Specification". OASIS website. OASIS. http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#odf11. Retrieved 2010-02-08. "The OpenDocument v1.1 specification was approved as OASIS Standard on 2 February 2007." 
  20. ^ "office:version attribute - OpenDocument Version 1.2, Part 1, Committee Draft 04, 15 December 2009". http://docs.oasis-open.org/office/v1.2/part1/cd04/OpenDocument-v1.2-part1-cd04.html#a_19_388_office_version. Retrieved 2010-06-07. 
  21. ^ "Conformance defined in OpenDocument Version 1.2, Part 1, Committee Draft 04, 15 December 2009". http://docs.oasis-open.org/office/v1.2/part1/cd04/OpenDocument-v1.2-part1-cd04.html#a_22_Conformance. Retrieved 2010-06-07. 

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • OpenDocument software — OpenDocument Format OpenDocument standardization OpenDocument technical specification OpenFormula OpenDocument adoption OpenDocument software Comparison of OpenDocument software This is an overview of software support for the OpenDocument format …   Wikipedia

  • OpenDocument standardization — OpenDocument Format OpenDocument standardization OpenDocument technical specification OpenFormula OpenDocument adoption OpenDocument software Comparison of OpenDocument software Main article: OpenDocument Contents …   Wikipedia

  • OpenDocument — Not to be confused with Open Document Architecture, OpenDoc, or Office Open XML. ODF redirects here. For other uses, see ODF (disambiguation). OpenDocument Format OpenDocument standardization OpenDocument technical specification OpenFormula… …   Wikipedia

  • OpenDocument adoption — World map of countries, using the OpenDocument standard   Officially approved …   Wikipedia

  • Comparison of OpenDocument software — OpenDocument Format OpenDocument standardization OpenDocument technical specification OpenFormula OpenDocument adoption OpenDocument software Comparison of OpenDocument software The OpenDocument format (ODF), an abbreviation for the OASIS Open… …   Wikipedia

  • OpenDocument — Vorlage:Infobox Dateiformat/Wartung/MagischeZahl fehltVorlage:Infobox Dateiformat/Wartung/Website fehlt OpenDocument Dateiendung: .od* (Vorlagen: .ot*) MIME Type: application/vnd.oasis.opendocument.* …   Deutsch Wikipedia

  • OpenDocument Format — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/website fehlt OpenDocument Dateiendung .od* (Vorlagen: .ot*) MIME Type application/vnd.oasis.opendocument.* Entwickelt von …   Deutsch Wikipedia

  • Opendocument — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/website fehlt OpenDocument Dateiendung .od* (Vorlagen: .ot*) MIME Type application/vnd.oasis.opendocument.* Entwickelt von …   Deutsch Wikipedia

  • OpenDocument — Texto OpenDocument Desarrollador Sun Microsystems, OASIS …   Wikipedia Español

  • Open XML Paper Specification — (OpenXPS) Filename extension .oxps, .xps Internet media type application/oxps, application/vnd.ms xpsdocument Developed by Micro …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”