NumberList

NumberList — Aspose.Note FOSS for Python API Reference

คลาส: NumberList

Properties: aspose.note Properties: from aspose.note import NumberList Properties: Node

NumberList เก็บข้อมูลเมตาดาต้าการจัดลำดับรายการที่แนบกับ OutlineElement. เมื่อ OutlineElement.NumberList ไม่ใช่ None, องค์ประกอบเป็นส่วนหนึ่งของรายการที่เรียงลำดับหรือไม่เรียงลำดับ คุณสมบัติเสนอค่าดิบที่ถูกแยกวิเคราะห์จากรูปแบบไบนารี MS-ONE และเป็นแบบอ่านอย่างเดียว; ไม่สามารถตั้งค่าโดยผู้ใช้ในเวอร์ชัน v26.3.1.


Properties

คุณสมบัติทั้งหมดเป็นแบบอ่านอย่างเดียว.

PropertiesPropertiesPropertiesProperties
Format`strNone`None
Restart`intNone`None
IsNumberedboolFalseTrue สำหรับรายการที่เรียงลำดับ (เป็นตัวเลข); False สำหรับรายการแบบหัวข้อหรือรายการที่ไม่เรียงลำดับ.

สืบทอดจาก Node

PropertiesPropertiesProperties
ParentNode`NodeNone`
Document`DocumentNone`

Properties

  • ข้อมูลแบบอ่านอย่างเดียว: Format, Restart, และ IsNumbered ถูกแยกวิเคราะห์จากไฟล์ไบนารี ไม่มี API ที่จะเปลี่ยนแปลงการจัดลำดับในเวอร์ชัน v26.3.1.
  • สตริงรูปแบบ: นี้ 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 — ตรวจสอบก่อนเข้าถึงคุณสมบัติใด ๆ.


ดูเพิ่มเติม

 ภาษาไทย