This is an old revision of the document!
OpenDocument
Package home: | http://pear.php.net/package/OpenDocument |
---|---|
Current version: | 0.2.0 (alpha) was released on 2009-07-28 |
Source repository: | https://github.com/pear/OpenDocument |
OpenDocument is a package to create, read and update Open Document Format files. ODF is an XML-based file format for office documents such as spreadsheets, charts, presentations and word processing documents, with a standardised specification as an OASIS Committee Specification (v.1.2) and ISO/IEC 26300:2006 (v.1.0 with v.1.1 currently a Draft Amendment). The former specification is the most recently updated, is publicly available, and is the one we're working from for this PEAR package.
This wiki page coordinates the development of OpenDocument. It's not the documentation; just ideas about what we want and how we'll do it.
Development of the OpenDocument package was part of a Google Summer of Code project (anyone know which year?).
Other PHP ODF APIs
- OpenDocumentPHP by Norman Markgraf and Alex Latchford: http://opendocumentphp.org/ and http://sourceforge.net/projects/opendocumentphp/ Dormant since 2010-11-29.
- Dio by Étienne Bersac: http://gitorious.org/dio/pages/Home Domant since 2009-01-29.
API Design
The current (26db346) OpenDocument class layout looks like this:
Super-class | Class | Sub-class | Sub-sub-class |
---|---|---|---|
OpenDocument | |||
OpenDocument_Document | OpenDocument_Document_Text | OpenDocument_Debug_Text | |
OpenDocument_Manifest | |||
OpenDocument_Style | OpenDocument_ElementStyle | ||
PEAR_Exception | OpenDocument_Exception | ||
OpenDocument_Element | OpenDocument_StyledElement | OpenDocument_Element_Span | |
OpenDocument_Element_Paragraph | |||
OpenDocument_Element_Hyperlink | |||
OpenDocument_Element_Heading | |||
OpenDocument_Element_Text | |||
OpenDocument_Element_Bookmark | |||
OpenDocument_Storage | OpenDocument_Storage_Single | ||
OpenDocument_Storage_Zip |
Specification Structure
The specification has the following structure:
Namespaces: animation, chart, config, database, dr3d, drawing, form, manifest, meta, data style, office, presentation, script, table, text, style, xsl-fo-compatible, svg-compatible, smil-compatible, of, & odf.
ODF documents have two file-level organisational paradigms: the most common one is a packaged zip file containing a number of XML and other files; the second is a stand-alone single XML file. Both follow the standard file extension nomenclature: .odt
for word processing (text) documents; .ods
for spreadsheets; .odp
for presentations; .odb
for databases; .odg
for graphics; .odf
for formulae, mathematical equations.
Within these various XML files are the following elements:
Filename | Root Element | Child Elements |
---|---|---|
Stand-alone XML file: | ||
filename.ext | office:document | office:automatic-styles |
office:body | ||
office:font-face-decls | ||
office:master-styles | ||
office:meta | ||
office:scripts | ||
office:settings | ||
office:styles | ||
Packaged file (4 root elements): | ||
content.xml | office:document-content | office:automatic-styles |
office:body | ||
office:font-face-decls | ||
office:scripts | ||
styles.xml | office:document-styles | office:automatic-styles |
office:font-face-decls | ||
office:master-styles | ||
office:styles | ||
meta.xml | office:document-meta | office:meta |
settings.xml | office:document-settings | office:settings |
The <office:body> element contains what we think of as the actual different document types: <office:chart>
, <office:database>
, <office:drawing>
, <office:image>
, <office:presentation>
, <office:spreadsheet>
, <office:text>
.