كيفية التحقق من علامات OneNote في Python
OneNote يسمح للمستخدمين بتسجيل المحتوى مع علامات ملونة: النجوم، صناديق التحقق، العلم المهم، والعلامات المخصصة. Aspose.Nota FOSS for Python يعرض هذه الإشارات على أن NoteTag الموضوعات على RichText, Image, AttachedFile,و ، و Table النواة من خلالها .Tags هذا الدليل يظهر كيفية قراءتها.
خطوة بخطوة دليل
الخطوة 1: تثبيت Aspose.Note FOSS لـ Python
pip install aspose-noteالخطوة 2: تحميل ملف .1
from aspose.note import Document
doc = Document("TaggedNotes.one")
print(f"Pages: {len(list(doc))}")الخطوة 3: العثور على علامات على RichText Nodes
معظم العلامات المرفقة إلى الكتل النصية:
from aspose.note import Document, RichText
doc = Document("TaggedNotes.one")
for rt in doc.GetChildNodes(RichText):
for tag in rt.Tags:
print(f"[RichText] Label={tag.Label!r} Icon={tag.Icon} text={rt.Text.strip()!r}")الخطوة 4: العثور على علامات في الصور
from aspose.note import Document, Image
doc = Document("TaggedNotes.one")
for img in doc.GetChildNodes(Image):
for tag in img.Tags:
print(f"[Image] Label={tag.Label!r} filename={img.FileName!r}")الخطوة 5: العثور على علامات على اللوحات
from aspose.note import Document, Table
doc = Document("TaggedNotes.one")
for table in doc.GetChildNodes(Table):
for tag in table.Tags:
print(f"[Table] Label={tag.Label!r} widths={[col.Width for col in table.Columns]}")الخطوة 6: جمع جميع العلامات عبر المستند
from aspose.note import Document, RichText, Image, Table
doc = Document("TaggedNotes.one")
all_tags = []
for rt in doc.GetChildNodes(RichText):
for tag in rt.Tags:
all_tags.append({"type": "RichText", "Label": tag.Label,
"CompletedTime": tag.CompletedTime, "text": rt.Text.strip()})
for img in doc.GetChildNodes(Image):
for tag in img.Tags:
all_tags.append({"type": "Image", "Label": tag.Label,
"CompletedTime": tag.CompletedTime, "file": img.FileName})
for table in doc.GetChildNodes(Table):
for tag in table.Tags:
all_tags.append({"type": "Table", "Label": tag.Label,
"CompletedTime": tag.CompletedTime})
print(f"Total tagged items: {len(all_tags)}")
for item in all_tags:
print(item)ملاحظات الممتلكات
| الممتلكات | نوع | وصف |
|---|---|---|
Icon | `int | None` |
Label | `str | None` |
FontColor | `int | None` |
Highlight | `int | None` |
CreationTime | `datetime | None` |
CompletedTime | `datetime | None` |
Status | TagStatus | TagStatus.Completed إذا تم الانتهاء، وإلا TagStatus.Open |
Filter كاملة vs Pending Tags
العلامات التي تم فحصها (مثل علامات “إجراء”) لديها غير-None الـمـنـتـهـيCompletedTime ميدان :
from aspose.note import Document, RichText
doc = Document("TaggedNotes.one")
pending, done = [], []
for rt in doc.GetChildNodes(RichText):
for tag in rt.Tags:
item = {"Label": tag.Label, "text": rt.Text.strip()}
if tag.CompletedTime is None:
pending.append(item)
else:
done.append(item)
print(f"Pending: {len(pending)} Done: {len(done)}")
for p in pending:
print(f" [ ] {p['Label']}: {p['text']!r}")
for d in done:
print(f" [x] {d['Label']}: {d['text']!r}")إعداد علامة التبويب (في الذاكرة)
طريقة المصنع NoteTag.CreateYellowStar() إنشاء عقدة علامة يمكنك إرفاقها إلى محتوى جديد في الذاكرة:
from aspose.note import NoteTag
tag = NoteTag.CreateYellowStar()
print(f"Created tag: Icon={tag.Icon} Label={tag.Label!r}")إنشاء الذاكرة مفيد للتوافق بين API.لأن الكتابة مرة أخرى إلى
.oneلا يتم دعمها ، لا يمكن استمرار علامات التبويب التي تم إنشاؤها في الملف.
القضايا المشتركة
لا توجد علامات (يعود المستند إلى قائمة العلامات الفارغة):* ليس كلها .one تحقق من أن وثيقة المصدر لديها علامات مرئية في Microsoft OneNote قبل حل المشكلة الرمز.
tag.Label هو شريط فارغ: بعض أشكال العلامة لا تحتوي على علامة نصية في ملف البيانات الميتا. tag.Icon لتحديد نوع العلامة برامج.
الموارد ذات الصلة :