CFBStorage

Overview

CFBStorage represents a mutable STORAGE_OBJECT node within a CFBDocument directory tree. It acts as a container for child CFBStorage and CFBStream instances and maps directly to a storage directory entry in the CFB specification. Key fields include name: str, clsid: bytes, state_bits: int, and children: list.

Access the root storage via CFBDocument.root, then use add_storage and add_stream to build the hierarchy, or manipulate the children list directly.

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

doc = CFBDocument.from_file("archive.cfb")
new_stream = CFBStream()
new_stream.name = "MyStream"
new_stream.data = b"hello"
doc.root.children.append(new_stream)
CFBWriter.write_file(doc, "updated.cfb")

Methods

MethodReturnsDescription
add_storage(storage)CFBStorageAppends storage (or a new empty CFBStorage if None) as a child and returns it.
add_stream(stream)CFBStreamAppends stream as a child stream and returns it.

See Also