NoteTag — Aspose.Note FOSS for Python API Reference

คลาส: NoteTag

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

NoteTag เป็นไอคอนแท็ก OneNote (ดาว, กล่องทำเครื่องหมาย, เครื่องหมายสำคัญ ฯลฯ) ที่แนบกับโหนดเนื้อหา แท็กจะปรากฏบน RichText, Image, AttachedFile, OutlineElement, และ Table โหนดผ่าน .Tags คุณสมบัติ.


Properties

คุณสมบัติทั้งหมดเป็นแบบอ่านอย่างเดียวและสะท้อนค่าที่แยกวิเคราะห์โดยตรงจากรูปแบบไบนารี MS-ONE.

PropertiesPropertiesPropertiesProperties
shape`intNone`None
label`strNone`None
text_color`intNone`None
highlight_color`intNone`None
created`intNone`None
completed`intNone`None

สืบทอดจาก Node

PropertiesPropertiesProperties
ParentNode`NodeNone`
Document`DocumentNone`

บันทึกเวลา

created และ completed เป็นค่า timestamp จำนวนเต็มดิบที่แยกวิเคราะห์จากรูปแบบไบนารี MS-ONE พวกมันเป็น ไม่ใช่ datetime อ็อบเจ็กต์ หากคุณต้องการทำงานกับพวกมันในรูปแบบวันเวลา Python ให้ดูสเปคฟอร์แมตไฟล์ MS-ONE สำหรับสูตรการแปลง.


เมธอดแฟคทอรี

NoteTag.CreateYellowStar()

tag = NoteTag.CreateYellowStar() -> NoteTag

คืนค่าใหม่ NoteTag ด้วย shape=None และ label="Yellow Star". มีประโยชน์เมื่อสร้างเอกสารโดยโปรแกรม.


ตัวอย่างการใช้งาน

แสดงรายการองค์ประกอบทั้งหมดที่มีแท็กในเอกสาร

from aspose.note import Document, RichText, Image, AttachedFile, OutlineElement

doc = Document("MyNotes.one")

# Tags on RichText
for rt in doc.GetChildNodes(RichText):
    for tag in rt.Tags:
        print(f"RichText tag: label={tag.label!r}  on: {rt.Text.strip()[:40]!r}")

# Tags on Images
for img in doc.GetChildNodes(Image):
    for tag in img.Tags:
        print(f"Image tag: label={tag.label!r}  file={img.FileName!r}")

# Tags on AttachedFiles
for af in doc.GetChildNodes(AttachedFile):
    for tag in af.Tags:
        print(f"Attachment tag: label={tag.label!r}  file={af.FileName!r}")

กรองแท็ก “To Do” ที่ยังไม่สมบูรณ์

from aspose.note import Document, RichText

doc = Document("MyNotes.one")
for rt in doc.GetChildNodes(RichText):
    for tag in rt.Tags:
        if tag.label and "to do" in tag.label.lower() and tag.completed is None:
            print(f"Incomplete TODO: {rt.Text.strip()!r}")

ความปลอดภัยจาก None

label, shape, text_color, highlight_color, created, และ completed ทั้งหมดสามารถเป็น None. ตรวจสอบก่อนใช้งาน. Tags รายการบนโหนดเนื้อหาจะเป็นรายการเสมอ (ไม่มีวัน None), แต่อาจเป็นค่าว่างได้.


ดูเพิ่มเติม

 ภาษาไทย