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.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
shape | `int | None` | None |
label | `str | None` | None |
text_color | `int | None` | None |
highlight_color | `int | None` | None |
created | `int | None` | None |
completed | `int | None` | None |
สืบทอดจาก Node
| Properties | Properties | Properties |
|---|---|---|
ParentNode | `Node | None` |
Document | `Document | None` |
บันทึกเวลา
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), แต่อาจเป็นค่าว่างได้.
ดูเพิ่มเติม
- Properties: คลาสฐาน
- RichText: โหนดข้อความที่บรรจุแท็ก
- AttachedFile: โหนดแนบที่บรรจุแท็ก
- Properties: โหนดภาพที่บรรจุแท็ก
- คู่มือผู้พัฒนา