CFBDocument

Overview

CFBDocument is the in-memory, mutable representation of a Compound File Binary (CFB) document. It holds a root storage node of type CFBStorage along with version metadata and is the central object for constructing or modifying CFB structures. Once modifications are complete, the document is serialized using CFBWriter.

from aspose.email_foss.cfb import CFBDocument, CFBStorage, CFBWriter

doc = CFBDocument.from_file("archive.cfb")
new_storage = CFBStorage(name="MyStorage")
doc.root.add_storage(new_storage)
CFBWriter.write_file(doc, "modified.cfb")

Properties

PropertyTypeDescription
rootCFBStorageRoot storage node of the CFB directory tree.
major_versionintCFB major version from the file header (3 for 512-byte sectors, 4 for 4096-byte sectors).
minor_versionintCFB minor version; typically 0x003E.
transaction_signature_numberintTransaction signature number from the CFB header; incremented on each write.

Class Methods

MethodReturnsDescription
from_reader(reader)CFBDocumentBuilds a CFBDocument from an open CFBReader instance.
from_file(path)CFBDocumentOpens a CFB file at path and returns a populated CFBDocument.

See Also