AttachedFile

AttachedFile — Aspose.Note FOSS for Python API Reference

Class: AttachedFile

ImageRenderOptions: aspose.note ImageRenderOptions: from aspose.note import AttachedFile ImageRenderOptions: CompositeNode

AttachedFile एक बाइनरी फ़ाइल का प्रतिनिधित्व करता है जिसे OneNote सेक्शन के भीतर एम्बेड किया गया है। यह … का चाइल्ड है। OutlineElement. Bytes प्रॉपर्टी; मूल फ़ाइलनाम … में है। FileName. OneNote टैग जो अटैचमेंट से जुड़े हैं, … के माध्यम से उजागर होते हैं। Tags.


ImageRenderOptions

ImageRenderOptionsImageRenderOptionsImageRenderOptionsImageRenderOptions
FileName`strNone`ImageRenderOptions
BytesbytesImageRenderOptionsअटैच्ड फ़ाइल की कच्ची बाइनरी सामग्री। डिफ़ॉल्ट रूप से … b"" जब अटैचमेंट डेटा पढ़ा नहीं जा सका।.
Tagslist[NoteTag]ImageRenderOptionsइस फ़ाइल नोड से जुड़े OneNote टैग।.

CompositeNode / Node से इनहेरिटेड

ImageRenderOptionsImageRenderOptionsImageRenderOptions
FirstChild`NodeNone`
LastChild`NodeNone`
ParentNode`NodeNone`
Document`DocumentNone`

ImageRenderOptions

  • केवल-पढ़ने योग्य सामग्री: Bytes और FileName सीधे MS-ONE बाइनरी से पार्स किए जाते हैं। v26.3.1 में एम्बेडेड फ़ाइल डेटा को बदलने के लिए कोई API नहीं है।.
  • ImageRenderOptions: एक दस्तावेज़ सहेजना जिसमें शामिल है AttachedFile nodes to PDF अटैचमेंट मेटाडेटा को PDF में एम्बेड करता है लेकिन PDF स्वयं में बाइनरी कंटेंट को नहीं।.
  • खाली बाइट्स:यदि स्रोत में फ़ाइल डेटा ब्लॉक गायब है या शून्य-लंबाई का है .one फ़ाइल, Bytes वापस करता है b"".

उपयोग उदाहरण

सभी अटैचमेंट को डिस्क पर एक्सट्रैक्ट करें

import os
from aspose.note import Document, AttachedFile

doc = Document("MyNotes.one")
output_dir = "attachments"
os.makedirs(output_dir, exist_ok=True)

for af in doc.GetChildNodes(AttachedFile):
    name = af.FileName or "unnamed_attachment"
    dest = os.path.join(output_dir, name)
    with open(dest, "wb") as f:
        f.write(af.Bytes)
    print(f"Saved: {dest}  ({len(af.Bytes)} bytes)")

अटैचमेंट को उनके टैग के साथ सूचीबद्ध करें

from aspose.note import Document, AttachedFile

doc = Document("MyNotes.one")
for af in doc.GetChildNodes(AttachedFile):
    tag_labels = [t.label for t in af.Tags if t.label]
    print(f"{af.FileName!r}  tags={tag_labels}  size={len(af.Bytes)}B")

None-सेफ़्टी

FileName हो सकता है None; फ़ाइलें लिखते समय हमेशा एक फॉलबैक नाम प्रदान करें।. Bytes हमेशा है bytes (कभी नहीं None), लेकिन खाली हो सकता है (b""). Tags हमेशा एक सूची है (खाली हो सकती है)।.


संबंधित देखें

 हिन्दी