NumberList — Aspose.Note FOSS for Python API Reference
类:NumberList
Properties: aspose.note Properties: from aspose.note import NumberList Properties: Node
NumberList 保存附加到某个元素的 list-numbering 元数据 OutlineElement.当 OutlineElement.NumberList 不是 None,,该元素是有序或无序列表的一部分。这些属性反映从 MS-ONE 二进制格式解析的原始值,且为只读;在 v26.3.1 中无法由用户设置。.
Properties
所有属性均为只读。.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
Format | `str | None` | None |
Restart | `int | None` | None |
IsNumbered | bool | False | True 用于有序(编号)列表;; False 用于项目符号或非顺序列表。. |
继承自 Node
| Properties | Properties | Properties |
|---|---|---|
ParentNode | `Node | None` |
Document | `Document | None` |
Properties
- 只读数据:
Format,Restart,,以及IsNumbered是从二进制文件解析的。v26.3.1 中没有用于修改编号的 API。. - 格式字符串: 该
Format字符串遵循原始 MS-ONE 编号格式,而不是人类可读的模式。常见值包括十进制格式字符串("%1.","%1)")用于编号列表和项目符号字符("•","–") 用于项目符号列表。. - 存在检查: 始终检查
OutlineElement.NumberList is not None在访问此对象之前。.
使用示例
检测编号列表项与项目符号列表项
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
restart_info = f" restart={nl.Restart}" if nl.Restart is not None else ""
print(f"format={nl.Format!r}{restart_info}")收集所有编号列表项及其文本
from aspose.note import Document, OutlineElement, RichText
doc = Document("MyNotes.one")
for oe in doc.GetChildNodes(OutlineElement):
if oe.NumberList is not None:
texts = [rt.Text for rt in oe.GetChildNodes(RichText) if rt.Text]
print(" | ".join(texts))None 安全性
Format 和 Restart 可能是 None. IsNumbered 始终是一个 bool. OutlineElement.NumberList 它本身可能是 None — 在访问任何属性之前检查。.
另见
- Properties: 基类
- OutlineElement: 携带 a 的元素
NumberList - 开发者指南