להסיר שדות
Contents
[
Hide
]
לפעמים צריך להסיר שדה מן המסמך. זה עשוי להתרחש כאשר יש להחליף אותו בסוג שדה שונה או כאשר השדה כבר לא נחוץ במסמך. למשל TOC
שדה בעת שמירת HTML
כדי להסיר שדה מוכנס לתוך מסמך באמצעות DocumentBuilder.insert_field, שימוש חוזר Field אובייקט, המספק את הנוחות remove שיטה להסיר בקלות את השדה מן המסמך.
הדוגמה הבאה של הקוד מראה כיצד להסיר שדה מהמסמכים:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET | |
doc = aw.Document(docs_base.my_dir + "Various fields.docx") | |
field = doc.range.fields[0] | |
field.remove() |
ניתן להוריד את קובץ הדגימה של דוגמה זו Aspose.Words GitHub.