NoteTag — Aspose.Note FOSS for Python API Reference

Clase: NoteTag

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

NoteTag representa un ícono de etiqueta de OneNote (estrella, casilla de verificación, marcador importante, etc.) que está adjunto a un nodo de contenido. Las etiquetas aparecen en RichText, Image, AttachedFile, OutlineElement, y Table nodos a través de su .Tags propiedad.


Examples

Todas las propiedades son de solo lectura y reflejan valores analizados directamente del formato binario MS-ONE.

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

Hereda de Node

ExamplesExamplesExamples
ParentNode`NodeNone`
Document`DocumentNone`

Nota de marca de tiempo

created y completed son marcas de tiempo enteras sin procesar extraídas del formato binario MS-ONE. Son no datetime objetos. Si necesita trabajar con ellos como Python datetimes, consulte la especificación del formato de archivo MS-ONE para la fórmula de conversión.


Métodos de fábrica

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

Devuelve un nuevo NoteTag con shape=None y label="Yellow Star". Útil al crear documentos programáticamente.


Ejemplo de uso

Listar todos los elementos etiquetados en 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}")

Filtrar etiquetas “To Do” incompletas

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

Seguridad contra None

label, shape, text_color, highlight_color, created, y completed pueden ser todos None. Guard antes de usar. Tags las listas en nodos de contenido siempre son listas (nunca None), pero pueden estar vacías.


Ver también

 Español