NoteTag — Aspose.Note FOSS for Python API Reference

Klase: NoteTag

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

NoteTag pārstāv OneNote tag ikonu (zvaigzne, izvēles rūtiņa, svarīgs marķieris utt.), kas ir pievienota satura mezglam. Tagi parādās uz RichText, Image, AttachedFile, OutlineElement, un Table mezgli caur to .Tags īpašību.


ImageRenderOptions

Visas īpašības ir tikai lasāmas (Read-only) un atspoguļo vērtības, kas tieši izparsētas no MS-ONE binārā formāta.

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

Manto no Node

ImageRenderOptionsImageRenderOptionsImageRenderOptions
ParentNode`NodeNone`
Document`DocumentNone`

Laika zīmes piezīme

created un completed ir neapstrādāti veseli skaitļu laika zīmogi, kas izparsēti no MS-ONE binārā formāta. Tie ir nav datetime objekti. Ja jums ir jāstrādā ar tiem kā Python datuma/laika vērtībām, skatiet MS-ONE faila formāta specifikāciju, lai iegūtu pārveidošanas formulu.


Fabrikas metodes

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

Atgriež jaunu NoteTag ar shape=None un label="Yellow Star". Noderīgi, veidojot dokumentus programmatiski.


Lietošanas piemērs

Uzskaitīt visus tagotu elementus dokumentā

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

Filtrēt nepabeigtos “To Do” tagus

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 drošība

label, shape, text_color, highlight_color, created, un completed var visi būt None. Aizsargājiet pirms lietošanas. Tags saraksti uz satura mezgliem vienmēr ir saraksti (nekad None), bet var būt tukšs.


Skatīt arī

 Latviešu