NoteTag — Aspose.Note FOSS for Python API Reference

کلاس: NoteTag

ImageRenderOptions: aspose.note ImageRenderOptions: from aspose.note import NoteTag ImageRenderOptions: Node

NoteTag نماد یک برچسب OneNote (ستاره، چک‌باکس، علامت مهم و غیره) که به یک گره محتوا پیوست شده است. برچسب‌ها ظاهر می‌شوند در RichText, Image, AttachedFile, OutlineElement,، و Table گره‌ها از طریق .Tags ویژگی.


ImageRenderOptions

تمام ویژگی‌ها فقط-خواندنی هستند و مقادیری را که مستقیماً از فرمت باینری MS-ONE تجزیه شده‌اند، بازتاب می‌دهند.

ImageRenderOptionsImageRenderOptionsImageRenderOptionsImageRenderOptions
shape`intNone`None
label`strNone`None
text_color`intNone`None
highlight_color`intNone`None
created`intNone`None
completed`intNone`None

ارث‌بری شده از Node

ImageRenderOptionsImageRenderOptionsImageRenderOptions
ParentNode`NodeNone`
Document`DocumentNone`

یادداشت زمان‌مهر

created و completed زمان‌سنج‌های عدد صحیح خام هستند که از فرمت باینری MS-ONE تجزیه شده‌اند. آن‌ها نیستند datetime شیء. اگر نیاز دارید با آن‌ها به عنوان تاریخ‑زمان‌های Python کار کنید، برای فرمول تبدیل به مشخصات فرمت فایل MS-ONE مراجعه کنید.


متدهای کارخانه‌ای

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

یک مقدار جدید برمی‌گرداند NoteTag با shape=None و label="Yellow Star". مفید هنگام ساخت اسناد به‌صورت برنامه‌نویسی.


مثال استفاده

فهرست تمام عناصر برچسب‌دار در یک سند

from aspose.note import Document, RichText, Image, AttachedFile, OutlineElement

doc = Document("MyNotes.one")

# Tags on RichText
for rt in doc.GetChildNodes(RichText):
    for tag in rt.Tags:
        print(f"RichText tag: label={tag.label!r}  on: {rt.Text.strip()[:40]!r}")

# Tags on Images
for img in doc.GetChildNodes(Image):
    for tag in img.Tags:
        print(f"Image tag: label={tag.label!r}  file={img.FileName!r}")

# Tags on AttachedFiles
for af in doc.GetChildNodes(AttachedFile):
    for tag in af.Tags:
        print(f"Attachment tag: label={tag.label!r}  file={af.FileName!r}")

فیلتر برای برچسب‌های “To Do” ناقص

from aspose.note import Document, RichText

doc = Document("MyNotes.one")
for rt in doc.GetChildNodes(RichText):
    for tag in rt.Tags:
        if tag.label and "to do" in tag.label.lower() and tag.completed is None:
            print(f"Incomplete TODO: {rt.Text.strip()!r}")

ایمنی در برابر None

label, shape, text_color, highlight_color, created, و completed همه می‌توانند None. قبل از استفاده مراقب باشید. Tags فهرست‌ها در گره‌های محتوا همیشه فهرست هستند (هرگز None).


همچنین ببینید

 فارسی