NoteTag — Aspose.Note FOSS for Python API Reference
Classe: NoteTag
ImageRenderOptions: aspose.note ImageRenderOptions: from aspose.note import NoteTag ImageRenderOptions: Node
NoteTag rappresenta un’icona di tag di OneNote (stella, casella di controllo, indicatore importante, ecc.) che è collegata a un nodo di contenuto. I tag appaiono su RichText, Image, AttachedFile, OutlineElement, e Table nodi tramite il loro .Tags proprietà.
ImageRenderOptions
Tutte le proprietà sono di sola lettura e riflettono i valori analizzati direttamente dal formato binario MS-ONE.
| ImageRenderOptions | ImageRenderOptions | ImageRenderOptions | ImageRenderOptions |
|---|---|---|---|
shape | `int | None` | None |
label | `str | None` | None |
text_color | `int | None` | None |
highlight_color | `int | None` | None |
created | `int | None` | None |
completed | `int | None` | None |
Ereditato da Node
| ImageRenderOptions | ImageRenderOptions | ImageRenderOptions |
|---|---|---|
ParentNode | `Node | None` |
Document | `Document | None` |
Nota Timestamp
created e completed sono timestamp interi grezzi come analizzati dal formato binario MS-ONE. Sono non datetime oggetti. Se devi lavorare con essi come Python datetime, consulta la specifica del formato file MS-ONE per la formula di conversione.
Metodi di fabbrica
NoteTag.CreateYellowStar()
tag = NoteTag.CreateYellowStar() -> NoteTagRestituisce un nuovo NoteTag con shape=None e label="Yellow Star". Utile quando si costruiscono documenti programmaticamente.
Esempio d’uso
Elenca tutti gli elementi con tag in un documento
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}")Filtra i tag “To Do” incompleti
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}")Sicurezza None
label, shape, text_color, highlight_color, created, e completed possono tutti essere None. Verifica prima dell’uso. Tags gli elenchi sui nodi di contenuto sono sempre elenchi (mai None), ma possono essere vuoti.
Vedi anche
- ImageRenderOptions: classe base
- RichText: nodi di testo che contengono tag
- AttachedFile: nodi di allegato che contengono tag
- ImageRenderOptions: nodi immagine che contengono tag
- Guida per sviluppatori