Test files › Office documents › document.odt
Sample ODT file (document)
OpenDocument Text with the mandatory uncompressed "mimetype" entry stored first.
↓ Download document.odt| Filename | document.odt |
| Format | ODT |
| Size | 853 bytes (853 bytes) |
| MIME type | application/vnd.oasis.opendocument.text |
| SHA-256 | b59417f44b6996fd6c611bd8611b0a3c48f2e07f8b94cfb6fa55ee4a12bcaf18 |
What this file catchesODF readers sniff the type from the first, uncompressed archive entry. Extractors or repackagers that re-compress or reorder entries break that - this file is the control for that behaviour.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Check for macros before accepting or opening an Office upload. Modern files are ZIPs: VBA lives in vbaProject.bin (Microsoft) or a Basic folder (OpenDocument). Legacy .xls/.doc files are OLE2 containers that need a dedicated parser, such as oletools, to see inside.
import zipfile
OLE2 = bytes.fromhex("d0cf11e0a1b11ae1")
with open("document.odt", "rb") as f:
magic = f.read(8)
if magic == OLE2:
print("legacy OLE2 file (.xls, .doc, .ppt, .msg): may carry VBA; inspect it with an OLE parser")
elif not zipfile.is_zipfile("document.odt"):
print("not an Office file")
else:
with zipfile.ZipFile("document.odt") as z:
names = z.namelist()
types = z.read("[Content_Types].xml").decode() if "[Content_Types].xml" in names else ""
macros = [n for n in names if n.lower().endswith("vbaproject.bin") or n.startswith(("Basic/", "Scripts/"))]
if macros or "macroEnabled" in types:
print("contains macros:", ", ".join(macros) or "declared in [Content_Types].xml")
else:
print(f"no macro parts among {len(names)} entries")Run against this file, it prints: no macro parts among 3 entries
Related guides and tools
Download & verify
curl -fsSL -o "document.odt" "https://files.hexaqa.com/office/document.odt"
curl -fsSL "https://files.hexaqa.com/office/document.odt" | sha256sum
# expect: b59417f44b6996fd6c611bd8611b0a3c48f2e07f8b94cfb6fa55ee4a12bcaf18