Outline / OutlineElement — Aspose.Note FOSS for Python API Reference
Class: Outline
Package: aspose.note
Import: from aspose.note import Outline
Inherits: CompositeNode
Outline is a positional container placed directly on a Page. It carries X/Y coordinates and a width that describe where the content block is laid out on the page canvas. Its direct children are OutlineElement nodes.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
X | float | None | Read | Horizontal position on the page in points |
Y | float | None | Read | Vertical position on the page in points |
Width | float | None | Read | Width of the outline block in points |
Inherited from CompositeNode
| Property / Method | Description |
|---|---|
FirstChild | First direct child OutlineElement node, or None |
LastChild | Last direct child OutlineElement node, or None |
AppendChildLast(node) | Append an OutlineElement to the end |
AppendChildFirst(node) | Prepend an OutlineElement |
InsertChild(index, node) | Insert at a specific position |
RemoveChild(node) | Remove a child node |
GetChildNodes(Type) | Recursive depth-first search returning all descendants of the given type |
for child in outline | Iterate direct children |
Inherited from Node
| Property | Description |
|---|---|
ParentNode | The containing Page |
Document | The root Document |
Methods
Accept(visitor)
outline.Accept(visitor: DocumentVisitor) -> NoneDispatches VisitOutlineStart(outline) on the visitor, then recursively visits each child OutlineElement, then VisitOutlineEnd(outline).
Usage Examples
Collect all outlines on a page
from aspose.note import Document, Page, Outline
doc = Document("MyNotes.one")
for page in doc.GetChildNodes(Page):
for outline in page.GetChildNodes(Outline):
print(f"Outline at X={outline.X}, Y={outline.Y}, Width={outline.Width}")Walk outline elements within an outline
from aspose.note import Document, Outline, OutlineElement, RichText
doc = Document("MyNotes.one")
for outline in doc.GetChildNodes(Outline):
for elem in outline.GetChildNodes(OutlineElement):
for rt in elem.GetChildNodes(RichText):
print(rt.Text)Class: OutlineElement
Package: aspose.note
Import: from aspose.note import OutlineElement
Inherits: CompositeNode
OutlineElement is the leaf container within an Outline. It holds content nodes such as RichText, Image, Table, and AttachedFile. Nesting is expressed via IndentLevel rather than actual tree depth.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
IndentLevel | int | Read | Nesting depth within the outline (0 = outermost) |
NumberList | NumberList | None | Read | Numbered or bulleted list metadata; None if this element is not part of a list |
Tags | list[NoteTag] | Read | OneNote tags attached to this element |
Inherited from CompositeNode
| Property / Method | Description |
|---|---|
FirstChild | First direct content child |
LastChild | Last direct content child |
AppendChildLast(node) | Append a content node |
GetChildNodes(Type) | Recursive search over the subtree |
for child in elem | Iterate direct children |
Inherited from Node
| Property | Description |
|---|---|
ParentNode | The containing Outline |
Document | The root Document |
Methods
Accept(visitor)
elem.Accept(visitor: DocumentVisitor) -> NoneDispatches VisitOutlineElementStart(elem), recursively visits children, then VisitOutlineElementEnd(elem).
Usage Examples
Extract plain text from outline elements
from aspose.note import Document, OutlineElement, RichText
doc = Document("MyNotes.one")
for elem in doc.GetChildNodes(OutlineElement):
for rt in elem.GetChildNodes(RichText):
if rt.Text.strip():
print(f" [indent={elem.IndentLevel}] {rt.Text}")Find list items
from aspose.note import Document, OutlineElement, RichText
doc = Document("MyNotes.one")
for elem in doc.GetChildNodes(OutlineElement):
if elem.NumberList is not None:
numbered = elem.NumberList.IsNumbered
label = "ordered" if numbered else "bulleted"
for rt in elem.GetChildNodes(RichText):
print(f" [{label}] {rt.Text}")Find tagged outline elements
from aspose.note import Document, OutlineElement, RichText
doc = Document("MyNotes.one")
for elem in doc.GetChildNodes(OutlineElement):
if elem.Tags:
labels = [t.label for t in elem.Tags if t.label]
for rt in elem.GetChildNodes(RichText):
print(f"Tags: {labels} Text: {rt.Text.strip()!r}")Build an outline programmatically
from aspose.note import Document, Page, Outline, OutlineElement, RichText, SaveFormat
doc = Document()
page = doc.AppendChildLast(Page())
outline = page.AppendChildLast(Outline())
elem = outline.AppendChildLast(OutlineElement())
rt = elem.AppendChildLast(RichText())
rt.Append("Hello from aspose-note")
doc.Save("output.pdf", SaveFormat.Pdf)None-Safety
NumberList is None for elements that are not part of a list. Tags is always a list (may be empty). IndentLevel is always an int (default 0).
See Also
- Page: parent of Outline
- RichText: primary content within OutlineElement
- Table: table content within OutlineElement
- NumberList: list formatting metadata
- NoteTag: tags on outline elements
- DocumentVisitor: visitor traversal