Document representation
The OpenDocument format supports the following two ways of document representation: * As a collection of several sub-documents 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 extensions and with a defined structure of sub-documents. Each sub-document 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 set of document and sub-document definitions.
* As a single XML document – also known as ''Flat XML'' or ''Uncompressed XML Files''. Single OpenDocument XML files are not widely used, they are also unsupported on some office software which claims to support ODF (Microsoft Office applications version 2007 to 2013 do not recognize them). Filename extensions for a single OpenDocument XML documents are not defined in the OpenDocument technical specification, but commonly used are .xml
, .fodt
, .fods
, ... etc.
The recommended filename extensions and 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 the 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 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: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. The text below provides a brief summary of the format's capabilities.Metadata
The OpenDocument format supports storingContent
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 "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 and only have a binary representation. Examples for these kinds of objects are raster images, recorded audios and videos, and OLE objects. 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). 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.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 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''Spreadsheet formulas
OpenDocument version 1.2 fully describes mathematical formulas displayable on-screen. It is fully capable of exchanging spreadsheet data, formats,Encryption
When an OpenDocument file is password protected the file structure of the bundle remains the same, but contents of XML files in the package are encrypted using the following algorithm: # The file contents are compressed with the DEFLATE algorithm. # A checksum of a portion of the compressed file is computed (SHA-1 of the file contents, or SHA-1 of the first 1024 bytes of the file, or SHA-256 of the first 1024 bytes of the file) and stored, so password correctness can be verified when decrypting. # A digest (hash) of the user-entered password in UTF-8 encoding is created and passed to the package component. ODF versions 1.0 and 1.1 only mandate support for the SHA-1 digest here, while version 1.2 recommends SHA-256. # This digest is used to produce a derived key by undergoingFormat internals
An OpenDocument file commonly consists of a standard ZIP archive ( JAR archive) containing a number of files and directories; but OpenDocument file can also consist only of a single XML document. An OpenDocument file is commonly a collection of several subdocuments within a (ZIP) ''package''. An 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''. 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 ''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: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: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. It is important to note that this special file is always the first file entry in the ZIP archive and it is uncompressed. Because the ZIP header uses fields with fixed lengths, this allows the direct identification of the different OpenDocument formats without decompression of the content (e. g. with magic bytes).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 thMETA-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 forHistory
* Version 1.0 became an OASIS Standard on 2005-05-01; * Version 1.1 became an OASIS Standard on 2007-02-07; * Version 1.2 became an OASIS Standard on 2011-09-29; * Version 1.3 became an OASIS Standard on 2021-04-27.Versions detection
To indicate which version of the OpenDocument specification a file complies with, all root elements take anoffice:version
attribute (in the format ''revision.version'', such as office:version="1.1"
), which identifies the version of ODF specification that defined the associated element, its schema, its complete content, and its interpretation.
ODF 1.0/1.1
It is not mandatory to useoffice:version
attribute in ODF 1.0 and ODF 1.1 files, so when an element has office:version omitted, the element is based on ODF 1.0 or 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.
ODF 1.2 and newer
Theoffice:version
attribute shall be present in each and every Conformance
ODF 1.0/1.1
The OpenDocument specification does not specify which elements and attributes conforming applications 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.ODF 1.2
ODF 1.2 defines precisely the conformance needs. The specification defines conformance for documents, consumers, and producers, with two conformance classes called conforming and extended conforming. It further defines conforming text, spreadsheet, drawing, presentation, chart, image, formula and database front end documents. Chapter 2 defines the basic requirements for the individual conformance targets.Footnotes
References
External links