ddn.odf.flat

Flat XML ODF support for single-file documents.

Flat XML ODF documents use office:document as the root element, combining what would be separate content.xml, styles.xml, meta.xml, and settings.xml streams into a single XML file.

Supported flat variants

  • .fodt — Flat text document
  • .fods — Flat spreadsheet document
  • .fodp — Flat presentation document
  • .fodg — Flat drawing document

Operations

  • isFlatOdfXml() detects flat XML from raw bytes
  • isFlatOdfExtension() checks file extensions
  • parseFlatOdf() / parseFlatOdfString() reads flat documents
  • serializeFlatOdf() writes flat documents back to XML

Round-trip preserves metadata, styles, settings, and body content for all document families. Reuses the same body parsers and serializers as packaged variants.

Types 1

Represents a flat XML ODF document.

Contains all the same data as a packaged ODF document but stored in a single XML file with office:document as the root element.

Fields
OdfDocumentType documentTypeThe document type (TEXT or SPREADSHEET).
OdfContent contentParsed content with body and automatic styles.
OdfStyles stylesNamed styles from `office:styles`.
OdfMetadata metadataDocument metadata.
OdfSettings settingsDocument settings.
string version_The ODF version attribute from the root element.
XmlElement rawRootThe root element's raw XML for preservation of unknown children.
XmlElement rawSettingsElementRaw settings element for round-trip preservation.

Functions 5

fnbool isFlatOdfXml(const(ubyte)[] xmlBytes)Detects whether XML content represents a flat ODF document.
fnbool isFlatOdfExtension(string ext) @safe pure nothrowDetects whether a file extension suggests a flat ODF variant.
fnOdfFlatDocument parseFlatOdf(const(ubyte)[] xmlBytes)Parses a flat XML ODF document from raw XML bytes.
fnOdfFlatDocument parseFlatOdfString(string xml)Parses a flat XML ODF document from an XML string.
fnstring serializeFlatOdf(ref OdfFlatDocument flatDoc)Serializes a flat XML ODF document to an XML string.