Aspose.Note FOSS for Python

此参考文档覆盖了完整的公共 API 表面 aspose-note 版本 26.3.1。仅记录从 aspose.note 包中导出的符号在此处有文档。任何位于 aspose.note._internal 是实现细节,可能会在不另行通知的情况下更改。.

Properties: pip install aspose-note (core) 或 pip install "aspose-note[pdf]" (带 PDF 导出)

Properties: from aspose.note import Document, RichText, ...


Properties

文档与遍历

ClassDescription
AsposeNoteErrorClass extending Exception.
AttachedFileAttachedFile.FileName holds the optional name of the attached file.
CompositeNodeCompositeNode.AppendChildLast appends the given node as the last child and returns the added node.
DocumentDocument.Save writes the document to a file, stream, or path using the given format or options.
DocumentVisitorDocumentVisitor.VisitDocumentStart is invoked when traversal begins a Document node.
FileCorruptedExceptionClass extending AsposeNoteError.
ImageImage.Replace replaces the current image data with the provided Image instance.
IncorrectDocumentStructureExceptionClass extending AsposeNoteError.
IncorrectPasswordExceptionClass extending AsposeNoteError.
LicenseLicense.SetLicense loads a license from the given file path or binary stream.
LoadOptionsLoadOptions.DocumentPassword holds the password used to open encrypted documents, or None if not set.
MeteredMetered.SetMeteredKey stores the provided public and private keys for metered licensing.
NodeNode.Accept invokes the visitor on this node for traversal or processing.
NoteTagNoteTag.CreateYellowStar creates a yellow‑star tag, optionally assigning a label.
NumberListNumberList.GetNumberedListHeader returns the header string for the specified list number.
OutlineOutline.HorizontalOffset represents the horizontal offset of the outline within its container.
OutlineElementOutlineElement.NumberList represents the numbered list applied to this outline element, or None if absent.
PagePage.Clone creates a copy of the page; if cloneHistory is true the page’s revision history is also copied.
PageHistoryPageHistory.Add adds the specified Page to the collection.
ParagraphStyleParagraphStyle.Default returns a ParagraphStyle instance initialized with default formatting values.
RichTextRichText.Append appends the given text with optional style to the end of the rich text.
TableTable.Tags provides the collection of NoteTag objects attached to the table.
TableCellClass with 7 methods and 4 properties.
TableColumnTableColumn.Width represents the column width in points, or None if not set.
TableRowClass with 7 methods and 4 properties.
TextRunTextRun.Text holds the plain string content of the text run.
TextStyleTextStyle.Default returns a TextStyle object representing the library’s default text formatting.
TitleTitle.TitleText holds the RichText representing the title’s main text, or None if absent.
UnsupportedFileFormatExceptionUnsupportedFileFormatException.FileFormat represents the file format that triggered the exception.
UnsupportedSaveFormatExceptionClass extending AsposeNoteError.

文档结构

EnumerationDescription
FileFormatFileFormat.Unknown represents an unspecified or unrecognized file format.
HorizontalAlignmentHorizontalAlignment.Left represents left horizontal alignment.
NodeTypeNodeType.Document represents a OneNote document node, the root of the DOM hierarchy.
SaveFormatSaveFormat.Pdf represents the PDF format used when saving a Document.
TagStatusTagStatus.Open represents an open (active) tag status.

Properties

ClassDescription
AttachmentTagFlowableAttachmentTagFlowable.hAlign represents the horizontal alignment setting for the tag flowable.
OutlinePrefixFlowableOutlinePrefixFlowable.wrap sets the flowable’s available width and height to aW and aH.
PdfSaveOptionsPdfSaveOptions.ImageCompression controls the compression algorithm applied to images embedded in the PDF.
SaveOptionsSaveOptions.SaveFormat specifies the output format for saving the document.

Properties

兼容性存根


类详情

Properties

根文档类。加载一个 .one 文件,从文件路径, pathlib.Path,,或二进制流。.

from aspose.note import Document, LoadOptions

doc = Document(source=None, load_options=None)

构造函数参数:

Properties:

Properties:

Document.FileFormat 注意::该属性提供对 OneNote 文件格式版本的最佳努力指示。 FileFormat 枚举有三个值:: OneNote2010, OneNoteOnline,,以及 OneNote2007.

Document.Save() 流支持: target 可以是二进制流(io.BytesIO,,以二进制写入模式打开的文件句柄等)。这在测试套件中得到确认:: doc.Save(io.BytesIO(), PdfSaveOptions(SaveFormat.Pdf)).


DocumentVisitor

用于访问者模式遍历的抽象基类。覆盖您需要的 visit 方法::


Properties

所有文档树节点的基类。.


CompositeNode

Properties Node. 添加子节点管理::


Properties

Properties CompositeNode. 表示一个 OneNote 页面。.

Properties:


Properties

Properties CompositeNode.。保存标题块的 Page.


Properties

Properties CompositeNode.。一个用于定位的容器 OutlineElement 节点。.


OutlineElement

Properties CompositeNode.。一个保存内容节点的叶子容器。.


RichText

Properties CompositeNode.。一段样式化文本。.

Properties:


TextRun

Properties Node.。单个格式化文本段。.


TextStyle

Properties Node.。针对…的每字符格式属性 TextRun.


Properties

Properties CompositeNode. 嵌入的图像。.

Properties:


AttachedFile

Properties CompositeNode. 嵌入的文件附件。.


Properties

Properties CompositeNode. OutlineElement 中的表格。.


TableRow

Properties CompositeNode. 在…中的一行 Table. 遍历 GetChildNodes(TableCell) 以访问单元格。.


TableCell

Properties CompositeNode. 位于…中的单元格 TableRow. 包含 RichText, Image, 以及其他内容节点。.


NoteTag

Properties Node. 一个附加到内容节点的 OneNote 标记。.

时间戳备注: createdcompleted 是从 MS-ONE 二进制格式解析出的原始整数时间戳,而不是 datetime 对象。.

工厂方法:


NumberList

Properties Node. 编号或项目符号列表的元数据在一个 OutlineElement.


LoadOptions


SaveOptions

所有保存选项的基类。必需的位置参数。.


PdfSaveOptions

Properties SaveOptions. PDF 特定的导出配置。使用以下方式构建 PdfSaveOptions(SaveFormat.Pdf).

PageIndex / PageCount 注意事项::这些字段在 PdfSaveOptions 为了 API 兼容性,但 Document.Save() v26.3.1 版的实现不会读取或转发它们到 PDF 导出器。所有页面始终都会被导出。.


许可证和计量

导出兼容性存根以实现与 Aspose.Note 对 .NET 的 API 形状兼容。在此 FOSS 实现中,所有方法均为空操作。.

from aspose.note import License, Metered

lic = License()
lic.SetLicense("path/to/license.lic")  # no-op

m = Metered()
m.SetMeteredKey("public_key", "private_key")  # no-op

使用 Aspose.Note FOSS for Python 的任何功能均不需要许可证密钥。.


Properties

完整枚举参考:: Properties

SaveFormat

FileFormat

枚举值表示 OneNote 文件格式版本。. Document.FileFormat 提供尽力而为的指示。.

HorizontalAlignment

NodeType


Properties

完整异常参考:: Properties


另见

 中文