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 bytesisFlatOdfExtension()checks file extensionsparseFlatOdf()/parseFlatOdfString()reads flat documentsserializeFlatOdf()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.
struct OdfFlatDocument
Types 1
structOdfFlatDocument
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 13
fn
bool isFlatOdfXml(const(ubyte)[] xmlBytes)Detects whether XML content represents a flat ODF document.fn
bool isFlatOdfExtension(string ext) @safe pure nothrowDetects whether a file extension suggests a flat ODF variant.fn
OdfFlatDocument parseFlatOdf(const(ubyte)[] xmlBytes)Parses a flat XML ODF document from raw XML bytes.fn
string serializeFlatOdf(ref OdfFlatDocument flatDoc)Serializes a flat XML ODF document to an XML string.