NoteTag — Aspose.Note FOSS for Python API Reference

Class: NoteTag

Package: aspose.note Import: from aspose.note import NoteTag Inherits: Node

NoteTag represents a OneNote tag icon (star, checkbox, important marker, etc.) that is attached to a content node. Tags appear on RichText, Image, AttachedFile, OutlineElement, and Table nodes via their .Tags property.


Properties

All properties are Read-only and reflect values parsed directly from the MS-ONE binary format.

PropertyTypeDefaultDescription
shapeint | NoneNoneNumeric shape identifier for the tag icon as defined by the MS-ONE spec. None when absent.
labelstr | NoneNoneHuman-readable display label (e.g. "Yellow Star", "Important", "To Do"). None when absent.
text_colorint | NoneNoneTag text colour as a packed ARGB integer.
highlight_colorint | NoneNoneTag highlight colour as a packed ARGB integer.
createdint | NoneNoneRaw MS timestamp integer recording when the tag was created. See timestamp note below.
completedint | NoneNoneRaw MS timestamp integer recording when the tag was completed. None if the tag has not been completed.

Inherited from Node

PropertyTypeDescription
ParentNodeNode | NoneThe content node this tag is attached to
DocumentDocument | NoneRoot document

Timestamp Note

created and completed are raw integer timestamps as parsed from the MS-ONE binary format. They are not datetime objects. If you need to work with them as Python datetimes, consult the MS-ONE file format specification for the conversion formula.


Factory Methods

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

Returns a new NoteTag with shape=None and label="Yellow Star". Useful when constructing documents programmatically.


Usage Example

List all tagged elements in a 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}")

Filter for incomplete “To Do” tags

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-Safety

label, shape, text_color, highlight_color, created, and completed can all be None. Guard before use. Tags lists on content nodes are always lists (never None), but may be empty.


See Also