file in abyss
フォーマット一覧へ戻る

Document

ODT OpenDocument Text

LibreOfficeやOpenOfficeで使われるOpenDocumentの文書形式。ZIPコンテナ内にmimetypeやcontent.xmlを含みます。

Extensions .odt
MIME application/vnd.oasis.opendocument.text

マジックナンバー

ファイルを解析
オフセット 0 ZIP local file header
50 4B 03 04
PK..

構造

  1. ZIP container
  2. mimetype
  3. META-INF/manifest.xml
  4. content.xml

注意点

  • ODT固有の判定にはmimetypeエントリの値を確認する必要があります。

判定コード例

SIGNATURE = bytes.fromhex("504b0304")
OFFSET = 0

def is_odt(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

OpenDocument Text はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。

よくある判定ミス

  • .odt という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • OpenDocument Text は 50 4B 03 04 のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

文書形式はスクリプト・添付・マクロ・外部参照を含むことがあります。プレビューや変換はサンドボックス化し、信頼できないファイルを直接開かないでください。

サンプルの活用

11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Doc

Blue Sky ODT

Blue Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.odt
Type Sample
1.1 KB
SHA-256 4a16330bb1805e4b7d0ab2e523ba9cc7bf0219cf9a9384d97b09dc25459fd5f9
Download
Doc

Flower Garden ODT

Flower Garden ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.odt
Type Sample
1.1 KB
SHA-256 c0d145f165569327022be523f69a86f1c7659b5ce24cf74fc9ab2bbd004fb2a1
Download
Doc

Navy Blue Sky ODT

Navy Blue Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.odt
Type Sample
1.1 KB
SHA-256 d7a75ff8c4c99ca8cb73fa3ccfc5f417f55e3c19a4b592142a7bd03425f47e08
Download
Doc

Nature of the Sky ODT

Nature of the Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.odt
Type Sample
1.1 KB
SHA-256 f63c31e2a557698508e9bc958f9cbb778ba16461bf26f1c7de1344c7aaec0c4d
Download
Doc

Sky Landscape ODT

Sky Landscape ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.odt
Type Sample
1.1 KB
SHA-256 b38aece434d89cc51695c01f9df78d7d927675ea53a1362d38dddcc8214d5526
Download
Doc

Starry Sky ODT

Starry Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.odt
Type Sample
1.1 KB
SHA-256 e7ce9e296b6d2623a53fc00b4e4d34ae2de9bb92a9d03f9f9f19e9523fa5709f
Download
Doc

Blue Night Sky ODT

Blue Night Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.odt
Type Sample
1.1 KB
SHA-256 9dbf72b8748dcc99367b785694e1f41a2b5d43ccf8bd3a2825815d4f4fa39695
Download
Doc

Hibiscus Flower ODT

Hibiscus Flower ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.odt
Type Sample
1.1 KB
SHA-256 00ba59df483126840f6f2566d6a2b1c11556308a0aabbcf6a93c8fe86def8c2a
Download
Doc

Arctic Sky ODT

Arctic Sky ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.odt
Type Sample
1.1 KB
SHA-256 b9cb434f38efb29b49d292032ec84f4155404fa87495fa495f3ae9e6fd049833
Download
Doc

Sunset Rays ODT

Sunset Rays ODT is a OpenDocument Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

10-sunset-rays.odt
Type Sample
1.1 KB
SHA-256 1cda39a6715c4a15409447ff93de167a2d63de3cdb0c47157f2d90dd51491b39
Download
Doc

NASA Blue Marble ODT

NASA Blue Marble ODT is a OpenDocument Text sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.odt
Type Sample
1.1 KB
SHA-256 afede466a4a8b02370ef80e200fcd16f023a060e792d79631b3b44ce9de0b214
Download

よくある質問

OpenDocument Text のマジックナンバー(ファイルシグネチャ)は?

OpenDocument Text ファイルはバイトシグネチャ 50 4B 03 04 ("PK..") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

OpenDocument Text のMIMEタイプは?

OpenDocument Text のMIMEタイプは application/vnd.oasis.opendocument.text です。

OpenDocument Text の拡張子は?

OpenDocument Text ファイルは .odt 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット