NumberList — Aspose.Note FOSS for Python API Reference
Class: NumberList
Package: aspose.note
Import: from aspose.note import NumberList
Inherits: Node
NumberList holds the list-numbering metadata attached to an OutlineElement. When OutlineElement.NumberList is not None, the element is part of an ordered or unordered list. The properties reflect raw values parsed from the MS-ONE binary format and are read-only; they are not user-settable in v26.2.
Properties
All properties are Read-only.
| Property | Type | Default | Description |
|---|---|---|---|
Format | str | None | None | MS-ONE number format string for this list item (e.g. "%1)", "•"). None when absent. |
Restart | int | None | None | Explicit restart number. When set, the list restarts counting from this value. None means the list continues from the previous item. |
IsNumbered | bool | False | True for ordered (numbered) lists; False for bulleted or non-sequential lists. |
Inherited from Node
| Property | Type | Description |
|---|---|---|
ParentNode | Node | None | The OutlineElement this NumberList belongs to |
Document | Document | None | Root document |
Notes
- Read-only data:
Format,Restart, andIsNumberedare parsed from the binary file. There is no API to modify numbering in v26.2. - Format strings: The
Formatstring follows the raw MS-ONE numbering format, not a human-readable pattern. Common values include decimal format strings ("%1.","%1)") for numbered lists and bullet characters ("•","–") for bulleted lists. - Presence check: Always check
OutlineElement.NumberList is not Nonebefore accessing this object.
Usage Example
Detect numbered vs bulleted list items
from aspose.note import Document, OutlineElement
doc = Document("MyNotes.one")
for oe in doc.GetChildNodes(OutlineElement):
nl = oe.NumberList
if nl is None:
continue # not a list item
kind = "numbered" if nl.IsNumbered else "bulleted"
restart_info = f" restart={nl.Restart}" if nl.Restart is not None else ""
print(f"[{kind}] format={nl.Format!r}{restart_info} indent={oe.IndentLevel}")Collect all numbered list items with their text
from aspose.note import Document, OutlineElement, RichText
doc = Document("MyNotes.one")
for oe in doc.GetChildNodes(OutlineElement):
if oe.NumberList is not None and oe.NumberList.IsNumbered:
texts = [rt.Text for rt in oe.GetChildNodes(RichText) if rt.Text]
print(" | ".join(texts))None-Safety
Format and Restart may be None. IsNumbered is always a bool. OutlineElement.NumberList itself may be None — check before accessing any property.
See Also
- Node: base class
- OutlineElement: the element that carries a
NumberList - Developer Guide