NoteTag — Aspose.Note FOSS for Python API Reference

Clasa: NoteTag

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

NoteTag reprezintă o pictogramă de etichetă OneNote (stea, casetă de selectare, marcaj important etc.) care este atașată unui nod de conținut. Etichetele apar pe RichText, Image, AttachedFile, OutlineElement, și Table noduri prin intermediul .Tags proprietate.


ImageRenderOptions

Toate proprietățile sunt doar în citire și reflectă valori analizate direct din formatul binar MS-ONE.

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

Moștenit de la Node

ImageRenderOptionsImageRenderOptionsImageRenderOptions
ParentNode`NodeNone`
Document`DocumentNone`

Notă de marcaj temporal

created și completed sunt timestamp-uri brute de tip întreg, parsate din formatul binar MS-ONE. Ele sunt nu datetime obiecte. Dacă trebuie să lucrați cu ele ca Python datetimes, consultați specificația formatului de fișier MS-ONE pentru formula de conversie.


Metode de fabrică

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

Returnează un nou NoteTag cu shape=None și label="Yellow Star". Util atunci când se construiesc documente programatic.


Exemplu de utilizare

Listează toate elementele etichetate dintr-un document

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}")

Filtrează etichetele “To Do” incomplete

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}")

Siguranță None

label, shape, text_color, highlight_color, created, și completed pot fi toate None. Verificați înainte de utilizare. Tags listele pe nodurile de conținut sunt întotdeauna liste (niciodată None), dar pot fi goale.


Vezi și

 Română