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.
| Property | Type | Default | Description |
|---|---|---|---|
shape | int | None | None | Numeric shape identifier for the tag icon as defined by the MS-ONE spec. None when absent. |
label | str | None | None | Human-readable display label (e.g. "Yellow Star", "Important", "To Do"). None when absent. |
text_color | int | None | None | Tag text colour as a packed ARGB integer. |
highlight_color | int | None | None | Tag highlight colour as a packed ARGB integer. |
created | int | None | None | Raw MS timestamp integer recording when the tag was created. See timestamp note below. |
completed | int | None | None | Raw MS timestamp integer recording when the tag was completed. None if the tag has not been completed. |
Inherited from Node
| Property | Type | Description |
|---|---|---|
ParentNode | Node | None | The content node this tag is attached to |
Document | Document | None | Root 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() -> NoteTagReturns 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
- Node: base class
- RichText: text nodes that carry tags
- AttachedFile: attachment nodes that carry tags
- Image: image nodes that carry tags
- Developer Guide