להסיר שדות
Contents
[
Hide
]
לפעמים צריך להסיר שדה מ מסמך. זה עשוי להתרחש כאשר יש להחליף אותו בסוג שדה שונה או כאשר השדה כבר לא צריך במסמך. לדוגמה, TOC
שדה בעת שמירת HTML
כדי להסיר שדה מוכנס לתוך מסמך באמצעות DocumentBuilder.InsertField, שימוש חוזר 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-.NET | |
Document doc = new Document(MyDir + "Various fields.docx"); | |
Field field = doc.Range.Fields[0]; | |
field.Remove(); |
ניתן להוריד את קובץ הדגימה של דוגמה זו Aspose.Words GitHub.