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

PropertyTypeAccessDescription
Xfloat | NoneReadHorizontal position on the page in points
Yfloat | NoneReadVertical position on the page in points
Widthfloat | NoneReadWidth of the outline block in points

Inherited from CompositeNode

Property / MethodDescription
FirstChildFirst direct child OutlineElement node, or None
LastChildLast 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 outlineIterate direct children

Inherited from Node

PropertyDescription
ParentNodeThe containing Page
DocumentThe root Document

Methods

Accept(visitor)

outline.Accept(visitor: DocumentVisitor) -> None

Dispatches 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

PropertyTypeAccessDescription
IndentLevelintReadNesting depth within the outline (0 = outermost)
NumberListNumberList | NoneReadNumbered or bulleted list metadata; None if this element is not part of a list
Tagslist[NoteTag]ReadOneNote tags attached to this element

Inherited from CompositeNode

Property / MethodDescription
FirstChildFirst direct content child
LastChildLast direct content child
AppendChildLast(node)Append a content node
GetChildNodes(Type)Recursive search over the subtree
for child in elemIterate direct children

Inherited from Node

PropertyDescription
ParentNodeThe containing Outline
DocumentThe root Document

Methods

Accept(visitor)

elem.Accept(visitor: DocumentVisitor) -> None

Dispatches 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